author | paulson |
Fri, 12 Oct 2007 10:24:49 +0200 | |
changeset 24998 | a339b33adfaf |
parent 24893 | b8ef7afe3a6b |
permissions | -rw-r--r-- |
12175 | 1 |
(* Title: ZF/Inductive.thy |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1993 University of Cambridge |
|
5 |
||
22814 | 6 |
Inductive definitions use least fixedpoints with standard products and sums |
7 |
Coinductive definitions use greatest fixedpoints with Quine products and sums |
|
8 |
||
9 |
Sums are used only for mutual recursion; |
|
10 |
Products are used only to derive "streamlined" induction rules for relations |
|
12175 | 11 |
*) |
578
efc648d29dd0
ZF/Inductive.thy,.ML: renamed from "inductive" to allow re-building without
lcp
parents:
diff
changeset
|
12 |
|
13356 | 13 |
header{*Inductive and Coinductive Definitions*} |
14 |
||
16417 | 15 |
theory Inductive imports Fixedpt QPair |
16 |
uses |
|
12183 | 17 |
"ind_syntax.ML" |
12175 | 18 |
"Tools/cartprod.ML" |
19 |
"Tools/ind_cases.ML" |
|
20 |
"Tools/inductive_package.ML" |
|
21 |
"Tools/induct_tacs.ML" |
|
16417 | 22 |
"Tools/primrec_package.ML" begin |
12175 | 23 |
|
24 |
setup IndCases.setup |
|
12208 | 25 |
setup DatatypeTactics.setup |
2870
6d6fd10a9fdc
Now a non-trivial theory so that require_thy can find it
paulson
parents:
805
diff
changeset
|
26 |
|
22814 | 27 |
ML_setup {* |
28 |
val iT = Ind_Syntax.iT |
|
29 |
and oT = FOLogic.oT; |
|
30 |
||
31 |
structure Lfp = |
|
32 |
struct |
|
33 |
val oper = Const("Fixedpt.lfp", [iT,iT-->iT]--->iT) |
|
34 |
val bnd_mono = Const("Fixedpt.bnd_mono", [iT,iT-->iT]--->oT) |
|
24893 | 35 |
val bnd_monoI = @{thm bnd_monoI} |
36 |
val subs = @{thm def_lfp_subset} |
|
37 |
val Tarski = @{thm def_lfp_unfold} |
|
38 |
val induct = @{thm def_induct} |
|
22814 | 39 |
end; |
40 |
||
41 |
structure Standard_Prod = |
|
42 |
struct |
|
43 |
val sigma = Const("Sigma", [iT, iT-->iT]--->iT) |
|
44 |
val pair = Const("Pair", [iT,iT]--->iT) |
|
45 |
val split_name = "split" |
|
24893 | 46 |
val pair_iff = @{thm Pair_iff} |
47 |
val split_eq = @{thm split} |
|
48 |
val fsplitI = @{thm splitI} |
|
49 |
val fsplitD = @{thm splitD} |
|
50 |
val fsplitE = @{thm splitE} |
|
22814 | 51 |
end; |
52 |
||
53 |
structure Standard_CP = CartProd_Fun (Standard_Prod); |
|
54 |
||
55 |
structure Standard_Sum = |
|
56 |
struct |
|
24826 | 57 |
val sum = Const(@{const_name sum}, [iT,iT]--->iT) |
22814 | 58 |
val inl = Const("Inl", iT-->iT) |
59 |
val inr = Const("Inr", iT-->iT) |
|
60 |
val elim = Const("case", [iT-->iT, iT-->iT, iT]--->iT) |
|
24893 | 61 |
val case_inl = @{thm case_Inl} |
62 |
val case_inr = @{thm case_Inr} |
|
63 |
val inl_iff = @{thm Inl_iff} |
|
64 |
val inr_iff = @{thm Inr_iff} |
|
65 |
val distinct = @{thm Inl_Inr_iff} |
|
66 |
val distinct' = @{thm Inr_Inl_iff} |
|
22814 | 67 |
val free_SEs = Ind_Syntax.mk_free_SEs |
68 |
[distinct, distinct', inl_iff, inr_iff, Standard_Prod.pair_iff] |
|
69 |
end; |
|
70 |
||
71 |
||
72 |
structure Ind_Package = |
|
73 |
Add_inductive_def_Fun |
|
74 |
(structure Fp=Lfp and Pr=Standard_Prod and CP=Standard_CP |
|
75 |
and Su=Standard_Sum val coind = false); |
|
76 |
||
77 |
||
78 |
structure Gfp = |
|
79 |
struct |
|
80 |
val oper = Const("Fixedpt.gfp", [iT,iT-->iT]--->iT) |
|
81 |
val bnd_mono = Const("Fixedpt.bnd_mono", [iT,iT-->iT]--->oT) |
|
24893 | 82 |
val bnd_monoI = @{thm bnd_monoI} |
83 |
val subs = @{thm def_gfp_subset} |
|
84 |
val Tarski = @{thm def_gfp_unfold} |
|
85 |
val induct = @{thm def_Collect_coinduct} |
|
22814 | 86 |
end; |
87 |
||
88 |
structure Quine_Prod = |
|
89 |
struct |
|
90 |
val sigma = Const("QPair.QSigma", [iT, iT-->iT]--->iT) |
|
91 |
val pair = Const("QPair.QPair", [iT,iT]--->iT) |
|
92 |
val split_name = "QPair.qsplit" |
|
24893 | 93 |
val pair_iff = @{thm QPair_iff} |
94 |
val split_eq = @{thm qsplit} |
|
95 |
val fsplitI = @{thm qsplitI} |
|
96 |
val fsplitD = @{thm qsplitD} |
|
97 |
val fsplitE = @{thm qsplitE} |
|
22814 | 98 |
end; |
99 |
||
100 |
structure Quine_CP = CartProd_Fun (Quine_Prod); |
|
101 |
||
102 |
structure Quine_Sum = |
|
103 |
struct |
|
104 |
val sum = Const("QPair.op <+>", [iT,iT]--->iT) |
|
105 |
val inl = Const("QPair.QInl", iT-->iT) |
|
106 |
val inr = Const("QPair.QInr", iT-->iT) |
|
107 |
val elim = Const("QPair.qcase", [iT-->iT, iT-->iT, iT]--->iT) |
|
24893 | 108 |
val case_inl = @{thm qcase_QInl} |
109 |
val case_inr = @{thm qcase_QInr} |
|
110 |
val inl_iff = @{thm QInl_iff} |
|
111 |
val inr_iff = @{thm QInr_iff} |
|
112 |
val distinct = @{thm QInl_QInr_iff} |
|
113 |
val distinct' = @{thm QInr_QInl_iff} |
|
22814 | 114 |
val free_SEs = Ind_Syntax.mk_free_SEs |
115 |
[distinct, distinct', inl_iff, inr_iff, Quine_Prod.pair_iff] |
|
116 |
end; |
|
117 |
||
118 |
||
119 |
structure CoInd_Package = |
|
120 |
Add_inductive_def_Fun(structure Fp=Gfp and Pr=Quine_Prod and CP=Quine_CP |
|
121 |
and Su=Quine_Sum val coind = true); |
|
122 |
||
123 |
*} |
|
124 |
||
2870
6d6fd10a9fdc
Now a non-trivial theory so that require_thy can find it
paulson
parents:
805
diff
changeset
|
125 |
end |