author | traytel |
Thu, 06 Sep 2012 16:06:22 +0200 | |
changeset 49185 | 073d7d1b7488 |
parent 49166 | e075733fa8c2 |
child 49186 | 4b5fa9d5e330 |
permissions | -rw-r--r-- |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
1 |
(* Title: Codatatype_Examples/Misc_Data.thy |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
2 |
Author: Dmitriy Traytel, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
3 |
Author: Andrei Popescu, TU Muenchen |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
4 |
Copyright 2012 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
5 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
6 |
Miscellaneous datatype declarations. |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
7 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
8 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
9 |
header {* Miscellaneous Datatype Declarations *} |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
10 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
11 |
theory Misc_Data |
48980 | 12 |
imports "../Codatatype" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
13 |
begin |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
14 |
|
49157 | 15 |
data simple = X1 | X2 | X3 | X4 |
16 |
||
17 |
data simple' = X1' unit | X2' unit | X3' unit | X4' unit |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
18 |
|
49157 | 19 |
data 'a mylist = MyNil | MyCons 'a "'a mylist" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
20 |
|
49157 | 21 |
data ('b, 'c, 'd, 'e) some_passive = |
22 |
SP1 "('b, 'c, 'd, 'e) some_passive" | SP2 'b | SP3 'c | SP4 'd | SP5 'e |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
23 |
|
49157 | 24 |
data lambda = |
25 |
Var string | |
|
26 |
App lambda lambda | |
|
27 |
Abs string lambda | |
|
28 |
Let "(string \<times> lambda) fset" lambda |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
29 |
|
49157 | 30 |
data 'a par_lambda = |
31 |
PVar 'a | |
|
32 |
PApp "'a par_lambda" "'a par_lambda" | |
|
33 |
PAbs 'a "'a par_lambda" | |
|
34 |
PLet "('a \<times> 'a par_lambda) fset" "'a par_lambda" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
35 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
36 |
(* |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
37 |
('a, 'b1, 'b2) F1 = 'a * 'b1 + 'a * 'b2 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
38 |
('a, 'b1, 'b2) F2 = unit + 'b1 * 'b2 |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
39 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
40 |
|
49157 | 41 |
data 'a I1 = I11 'a "'a I1" | I12 'a "'a I2" |
42 |
and 'a I2 = I21 | I22 "'a I1" "'a I2" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
43 |
|
49157 | 44 |
data 'a tree = TEmpty | TNode 'a "'a forest" |
45 |
and 'a forest = FNil | FCons "'a tree" "'a forest" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
46 |
|
49157 | 47 |
data 'a tree' = TEmpty' | TNode' "'a branch" "'a branch" |
48 |
and 'a branch = Branch 'a "'a tree'" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
49 |
|
49157 | 50 |
data ('a, 'b) exp = Term "('a, 'b) trm" | Sum "('a, 'b) trm" "('a, 'b) exp" |
51 |
and ('a, 'b) trm = Factor "('a, 'b) factor" | Prod "('a, 'b) factor" "('a, 'b) trm" |
|
52 |
and ('a, 'b) factor = C 'a | V 'b | Paren "('a, 'b) exp" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
53 |
|
49157 | 54 |
data ('a, 'b, 'c) some_killing = |
55 |
SK "'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b, 'c) some_killing + ('a, 'b, 'c) in_here" |
|
56 |
and ('a, 'b, 'c) in_here = |
|
57 |
IH1 'b 'a | IH2 'c |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
58 |
|
49166 | 59 |
data 'b nofail1 = NF11 "'b nofail1 \<times> 'b" | NF12 'b |
49157 | 60 |
data 'b nofail2 = NF2 "('b nofail2 \<times> 'b \<times> 'b nofail2 \<times> 'b) list" |
61 |
data 'b nofail3 = NF3 "'b \<times> ('b nofail3 \<times> 'b \<times> 'b nofail3 \<times> 'b) fset" |
|
62 |
data 'b nofail4 = NF4 "('b nofail3 \<times> ('b nofail3 \<times> 'b \<times> 'b nofail3 \<times> 'b) fset) list" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
63 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
64 |
(* |
49157 | 65 |
data 'b fail = F "'b fail \<times> 'b \<times> 'b fail \<times> 'b list" |
66 |
data 'b fail = F "'b fail \<times> 'b \<times> 'b fail \<times> 'b" |
|
67 |
data 'b fail = F "'b fail \<times> 'b + 'b fail" |
|
68 |
data 'b fail = F "'b fail \<times> 'b" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
69 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
70 |
|
49157 | 71 |
data l1 = L1 "l2 list" |
72 |
and l2 = L21 "l1 fset" | L22 l2 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
73 |
|
49157 | 74 |
data kk1 = KK1 kk2 |
75 |
and kk2 = KK2 kk3 |
|
76 |
and kk3 = KK3 "kk1 list" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
77 |
|
49157 | 78 |
data t1 = T11 t3 | T12 t2 |
79 |
and t2 = T2 t1 |
|
80 |
and t3 = T3 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
81 |
|
49157 | 82 |
data t1' = T11' t2' | T12' t3' |
83 |
and t2' = T2' t1' |
|
84 |
and t3' = T3' |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
85 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
86 |
(* |
49157 | 87 |
data fail1 = F1 fail2 |
88 |
and fail2 = F2 fail3 |
|
89 |
and fail3 = F3 fail1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
90 |
|
49157 | 91 |
data fail1 = F1 "fail2 list" fail2 |
92 |
and fail2 = F2 "fail2 fset" fail3 |
|
93 |
and fail3 = F3 fail1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
94 |
|
49157 | 95 |
data fail1 = F1 "fail2 list" fail2 |
96 |
and fail2 = F2 "fail1 fset" fail1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
97 |
*) |
49157 | 98 |
|
49162 | 99 |
(* SLOW |
49157 | 100 |
data ('a, 'c) D1 = A1 "('a, 'c) D2" | B1 "'a list" |
101 |
and ('a, 'c) D2 = A2 "('a, 'c) D3" | B2 "'c list" |
|
102 |
and ('a, 'c) D3 = A3 "('a, 'c) D3" | B3 "('a, 'c) D4" | C3 "('a, 'c) D4" "('a, 'c) D5" |
|
103 |
and ('a, 'c) D4 = A4 "('a, 'c) D5" | B4 "'a list list list" |
|
104 |
and ('a, 'c) D5 = A5 "('a, 'c) D6" |
|
105 |
and ('a, 'c) D6 = A6 "('a, 'c) D7" |
|
106 |
and ('a, 'c) D7 = A7 "('a, 'c) D8" |
|
107 |
and ('a, 'c) D8 = A8 "('a, 'c) D1 list" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
108 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
109 |
(*time comparison*) |
49157 | 110 |
datatype ('a, 'c) D1' = A1' "('a, 'c) D2'" | B1' "'a list" |
111 |
and ('a, 'c) D2' = A2' "('a, 'c) D3'" | B2' "'c list" |
|
112 |
and ('a, 'c) D3' = A3' "('a, 'c) D3'" | B3' "('a, 'c) D4'" | C3' "('a, 'c) D4'" "('a, 'c) D5'" |
|
113 |
and ('a, 'c) D4' = A4' "('a, 'c) D5'" | B4' "'a list list list" |
|
114 |
and ('a, 'c) D5' = A5' "('a, 'c) D6'" |
|
115 |
and ('a, 'c) D6' = A6' "('a, 'c) D7'" |
|
116 |
and ('a, 'c) D7' = A7' "('a, 'c) D8'" |
|
117 |
and ('a, 'c) D8' = A8' "('a, 'c) D1' list" |
|
49162 | 118 |
*) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
119 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
120 |
(* fail: |
49157 | 121 |
data tt1 = TT11 tt2 tt3 | TT12 tt2 tt4 |
122 |
and tt2 = TT2 |
|
123 |
and tt3 = TT3 tt4 |
|
124 |
and tt4 = TT4 tt1 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
125 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
126 |
|
49157 | 127 |
data k1 = K11 k2 k3 | K12 k2 k4 |
128 |
and k2 = K2 |
|
129 |
and k3 = K3 k4 |
|
130 |
and k4 = K4 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
131 |
|
49157 | 132 |
data tt1 = TT11 tt3 tt2 | TT12 tt2 tt4 |
133 |
and tt2 = TT2 |
|
134 |
and tt3 = TT3 tt1 |
|
135 |
and tt4 = TT4 |
|
136 |
||
49162 | 137 |
(* SLOW |
49157 | 138 |
data s1 = S11 s2 s3 s4 | S12 s3 | S13 s2 s6 | S14 s4 s2 | S15 s2 s2 |
139 |
and s2 = S21 s7 s5 | S22 s5 s4 s6 |
|
140 |
and s3 = S31 s1 s7 s2 | S32 s3 s3 | S33 s4 s5 |
|
141 |
and s4 = S4 s5 |
|
142 |
and s5 = S5 |
|
143 |
and s6 = S61 s6 | S62 s1 s2 | S63 s6 |
|
144 |
and s7 = S71 s8 | S72 s5 |
|
145 |
and s8 = S8 nat |
|
49162 | 146 |
*) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
147 |
|
49185
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
148 |
data ('a, 'b) bar = BAR "'b \<Rightarrow> 'a" |
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
149 |
data ('a, 'b, 'c, 'd) foo = FOO "'d + 'b \<Rightarrow> 'c + 'a" |
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
150 |
|
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
151 |
data 'a dead_foo = A |
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
152 |
(* FIXME: handle unknown type constructors using DEADID? |
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
153 |
data ('a, 'b) use_dead_foo = Y "'a" "'b dead_foo" |
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
154 |
*) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
155 |
end |