author | wenzelm |
Thu, 07 Jul 2011 23:55:15 +0200 | |
changeset 44572 | 91c4d7397f0e |
parent 38739 | bd9c4e8281ec |
child 47692 | ff6b0c1087f2 |
permissions | -rw-r--r-- |
wenzelm@26189 | 1 |
(* Title: ZF/Inductive_ZF.thy |
krauss@26056 | 2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
krauss@26056 | 3 |
Copyright 1993 University of Cambridge |
krauss@26056 | 4 |
|
krauss@26056 | 5 |
Inductive definitions use least fixedpoints with standard products and sums |
krauss@26056 | 6 |
Coinductive definitions use greatest fixedpoints with Quine products and sums |
krauss@26056 | 7 |
|
krauss@26056 | 8 |
Sums are used only for mutual recursion; |
krauss@26056 | 9 |
Products are used only to derive "streamlined" induction rules for relations |
krauss@26056 | 10 |
*) |
krauss@26056 | 11 |
|
krauss@26056 | 12 |
header{*Inductive and Coinductive Definitions*} |
krauss@26056 | 13 |
|
wenzelm@26189 | 14 |
theory Inductive_ZF |
wenzelm@26189 | 15 |
imports Fixedpt QPair Nat_ZF |
wenzelm@26189 | 16 |
uses |
wenzelm@26189 | 17 |
("ind_syntax.ML") |
wenzelm@26189 | 18 |
("Tools/cartprod.ML") |
wenzelm@26189 | 19 |
("Tools/ind_cases.ML") |
wenzelm@26189 | 20 |
("Tools/inductive_package.ML") |
wenzelm@26189 | 21 |
("Tools/induct_tacs.ML") |
wenzelm@26189 | 22 |
("Tools/primrec_package.ML") |
wenzelm@26189 | 23 |
begin |
wenzelm@26189 | 24 |
|
wenzelm@26189 | 25 |
lemma def_swap_iff: "a == b ==> a = c <-> c = b" |
wenzelm@26189 | 26 |
by blast |
wenzelm@26189 | 27 |
|
wenzelm@26189 | 28 |
lemma def_trans: "f == g ==> g(a) = b ==> f(a) = b" |
wenzelm@26189 | 29 |
by simp |
wenzelm@26189 | 30 |
|
wenzelm@26189 | 31 |
lemma refl_thin: "!!P. a = a ==> P ==> P" . |
wenzelm@26189 | 32 |
|
wenzelm@26189 | 33 |
use "ind_syntax.ML" |
haftmann@38739 | 34 |
use "Tools/ind_cases.ML" |
wenzelm@26189 | 35 |
use "Tools/cartprod.ML" |
wenzelm@26189 | 36 |
use "Tools/inductive_package.ML" |
wenzelm@26189 | 37 |
use "Tools/induct_tacs.ML" |
wenzelm@26189 | 38 |
use "Tools/primrec_package.ML" |
krauss@26056 | 39 |
|
krauss@26056 | 40 |
setup IndCases.setup |
krauss@26056 | 41 |
setup DatatypeTactics.setup |
krauss@26056 | 42 |
|
wenzelm@26480 | 43 |
ML {* |
krauss@26056 | 44 |
structure Lfp = |
krauss@26056 | 45 |
struct |
wenzelm@26189 | 46 |
val oper = @{const lfp} |
wenzelm@26189 | 47 |
val bnd_mono = @{const bnd_mono} |
krauss@26056 | 48 |
val bnd_monoI = @{thm bnd_monoI} |
krauss@26056 | 49 |
val subs = @{thm def_lfp_subset} |
krauss@26056 | 50 |
val Tarski = @{thm def_lfp_unfold} |
krauss@26056 | 51 |
val induct = @{thm def_induct} |
krauss@26056 | 52 |
end; |
krauss@26056 | 53 |
|
krauss@26056 | 54 |
structure Standard_Prod = |
krauss@26056 | 55 |
struct |
wenzelm@26189 | 56 |
val sigma = @{const Sigma} |
wenzelm@26189 | 57 |
val pair = @{const Pair} |
wenzelm@26189 | 58 |
val split_name = @{const_name split} |
krauss@26056 | 59 |
val pair_iff = @{thm Pair_iff} |
krauss@26056 | 60 |
val split_eq = @{thm split} |
krauss@26056 | 61 |
val fsplitI = @{thm splitI} |
krauss@26056 | 62 |
val fsplitD = @{thm splitD} |
krauss@26056 | 63 |
val fsplitE = @{thm splitE} |
krauss@26056 | 64 |
end; |
krauss@26056 | 65 |
|
krauss@26056 | 66 |
structure Standard_CP = CartProd_Fun (Standard_Prod); |
krauss@26056 | 67 |
|
krauss@26056 | 68 |
structure Standard_Sum = |
krauss@26056 | 69 |
struct |
wenzelm@26189 | 70 |
val sum = @{const sum} |
wenzelm@26189 | 71 |
val inl = @{const Inl} |
wenzelm@26189 | 72 |
val inr = @{const Inr} |
wenzelm@26189 | 73 |
val elim = @{const case} |
krauss@26056 | 74 |
val case_inl = @{thm case_Inl} |
krauss@26056 | 75 |
val case_inr = @{thm case_Inr} |
krauss@26056 | 76 |
val inl_iff = @{thm Inl_iff} |
krauss@26056 | 77 |
val inr_iff = @{thm Inr_iff} |
krauss@26056 | 78 |
val distinct = @{thm Inl_Inr_iff} |
krauss@26056 | 79 |
val distinct' = @{thm Inr_Inl_iff} |
krauss@26056 | 80 |
val free_SEs = Ind_Syntax.mk_free_SEs |
krauss@26056 | 81 |
[distinct, distinct', inl_iff, inr_iff, Standard_Prod.pair_iff] |
krauss@26056 | 82 |
end; |
krauss@26056 | 83 |
|
krauss@26056 | 84 |
|
krauss@26056 | 85 |
structure Ind_Package = |
krauss@26056 | 86 |
Add_inductive_def_Fun |
krauss@26056 | 87 |
(structure Fp=Lfp and Pr=Standard_Prod and CP=Standard_CP |
krauss@26056 | 88 |
and Su=Standard_Sum val coind = false); |
krauss@26056 | 89 |
|
krauss@26056 | 90 |
|
krauss@26056 | 91 |
structure Gfp = |
krauss@26056 | 92 |
struct |
wenzelm@26189 | 93 |
val oper = @{const gfp} |
wenzelm@26189 | 94 |
val bnd_mono = @{const bnd_mono} |
krauss@26056 | 95 |
val bnd_monoI = @{thm bnd_monoI} |
krauss@26056 | 96 |
val subs = @{thm def_gfp_subset} |
krauss@26056 | 97 |
val Tarski = @{thm def_gfp_unfold} |
krauss@26056 | 98 |
val induct = @{thm def_Collect_coinduct} |
krauss@26056 | 99 |
end; |
krauss@26056 | 100 |
|
krauss@26056 | 101 |
structure Quine_Prod = |
krauss@26056 | 102 |
struct |
wenzelm@26189 | 103 |
val sigma = @{const QSigma} |
wenzelm@26189 | 104 |
val pair = @{const QPair} |
wenzelm@26189 | 105 |
val split_name = @{const_name qsplit} |
krauss@26056 | 106 |
val pair_iff = @{thm QPair_iff} |
krauss@26056 | 107 |
val split_eq = @{thm qsplit} |
krauss@26056 | 108 |
val fsplitI = @{thm qsplitI} |
krauss@26056 | 109 |
val fsplitD = @{thm qsplitD} |
krauss@26056 | 110 |
val fsplitE = @{thm qsplitE} |
krauss@26056 | 111 |
end; |
krauss@26056 | 112 |
|
krauss@26056 | 113 |
structure Quine_CP = CartProd_Fun (Quine_Prod); |
krauss@26056 | 114 |
|
krauss@26056 | 115 |
structure Quine_Sum = |
krauss@26056 | 116 |
struct |
wenzelm@26189 | 117 |
val sum = @{const qsum} |
wenzelm@26189 | 118 |
val inl = @{const QInl} |
wenzelm@26189 | 119 |
val inr = @{const QInr} |
wenzelm@26189 | 120 |
val elim = @{const qcase} |
krauss@26056 | 121 |
val case_inl = @{thm qcase_QInl} |
krauss@26056 | 122 |
val case_inr = @{thm qcase_QInr} |
krauss@26056 | 123 |
val inl_iff = @{thm QInl_iff} |
krauss@26056 | 124 |
val inr_iff = @{thm QInr_iff} |
krauss@26056 | 125 |
val distinct = @{thm QInl_QInr_iff} |
krauss@26056 | 126 |
val distinct' = @{thm QInr_QInl_iff} |
krauss@26056 | 127 |
val free_SEs = Ind_Syntax.mk_free_SEs |
krauss@26056 | 128 |
[distinct, distinct', inl_iff, inr_iff, Quine_Prod.pair_iff] |
krauss@26056 | 129 |
end; |
krauss@26056 | 130 |
|
krauss@26056 | 131 |
|
krauss@26056 | 132 |
structure CoInd_Package = |
krauss@26056 | 133 |
Add_inductive_def_Fun(structure Fp=Gfp and Pr=Quine_Prod and CP=Quine_CP |
krauss@26056 | 134 |
and Su=Quine_Sum val coind = true); |
krauss@26056 | 135 |
|
krauss@26056 | 136 |
*} |
krauss@26056 | 137 |
|
krauss@26056 | 138 |
end |