1 (* Title: HOL/Inductive.thy |
1 (* Title: HOL/Inductive.thy |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Markus Wenzel, TU Muenchen |
3 Author: Markus Wenzel, TU Muenchen |
4 License: GPL (GNU GENERAL PUBLIC LICENSE) |
4 License: GPL (GNU GENERAL PUBLIC LICENSE) |
|
5 *) |
5 |
6 |
6 Setup packages for inductive sets and types etc. |
7 header {* Support for inductive sets and types *} |
7 *) |
|
8 |
8 |
9 theory Inductive = Gfp + Sum_Type + Relation |
9 theory Inductive = Gfp + Sum_Type + Relation |
10 files |
10 files |
11 ("Tools/induct_method.ML") |
|
12 ("Tools/inductive_package.ML") |
11 ("Tools/inductive_package.ML") |
13 ("Tools/datatype_aux.ML") |
12 ("Tools/datatype_aux.ML") |
14 ("Tools/datatype_prop.ML") |
13 ("Tools/datatype_prop.ML") |
15 ("Tools/datatype_rep_proofs.ML") |
14 ("Tools/datatype_rep_proofs.ML") |
16 ("Tools/datatype_abs_proofs.ML") |
15 ("Tools/datatype_abs_proofs.ML") |
17 ("Tools/datatype_package.ML") |
16 ("Tools/datatype_package.ML") |
18 ("Tools/primrec_package.ML"): |
17 ("Tools/primrec_package.ML"): |
19 |
18 |
20 |
19 |
21 (* handling of proper rules *) |
20 subsection {* Proof by cases and induction *} |
|
21 |
|
22 text {* Proper handling of non-atomic rule statements. *} |
22 |
23 |
23 constdefs |
24 constdefs |
24 forall :: "('a => bool) => bool" |
25 forall :: "('a => bool) => bool" |
25 "forall P == \<forall>x. P x" |
26 "forall P == \<forall>x. P x" |
26 implies :: "bool => bool => bool" |
27 implies :: "bool => bool => bool" |
54 lemmas inductive_conj = forall_conj implies_conj conj_curry |
55 lemmas inductive_conj = forall_conj implies_conj conj_curry |
55 |
56 |
56 hide const forall implies equal conj |
57 hide const forall implies equal conj |
57 |
58 |
58 |
59 |
59 (* inversion of injective functions *) |
60 text {* Method setup. *} |
|
61 |
|
62 ML {* |
|
63 structure InductMethod = InductMethodFun |
|
64 (struct |
|
65 val dest_concls = HOLogic.dest_concls; |
|
66 val cases_default = thm "case_split"; |
|
67 val conjI = thm "conjI"; |
|
68 val atomize = thms "inductive_atomize"; |
|
69 val rulify1 = thms "inductive_rulify1"; |
|
70 val rulify2 = thms "inductive_rulify2"; |
|
71 end); |
|
72 *} |
|
73 |
|
74 setup InductMethod.setup |
|
75 |
|
76 |
|
77 subsection {* Inductive sets *} |
|
78 |
|
79 text {* Inversion of injective functions. *} |
60 |
80 |
61 constdefs |
81 constdefs |
62 myinv :: "('a => 'b) => ('b => 'a)" |
82 myinv :: "('a => 'b) => ('b => 'a)" |
63 "myinv (f :: 'a => 'b) == \<lambda>y. THE x. f x = y" |
83 "myinv (f :: 'a => 'b) == \<lambda>y. THE x. f x = y" |
64 |
84 |
86 qed |
106 qed |
87 |
107 |
88 hide const myinv |
108 hide const myinv |
89 |
109 |
90 |
110 |
91 (* setup packages *) |
111 text {* Package setup. *} |
92 |
|
93 use "Tools/induct_method.ML" |
|
94 setup InductMethod.setup |
|
95 |
112 |
96 use "Tools/inductive_package.ML" |
113 use "Tools/inductive_package.ML" |
97 setup InductivePackage.setup |
114 setup InductivePackage.setup |
|
115 |
|
116 theorems basic_monos [mono] = |
|
117 subset_refl imp_refl disj_mono conj_mono ex_mono all_mono if_def2 |
|
118 Collect_mono in_mono vimage_mono |
|
119 imp_conv_disj not_not de_Morgan_disj de_Morgan_conj |
|
120 not_all not_ex |
|
121 Ball_def Bex_def |
|
122 inductive_rulify2 |
|
123 |
|
124 |
|
125 subsubsection {* Inductive datatypes and primitive recursion *} |
98 |
126 |
99 use "Tools/datatype_aux.ML" |
127 use "Tools/datatype_aux.ML" |
100 use "Tools/datatype_prop.ML" |
128 use "Tools/datatype_prop.ML" |
101 use "Tools/datatype_rep_proofs.ML" |
129 use "Tools/datatype_rep_proofs.ML" |
102 use "Tools/datatype_abs_proofs.ML" |
130 use "Tools/datatype_abs_proofs.ML" |
104 setup DatatypePackage.setup |
132 setup DatatypePackage.setup |
105 |
133 |
106 use "Tools/primrec_package.ML" |
134 use "Tools/primrec_package.ML" |
107 setup PrimrecPackage.setup |
135 setup PrimrecPackage.setup |
108 |
136 |
109 theorems basic_monos [mono] = |
|
110 subset_refl imp_refl disj_mono conj_mono ex_mono all_mono if_def2 |
|
111 Collect_mono in_mono vimage_mono |
|
112 imp_conv_disj not_not de_Morgan_disj de_Morgan_conj |
|
113 not_all not_ex |
|
114 Ball_def Bex_def |
|
115 inductive_rulify2 |
|
116 |
|
117 end |
137 end |