author | wenzelm |
Fri, 20 Jul 2001 22:00:06 +0200 | |
changeset 11436 | 3f74b80d979f |
parent 11325 | a5e0289dd56c |
child 11439 | 9aaab1a160a5 |
permissions | -rw-r--r-- |
7700 | 1 |
(* Title: HOL/Inductive.thy |
2 |
ID: $Id$ |
|
10402 | 3 |
Author: Markus Wenzel, TU Muenchen |
10727 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
5 |
||
6 |
Setup packages for inductive sets and types etc. |
|
7700 | 7 |
*) |
1187 | 8 |
|
11325
a5e0289dd56c
Inductive definitions are now introduced earlier in the theory hierarchy.
berghofe
parents:
11003
diff
changeset
|
9 |
theory Inductive = Gfp + Sum_Type + Relation |
7700 | 10 |
files |
10402 | 11 |
("Tools/induct_method.ML") |
12 |
("Tools/inductive_package.ML") |
|
13 |
("Tools/datatype_aux.ML") |
|
14 |
("Tools/datatype_prop.ML") |
|
15 |
("Tools/datatype_rep_proofs.ML") |
|
16 |
("Tools/datatype_abs_proofs.ML") |
|
17 |
("Tools/datatype_package.ML") |
|
18 |
("Tools/primrec_package.ML"): |
|
19 |
||
10727 | 20 |
|
21 |
(* handling of proper rules *) |
|
22 |
||
10402 | 23 |
constdefs |
24 |
forall :: "('a => bool) => bool" |
|
25 |
"forall P == \<forall>x. P x" |
|
26 |
implies :: "bool => bool => bool" |
|
27 |
"implies A B == A --> B" |
|
10434 | 28 |
equal :: "'a => 'a => bool" |
29 |
"equal x y == x = y" |
|
10727 | 30 |
conj :: "bool => bool => bool" |
31 |
"conj A B == A & B" |
|
10402 | 32 |
|
33 |
lemma forall_eq: "(!!x. P x) == Trueprop (forall (\<lambda>x. P x))" |
|
10434 | 34 |
by (simp only: atomize_all forall_def) |
6437 | 35 |
|
10402 | 36 |
lemma implies_eq: "(A ==> B) == Trueprop (implies A B)" |
10434 | 37 |
by (simp only: atomize_imp implies_def) |
38 |
||
39 |
lemma equal_eq: "(x == y) == Trueprop (equal x y)" |
|
40 |
by (simp only: atomize_eq equal_def) |
|
10402 | 41 |
|
10727 | 42 |
lemma forall_conj: "forall (\<lambda>x. conj (A x) (B x)) = conj (forall A) (forall B)" |
43 |
by (unfold forall_def conj_def) blast |
|
44 |
||
45 |
lemma implies_conj: "implies C (conj A B) = conj (implies C A) (implies C B)" |
|
46 |
by (unfold implies_def conj_def) blast |
|
47 |
||
48 |
lemma conj_curry: "(conj A B ==> C) == (A ==> B ==> C)" |
|
49 |
by (simp only: atomize_imp atomize_eq conj_def) (rule equal_intr_rule, blast+) |
|
10434 | 50 |
|
51 |
lemmas inductive_atomize = forall_eq implies_eq equal_eq |
|
52 |
lemmas inductive_rulify1 = inductive_atomize [symmetric, standard] |
|
10727 | 53 |
lemmas inductive_rulify2 = forall_def implies_def equal_def conj_def |
54 |
lemmas inductive_conj = forall_conj implies_conj conj_curry |
|
55 |
||
56 |
hide const forall implies equal conj |
|
57 |
||
58 |
||
11436 | 59 |
(* inversion of injective functions *) |
60 |
||
61 |
constdefs |
|
62 |
myinv :: "('a => 'b) => ('b => 'a)" |
|
63 |
"myinv (f :: 'a => 'b) == \<lambda>y. THE x. f x = y" |
|
64 |
||
65 |
lemma myinv_f_f: "inj f ==> myinv f (f x) = x" |
|
66 |
proof - |
|
67 |
assume "inj f" |
|
68 |
hence "(THE x'. f x' = f x) = (THE x'. x' = x)" |
|
69 |
by (simp only: inj_eq) |
|
70 |
also have "... = x" by (rule the_eq_trivial) |
|
71 |
finally (trans) show ?thesis by (unfold myinv_def) |
|
72 |
qed |
|
73 |
||
74 |
lemma f_myinv_f: "inj f ==> y \<in> range f ==> f (myinv f y) = y" |
|
75 |
proof (unfold myinv_def) |
|
76 |
assume inj: "inj f" |
|
77 |
assume "y \<in> range f" |
|
78 |
then obtain x where "y = f x" .. |
|
79 |
hence x: "f x = y" .. |
|
80 |
thus "f (THE x. f x = y) = y" |
|
81 |
proof (rule theI) |
|
82 |
fix x' assume "f x' = y" |
|
83 |
with x have "f x' = f x" by simp |
|
84 |
with inj show "x' = x" by (rule injD) |
|
85 |
qed |
|
86 |
qed |
|
87 |
||
88 |
hide const myinv |
|
89 |
||
90 |
||
10727 | 91 |
(* setup packages *) |
10402 | 92 |
|
93 |
use "Tools/induct_method.ML" |
|
8303 | 94 |
setup InductMethod.setup |
10402 | 95 |
|
96 |
use "Tools/inductive_package.ML" |
|
6437 | 97 |
setup InductivePackage.setup |
10402 | 98 |
|
99 |
use "Tools/datatype_aux.ML" |
|
100 |
use "Tools/datatype_prop.ML" |
|
101 |
use "Tools/datatype_rep_proofs.ML" |
|
102 |
use "Tools/datatype_abs_proofs.ML" |
|
103 |
use "Tools/datatype_package.ML" |
|
7700 | 104 |
setup DatatypePackage.setup |
10402 | 105 |
|
106 |
use "Tools/primrec_package.ML" |
|
8482 | 107 |
setup PrimrecPackage.setup |
7700 | 108 |
|
10312 | 109 |
theorems basic_monos [mono] = |
11003 | 110 |
subset_refl imp_refl disj_mono conj_mono ex_mono all_mono if_def2 |
10727 | 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 |
||
6437 | 117 |
end |