ListEx.hascasl.output revision a59f2017dfc311ece7afcea3e8a3ceceac77ba5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
var b : Type
var a : +Type
type List(a : +Type);
free type List a ::= Nil | Cons (head : a; tail : List a);
free type List a ::= Nil | Cons (head : a; tail : List b);
free type List a ::= Nil | Cons (head : a; tail : List a b);
free type List a ::= Nil | Cons (head : a; tail : List (List a));
free type Tree a ::= Leaf | Branch (head : Tree a; tail : Tree a);
generated
{type Tree1(a : +Type)
::= Leaf | Branch (head : Tree a; tail : Tree1 a);
}
type Tree2(a : +Type)
::= Leaf | Branch (head : Tree a; tail : Tree2 a);
free type
even a ::= rek (odd a);
odd a ::= rek (even a);
free type
even2 a ::= rek (odd2 (odd2 a));
odd2 a ::= rek (even2 a);
%% Type Constructors -----------------------------------------------------
List
: +Type -> Type
%[free type List(a : +Type) ::=
Nil : List a
Cons : a * List a -> List a(head : a; tail : List a)]%
Tree
: +Type -> Type
%[free type Tree(a : +Type) ::=
Leaf : Tree a
Branch : Tree a * Tree a -> Tree a(head : Tree a; tail : Tree a)]%
Tree1
: +Type -> Type
%[generated type Tree1(a : +Type) ::=
Leaf : Tree1 a
Branch : Tree a * Tree1 a -> Tree1 a
(head : Tree a; tail : Tree1 a)]%
Tree2
: +Type -> Type
%[type Tree2(a : +Type) ::=
Leaf : Tree2 a
Branch : Tree a * Tree2 a -> Tree2 a
(head : Tree a; tail : Tree2 a)]%
even
: +Type -> Type
%[free type even(a : +Type) ::= rek : odd a -> even a(odd a)]%
even2 : +Type -> Type %(data type)%
odd
: +Type -> Type
%[free type odd(a : +Type) ::= rek : even a -> odd a(even a)]%
odd2
: +Type -> Type
%[free type odd2(a : +Type) ::= rek : even2 a -> odd2 a(even2 a)]%
%% Type Variables --------------------------------------------------------
a : +Type %(var_2)%
b : Type %(var_1)%
%% Assumptions -----------------------------------------------------------
Branch
: forall a : +Type . Tree a * Tree2 a -> Tree2 a
%(construct Tree2)%
: forall a : +Type . Tree a * Tree1 a -> Tree1 a
%(construct Tree1)%
: forall a : +Type . Tree a * Tree a -> Tree a %(construct Tree)%
Cons : forall a : +Type . a * List a -> List a %(construct List)%
Leaf
: forall a : +Type . Tree2 a %(construct Tree2)%
: forall a : +Type . Tree1 a %(construct Tree1)%
: forall a : +Type . Tree a %(construct Tree)%
Nil : forall a : +Type . List a %(construct List)%
head
: forall a : +Type . Tree2 a -> Tree a
%(select from Tree2 constructed by
Branch : forall a : +Type . Tree a * Tree2 a -> Tree2 a)%
: forall a : +Type . Tree1 a -> Tree a
%(select from Tree1 constructed by
Branch : forall a : +Type . Tree a * Tree1 a -> Tree1 a)%
: forall a : +Type . Tree a -> Tree a
%(select from Tree constructed by
Branch : forall a : +Type . Tree a * Tree a -> Tree a)%
: forall a : +Type . List a -> a
%(select from List constructed by
Cons : forall a : +Type . a * List a -> List a)%
rek
: forall a : +Type . even2 a -> odd2 a %(construct odd2)%
: forall a : +Type . even a -> odd a %(construct odd)%
: forall a : +Type . odd a -> even a %(construct even)%
tail
: forall a : +Type . Tree2 a -> Tree2 a
%(select from Tree2 constructed by
Branch : forall a : +Type . Tree a * Tree2 a -> Tree2 a)%
: forall a : +Type . Tree1 a -> Tree1 a
%(select from Tree1 constructed by
Branch : forall a : +Type . Tree a * Tree1 a -> Tree1 a)%
: forall a : +Type . Tree a -> Tree a
%(select from Tree constructed by
Branch : forall a : +Type . Tree a * Tree a -> Tree a)%
: forall a : +Type . List a -> List a
%(select from List constructed by
Cons : forall a : +Type . a * List a -> List a)%
%% Sentences -------------------------------------------------------------
forall a : +Type; x_1_1 : a; x_1_2 : List a .
(op head : forall a : +Type . List a -> a) (Cons (x_1_1, x_1_2)) =
x_1_1 %(ga_select_head)%
forall a : +Type; x_1_1 : a; x_1_2 : List a .
(op tail : forall a : +Type . List a -> List a)
(Cons (x_1_1, x_1_2))
= x_1_2 %(ga_select_tail)%
free type List(a : +Type) ::=
Nil : List a
Cons : a * List a -> List a(head : a; tail : List a)
%(ga_List)%
free type List(a : +Type) ::=
Nil : List a
Cons : a * List a -> List a(head : a; tail : List a)
%(ga_List)%
free type List(a : +Type) ::=
Nil : List a
Cons : a * List a -> List a(head : a; tail : List a)
%(ga_List)%
free type List(a : +Type) ::=
Nil : List a
Cons : a * List a -> List a(head : a; tail : List a)
%(ga_List)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree a .
(op head : forall a : +Type . Tree a -> Tree a)
((op Branch : forall a : +Type . Tree a * Tree a -> Tree a)
(x_1_1, x_1_2))
= x_1_1 %(ga_select_head)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree a .
(op tail : forall a : +Type . Tree a -> Tree a)
((op Branch : forall a : +Type . Tree a * Tree a -> Tree a)
(x_1_1, x_1_2))
= x_1_2 %(ga_select_tail)%
free type Tree(a : +Type) ::=
Leaf : Tree a
Branch : Tree a * Tree a -> Tree a(head : Tree a; tail : Tree a)
%(ga_Tree)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree1 a .
(op head : forall a : +Type . Tree1 a -> Tree a)
((op Branch : forall a : +Type . Tree a * Tree1 a -> Tree1 a)
(x_1_1, x_1_2))
= x_1_1 %(ga_select_head)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree1 a .
(op tail : forall a : +Type . Tree1 a -> Tree1 a)
((op Branch : forall a : +Type . Tree a * Tree1 a -> Tree1 a)
(x_1_1, x_1_2))
= x_1_2 %(ga_select_tail)%
generated type Tree1(a : +Type) ::=
Leaf : Tree1 a
Branch : Tree a * Tree1 a -> Tree1 a
(head : Tree a; tail : Tree1 a) %(ga_Tree1)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree2 a .
(op head : forall a : +Type . Tree2 a -> Tree a)
((op Branch : forall a : +Type . Tree a * Tree2 a -> Tree2 a)
(x_1_1, x_1_2))
= x_1_1 %(ga_select_head)%
forall a : +Type; x_1_1 : Tree a; x_1_2 : Tree2 a .
(op tail : forall a : +Type . Tree2 a -> Tree2 a)
((op Branch : forall a : +Type . Tree a * Tree2 a -> Tree2 a)
(x_1_1, x_1_2))
= x_1_2 %(ga_select_tail)%
type Tree2(a : +Type) ::=
Leaf : Tree2 a
Branch : Tree a * Tree2 a -> Tree2 a(head : Tree a; tail : Tree2 a)
%(ga_Tree2)%
free type even(a : +Type) ::= rek : odd a -> even a(odd a)
free type odd(a : +Type) ::= rek : even a -> odd a(even a)
%(ga_even_odd)%
free type odd2(a : +Type) ::= rek : even2 a -> odd2 a(even2 a)
%(ga_even2_odd2)%
%% Diagnostics -----------------------------------------------------------
### Hint 1.5, is type variable 'b'
### Hint 2.5, is type variable 'a'
### Hint 3.11, rebound type variable 'a'
### Hint 4.16, rebound type variable 'a'
### Hint 4.11, redeclared type 'List'
### Hint 5.16, rebound type variable 'a'
*** Error 5.50-5.55, unbound type variable(s)
b in 'List b'
### Hint 6.16, rebound type variable 'a'
*** Error 6.50-6.57, unexpected type argument 'b'
### Hint 7.16, rebound type variable 'a'
*** Error 7.50-7.61, illegal polymorphic recursion
expected: List a
found: List (List a)
### Hint 9.16, rebound type variable 'a'
### Hint 10.22, rebound type variable 'a'
### Hint 11.12, rebound type variable 'a'
### Hint 13.16, rebound type variable 'a'
### Hint 13.39, rebound type variable 'a'
### Hint 14.17, rebound type variable 'a'
### Hint 14.49, rebound type variable 'a'
*** Error 14.27-14.38, illegal polymorphic recursion
expected: odd2 a
found: odd2 (odd2 a)