author | wenzelm |
Mon, 24 Oct 2016 11:42:39 +0200 | |
changeset 64367 | a424f2737646 |
parent 63167 | 0909deb8059b |
child 66453 | cc19f7ca2ed6 |
permissions | -rw-r--r-- |
58309
a09ec6daaa19
renamed 'BNF_Examples' to 'Datatype_Examples' (cf. 'datatypes.pdf')
blanchet
parents:
58232
diff
changeset
|
1 |
(* Title: HOL/Datatype_Examples/Misc_Datatype.thy |
48975
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 |
51744 | 4 |
Author: Jasmin Blanchette, TU Muenchen |
5 |
Copyright 2012, 2013 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
6 |
|
53122
bc87b7af4767
renamed theory files to be closer to (new) command names
blanchet
parents:
52844
diff
changeset
|
7 |
Miscellaneous datatype definitions. |
48975
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 |
|
63167 | 10 |
section \<open>Miscellaneous Datatype Definitions\<close> |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
11 |
|
53122
bc87b7af4767
renamed theory files to be closer to (new) command names
blanchet
parents:
52844
diff
changeset
|
12 |
theory Misc_Datatype |
58163
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
13 |
imports "~~/src/HOL/Library/Countable" "~~/src/HOL/Library/FSet" |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
14 |
begin |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
15 |
|
58310 | 16 |
datatype (discs_sels) simple = X1 | X2 | X3 | X4 |
49157 | 17 |
|
58310 | 18 |
datatype (discs_sels) 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
|
19 |
|
58310 | 20 |
datatype (discs_sels) simple'' = X1'' nat int | X2'' |
52323 | 21 |
|
58310 | 22 |
datatype (discs_sels) 'a mylist = MyNil | MyCons (myhd: 'a) (mytl: "'a mylist") |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
23 |
|
58310 | 24 |
datatype (discs_sels) ('b, 'c :: ord, 'd, 'e) some_passive = |
49157 | 25 |
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
|
26 |
|
58417
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
27 |
datatype (discs_sels) 'a multi_live_direct1 = MultiLiveDirect1 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
28 |
datatype (discs_sels) 'a multi_live_direct2 = MultiLiveDirect2 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
29 |
datatype (discs_sels) 'a multi_live_direct3 = MultiLiveDirect3 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
30 |
datatype (discs_sels) 'a multi_live_direct4 = MultiLiveDirect4 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
31 |
datatype (discs_sels) 'a multi_live_direct5 = MultiLiveDirect5 'a 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
32 |
datatype (discs_sels) 'a multi_live_direct6 = MultiLiveDirect6 'a 'a 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
33 |
datatype (discs_sels) 'a multi_live_direct7 = MultiLiveDirect7 'a 'a 'a 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
34 |
datatype (discs_sels) 'a multi_live_direct8 = MultiLiveDirect8 'a 'a 'a 'a 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
35 |
datatype (discs_sels) 'a multi_live_direct9 = MultiLiveDirect9 'a 'a 'a 'a 'a 'a 'a 'a 'a |
fa50722ad6cb
make 'set_induct0' tactic more robust w.r.t multiple arguments constructors
desharna
parents:
58332
diff
changeset
|
36 |
|
58966 | 37 |
datatype ('a, 'b) ite = ITE "'a \<Rightarrow> bool" "'a \<Rightarrow> 'b" "'a \<Rightarrow> 'b" |
38 |
||
58455 | 39 |
datatype 'a live_and_fun = LiveAndFun nat "nat \<Rightarrow> 'a" |
40 |
||
58310 | 41 |
datatype (discs_sels) hfset = HFset "hfset fset" |
49601 | 42 |
|
58310 | 43 |
datatype (discs_sels) lambda = |
49157 | 44 |
Var string | |
45 |
App lambda lambda | |
|
46 |
Abs string lambda | |
|
47 |
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
|
48 |
|
58310 | 49 |
datatype (discs_sels) 'a par_lambda = |
49157 | 50 |
PVar 'a | |
51 |
PApp "'a par_lambda" "'a par_lambda" | |
|
52 |
PAbs 'a "'a par_lambda" | |
|
53 |
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
|
54 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
55 |
(* |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
56 |
('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
|
57 |
('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
|
58 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
59 |
|
62536
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
60 |
locale loc = |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
61 |
fixes c :: 'a and d :: 'a |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
62 |
assumes "c \<noteq> d" |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
63 |
begin |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
64 |
|
62536
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
65 |
datatype (discs_sels) 'b I1 = I11 'b "'b I1" | I12 'b "'b I2" |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
66 |
and 'b I2 = I21 | I22 "'b I1" "'b I2" |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
67 |
|
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
68 |
datatype (discs_sels) 'b tree = TEmpty | TNode 'b "'b forest" |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
69 |
and 'b forest = FNil | FCons "'b tree" "'b forest" |
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
70 |
|
656e9653c645
made 'size' plugin compatible with locales again (and added regression test)
blanchet
parents:
58966
diff
changeset
|
71 |
end |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
72 |
|
58310 | 73 |
datatype (discs_sels) 'a tree' = TEmpty' | TNode' "'a branch" "'a branch" |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
74 |
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
|
75 |
|
58310 | 76 |
datatype (discs_sels) 'a bin_rose_tree = BRTree 'a "'a bin_rose_tree mylist" "'a bin_rose_tree mylist" |
55484 | 77 |
|
58310 | 78 |
datatype (discs_sels) ('a, 'b) exp = Term "('a, 'b) trm" | Sum "('a, 'b) trm" "('a, 'b) exp" |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
79 |
and ('a, 'b) trm = Factor "('a, 'b) factor" | Prod "('a, 'b) factor" "('a, 'b) trm" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
80 |
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
|
81 |
|
58310 | 82 |
datatype (discs_sels) 'a ftree = FTLeaf 'a | FTNode "'a \<Rightarrow> 'a ftree" |
53134 | 83 |
|
58310 | 84 |
datatype (discs_sels) ('a, 'b, 'c) some_killing = |
49157 | 85 |
SK "'a \<Rightarrow> 'b \<Rightarrow> ('a, 'b, 'c) some_killing + ('a, 'b, 'c) in_here" |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
86 |
and ('a, 'b, 'c) in_here = |
49157 | 87 |
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
|
88 |
|
58310 | 89 |
datatype (discs_sels) 'b nofail1 = NF11 "'b nofail1" 'b | NF12 'b |
90 |
datatype (discs_sels) 'b nofail2 = NF2 "('b nofail2 \<times> 'b \<times> 'b nofail2 \<times> 'b) list" |
|
91 |
datatype (discs_sels) 'b nofail3 = NF3 'b "('b nofail3 \<times> 'b \<times> 'b nofail3 \<times> 'b) fset" |
|
92 |
datatype (discs_sels) 'b nofail4 = NF4 "('b nofail4 \<times> ('b nofail4 \<times> 'b \<times> 'b nofail4 \<times> 'b) fset) list" |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
93 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
94 |
(* |
58310 | 95 |
datatype (discs_sels) 'b fail = F "'b fail" 'b "'b fail" "'b list" |
96 |
datatype (discs_sels) 'b fail = F "'b fail" 'b "'b fail" 'b |
|
97 |
datatype (discs_sels) 'b fail = F1 "'b fail" 'b | F2 "'b fail" |
|
98 |
datatype (discs_sels) 'b fail = F "'b fail" 'b |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
99 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
100 |
|
58310 | 101 |
datatype (discs_sels) l1 = L1 "l2 list" |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
102 |
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
|
103 |
|
58310 | 104 |
datatype (discs_sels) kk1 = KK1 kk2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
105 |
and kk2 = KK2 kk3 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
106 |
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
|
107 |
|
58310 | 108 |
datatype (discs_sels) t1 = T11 t3 | T12 t2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
109 |
and t2 = T2 t1 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
110 |
and t3 = T3 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
111 |
|
58310 | 112 |
datatype (discs_sels) t1' = T11' t2' | T12' t3' |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
113 |
and t2' = T2' t1' |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
114 |
and t3' = T3' |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
115 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
116 |
(* |
58310 | 117 |
datatype (discs_sels) fail1 = F1 fail2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
118 |
and fail2 = F2 fail3 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
119 |
and fail3 = F3 fail1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
120 |
|
58310 | 121 |
datatype (discs_sels) fail1 = F1 "fail2 list" fail2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
122 |
and fail2 = F2 "fail2 fset" fail3 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
123 |
and fail3 = F3 fail1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
124 |
|
58310 | 125 |
datatype (discs_sels) fail1 = F1 "fail2 list" fail2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
126 |
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
|
127 |
*) |
49157 | 128 |
|
49162 | 129 |
(* SLOW |
58310 | 130 |
datatype (discs_sels) ('a, 'c) D1 = A1 "('a, 'c) D2" | B1 "'a list" |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
131 |
and ('a, 'c) D2 = A2 "('a, 'c) D3" | B2 "'c list" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
132 |
and ('a, 'c) D3 = A3 "('a, 'c) D3" | B3 "('a, 'c) D4" | C3 "('a, 'c) D4" "('a, 'c) D5" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
133 |
and ('a, 'c) D4 = A4 "('a, 'c) D5" | B4 "'a list list list" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
134 |
and ('a, 'c) D5 = A5 "('a, 'c) D6" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
135 |
and ('a, 'c) D6 = A6 "('a, 'c) D7" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
136 |
and ('a, 'c) D7 = A7 "('a, 'c) D8" |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
137 |
and ('a, 'c) D8 = A8 "('a, 'c) D1 list" |
49162 | 138 |
*) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
139 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
140 |
(* fail: |
58310 | 141 |
datatype (discs_sels) tt1 = TT11 tt2 tt3 | TT12 tt2 tt4 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
142 |
and tt2 = TT2 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
143 |
and tt3 = TT3 tt4 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
144 |
and tt4 = TT4 tt1 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
145 |
*) |
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
146 |
|
58310 | 147 |
datatype (discs_sels) k1 = K11 k2 k3 | K12 k2 k4 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
148 |
and k2 = K2 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
149 |
and k3 = K3 k4 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
150 |
and k4 = K4 |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
151 |
|
58310 | 152 |
datatype (discs_sels) tt1 = TT11 tt3 tt2 | TT12 tt2 tt4 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
153 |
and tt2 = TT2 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
154 |
and tt3 = TT3 tt1 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
155 |
and tt4 = TT4 |
49157 | 156 |
|
49162 | 157 |
(* SLOW |
58310 | 158 |
datatype (discs_sels) s1 = S11 s2 s3 s4 | S12 s3 | S13 s2 s6 | S14 s4 s2 | S15 s2 s2 |
51804
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
159 |
and s2 = S21 s7 s5 | S22 s5 s4 s6 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
160 |
and s3 = S31 s1 s7 s2 | S32 s3 s3 | S33 s4 s5 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
161 |
and s4 = S4 s5 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
162 |
and s5 = S5 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
163 |
and s6 = S61 s6 | S62 s1 s2 | S63 s6 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
164 |
and s7 = S71 s8 | S72 s5 |
be6e703908f4
renamed BNF "(co)data" commands to names that are closer to their final names
blanchet
parents:
51744
diff
changeset
|
165 |
and s8 = S8 nat |
49162 | 166 |
*) |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
167 |
|
58310 | 168 |
datatype (discs_sels) 'a deadbar = DeadBar "'a \<Rightarrow> 'a" |
169 |
datatype (discs_sels) 'a deadbar_option = DeadBarOption "'a option \<Rightarrow> 'a option" |
|
170 |
datatype (discs_sels) ('a, 'b) bar = Bar "'b \<Rightarrow> 'a" |
|
171 |
datatype (discs_sels) ('a, 'b, 'c, 'd) foo = Foo "'d + 'b \<Rightarrow> 'c + 'a" |
|
172 |
datatype (discs_sels) 'a deadfoo = DeadFoo "'a \<Rightarrow> 'a + 'a" |
|
49185
073d7d1b7488
respect order of/additional type variables supplied by the user in fixed point constructions;
traytel
parents:
49166
diff
changeset
|
173 |
|
58332 | 174 |
datatype (discs_sels) (dead 'a) dead_foo = A |
175 |
datatype (discs_sels) ('a, 'b) use_dead_foo = Y 'a "'b dead_foo" |
|
176 |
||
177 |
datatype (discs_sels) 'a phantom = A |
|
178 |
datatype (discs_sels) 'a use_phantom = Y 'a "'a use_phantom phantom" |
|
49186
4b5fa9d5e330
handle type constructors not known to be a BNF using the DEADID BNF
traytel
parents:
49185
diff
changeset
|
179 |
|
58327 | 180 |
datatype ('t, 'id) dead_sum_fun = Dead_sum_fun "('t list \<Rightarrow> 't) + 't" | Bar (bar: 'id) |
181 |
||
58310 | 182 |
datatype (discs_sels) d1 = D |
183 |
datatype (discs_sels) d1' = is_D: D |
|
51744 | 184 |
|
58310 | 185 |
datatype (discs_sels) d2 = D nat |
186 |
datatype (discs_sels) d2' = is_D: D nat |
|
51744 | 187 |
|
58310 | 188 |
datatype (discs_sels) d3 = D | E |
189 |
datatype (discs_sels) d3' = D | is_E: E |
|
190 |
datatype (discs_sels) d3'' = is_D: D | E |
|
191 |
datatype (discs_sels) d3''' = is_D: D | is_E: E |
|
51744 | 192 |
|
58310 | 193 |
datatype (discs_sels) d4 = D nat | E |
194 |
datatype (discs_sels) d4' = D nat | is_E: E |
|
195 |
datatype (discs_sels) d4'' = is_D: D nat | E |
|
196 |
datatype (discs_sels) d4''' = is_D: D nat | is_E: E |
|
51744 | 197 |
|
58310 | 198 |
datatype (discs_sels) d5 = D nat | E int |
199 |
datatype (discs_sels) d5' = D nat | is_E: E int |
|
200 |
datatype (discs_sels) d5'' = is_D: D nat | E int |
|
201 |
datatype (discs_sels) d5''' = is_D: D nat | is_E: E int |
|
51744 | 202 |
|
58163
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
203 |
instance simple :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
204 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
205 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
206 |
instance simple'' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
207 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
208 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
209 |
instance mylist :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
210 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
211 |
|
58232
7b70a2b4ec9b
made new countable tactic work with sorts other than 'type'
blanchet
parents:
58228
diff
changeset
|
212 |
instance some_passive :: (countable, "{countable,ord}", countable, countable) countable |
58163
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
213 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
214 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
215 |
(* TODO: Enable once "fset" is registered as countable: |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
216 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
217 |
instance hfset :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
218 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
219 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
220 |
instance lambda :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
221 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
222 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
223 |
instance par_lambda :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
224 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
225 |
*) |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
226 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
227 |
instance tree' and branch :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
228 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
229 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
230 |
instance bin_rose_tree :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
231 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
232 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
233 |
instance exp and trm and factor :: (countable, countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
234 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
235 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
236 |
instance nofail1 :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
237 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
238 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
239 |
instance nofail2 :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
240 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
241 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
242 |
(* TODO: Enable once "fset" is registered as countable: |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
243 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
244 |
instance nofail3 :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
245 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
246 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
247 |
instance nofail4 :: (countable) countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
248 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
249 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
250 |
instance l1 and l2 :: countable |
58173 | 251 |
by countable_datatype |
58163
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
252 |
*) |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
253 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
254 |
instance kk1 and kk2 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
255 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
256 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
257 |
instance t1 and t2 and t3 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
258 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
259 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
260 |
instance t1' and t2' and t3' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
261 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
262 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
263 |
instance k1 and k2 and k3 and k4 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
264 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
265 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
266 |
instance tt1 and tt2 and tt3 and tt4 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
267 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
268 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
269 |
instance d1 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
270 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
271 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
272 |
instance d1' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
273 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
274 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
275 |
instance d2 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
276 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
277 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
278 |
instance d2' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
279 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
280 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
281 |
instance d3 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
282 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
283 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
284 |
instance d3' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
285 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
286 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
287 |
instance d3'' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
288 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
289 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
290 |
instance d3''' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
291 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
292 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
293 |
instance d4 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
294 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
295 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
296 |
instance d4' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
297 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
298 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
299 |
instance d4'' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
300 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
301 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
302 |
instance d4''' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
303 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
304 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
305 |
instance d5 :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
306 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
307 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
308 |
instance d5' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
309 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
310 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
311 |
instance d5'' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
312 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
313 |
|
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
314 |
instance d5''' :: countable |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
315 |
by countable_datatype |
c1e32fe387f4
added tests for new 'countable_datatype' proof method
blanchet
parents:
58139
diff
changeset
|
316 |
|
57795 | 317 |
datatype_compat simple |
318 |
datatype_compat simple' |
|
319 |
datatype_compat simple'' |
|
320 |
datatype_compat mylist |
|
321 |
datatype_compat some_passive |
|
322 |
datatype_compat tree' branch |
|
323 |
datatype_compat bin_rose_tree |
|
324 |
datatype_compat exp trm factor |
|
325 |
datatype_compat ftree |
|
326 |
datatype_compat nofail1 |
|
327 |
datatype_compat kk1 kk2 kk3 |
|
328 |
datatype_compat t1 t2 t3 |
|
329 |
datatype_compat t1' t2' t3' |
|
330 |
datatype_compat k1 k2 k3 k4 |
|
331 |
datatype_compat tt1 tt2 tt3 tt4 |
|
332 |
datatype_compat deadbar |
|
333 |
datatype_compat deadbar_option |
|
334 |
datatype_compat bar |
|
335 |
datatype_compat foo |
|
336 |
datatype_compat deadfoo |
|
337 |
datatype_compat dead_foo |
|
338 |
datatype_compat use_dead_foo |
|
339 |
datatype_compat d1 |
|
340 |
datatype_compat d1' |
|
341 |
datatype_compat d2 |
|
342 |
datatype_compat d2' |
|
343 |
datatype_compat d3 |
|
344 |
datatype_compat d3' |
|
345 |
datatype_compat d3'' |
|
346 |
datatype_compat d3''' |
|
347 |
datatype_compat d4 |
|
348 |
datatype_compat d4' |
|
349 |
datatype_compat d4'' |
|
350 |
datatype_compat d4''' |
|
351 |
datatype_compat d5 |
|
352 |
datatype_compat d5' |
|
353 |
datatype_compat d5'' |
|
354 |
datatype_compat d5''' |
|
355 |
||
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
356 |
end |