| author | wenzelm | 
| Sun, 11 Sep 2022 23:37:05 +0200 | |
| changeset 76117 | 531248fd8952 | 
| parent 69597 | ff784d5a5bfb | 
| child 80914 | d97fdabd9e2b | 
| permissions | -rw-r--r-- | 
| 42151 | 1  | 
(* Title: HOL/HOLCF/Fix.thy  | 
| 1479 | 2  | 
Author: Franz Regensburger  | 
| 35794 | 3  | 
Author: Brian Huffman  | 
| 
243
 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 
nipkow 
parents:  
diff
changeset
 | 
4  | 
*)  | 
| 
 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 
nipkow 
parents:  
diff
changeset
 | 
5  | 
|
| 62175 | 6  | 
section \<open>Fixed point operator and admissibility\<close>  | 
| 15577 | 7  | 
|
8  | 
theory Fix  | 
|
| 67312 | 9  | 
imports Cfun  | 
| 15577 | 10  | 
begin  | 
| 
243
 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 
nipkow 
parents:  
diff
changeset
 | 
11  | 
|
| 36452 | 12  | 
default_sort pcpo  | 
| 16082 | 13  | 
|
| 67312 | 14  | 
|
| 62175 | 15  | 
subsection \<open>Iteration\<close>  | 
| 16005 | 16  | 
|
| 67312 | 17  | 
primrec iterate :: "nat \<Rightarrow> ('a::cpo \<rightarrow> 'a) \<rightarrow> ('a \<rightarrow> 'a)"
 | 
18  | 
where  | 
|
| 34941 | 19  | 
"iterate 0 = (\<Lambda> F x. x)"  | 
20  | 
| "iterate (Suc n) = (\<Lambda> F x. F\<cdot>(iterate n\<cdot>F\<cdot>x))"  | 
|
| 5192 | 21  | 
|
| 62175 | 22  | 
text \<open>Derive inductive properties of iterate from primitive recursion\<close>  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
23  | 
|
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
24  | 
lemma iterate_0 [simp]: "iterate 0\<cdot>F\<cdot>x = x"  | 
| 67312 | 25  | 
by simp  | 
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
26  | 
|
| 
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
27  | 
lemma iterate_Suc [simp]: "iterate (Suc n)\<cdot>F\<cdot>x = F\<cdot>(iterate n\<cdot>F\<cdot>x)"  | 
| 67312 | 28  | 
by simp  | 
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
29  | 
|
| 
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
30  | 
declare iterate.simps [simp del]  | 
| 
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
31  | 
|
| 
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
32  | 
lemma iterate_Suc2: "iterate (Suc n)\<cdot>F\<cdot>x = iterate n\<cdot>F\<cdot>(F\<cdot>x)"  | 
| 67312 | 33  | 
by (induct n) simp_all  | 
| 27270 | 34  | 
|
| 67312 | 35  | 
lemma iterate_iterate: "iterate m\<cdot>F\<cdot>(iterate n\<cdot>F\<cdot>x) = iterate (m + n)\<cdot>F\<cdot>x"  | 
36  | 
by (induct m) simp_all  | 
|
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
37  | 
|
| 62175 | 38  | 
text \<open>The sequence of function iterations is a chain.\<close>  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
39  | 
|
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
40  | 
lemma chain_iterate [simp]: "chain (\<lambda>i. iterate i\<cdot>F\<cdot>\<bottom>)"  | 
| 67312 | 41  | 
by (rule chainI, unfold iterate_Suc2, rule monofun_cfun_arg, rule minimal)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
42  | 
|
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
43  | 
|
| 62175 | 44  | 
subsection \<open>Least fixed point operator\<close>  | 
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
45  | 
|
| 67312 | 46  | 
definition "fix" :: "('a \<rightarrow> 'a) \<rightarrow> 'a"
 | 
47  | 
where "fix = (\<Lambda> F. \<Squnion>i. iterate i\<cdot>F\<cdot>\<bottom>)"  | 
|
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
48  | 
|
| 69597 | 49  | 
text \<open>Binder syntax for \<^term>\<open>fix\<close>\<close>  | 
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
50  | 
|
| 67312 | 51  | 
abbreviation fix_syn :: "('a \<Rightarrow> 'a) \<Rightarrow> 'a"  (binder "\<mu> " 10)
 | 
52  | 
where "fix_syn (\<lambda>x. f x) \<equiv> fix\<cdot>(\<Lambda> x. f x)"  | 
|
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
53  | 
|
| 61998 | 54  | 
notation (ASCII)  | 
55  | 
fix_syn (binder "FIX " 10)  | 
|
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
56  | 
|
| 69597 | 57  | 
text \<open>Properties of \<^term>\<open>fix\<close>\<close>  | 
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
58  | 
|
| 69597 | 59  | 
text \<open>direct connection between \<^term>\<open>fix\<close> and iteration\<close>  | 
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
60  | 
|
| 
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
61  | 
lemma fix_def2: "fix\<cdot>F = (\<Squnion>i. iterate i\<cdot>F\<cdot>\<bottom>)"  | 
| 67312 | 62  | 
by (simp add: fix_def)  | 
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
63  | 
|
| 35055 | 64  | 
lemma iterate_below_fix: "iterate n\<cdot>f\<cdot>\<bottom> \<sqsubseteq> fix\<cdot>f"  | 
65  | 
unfolding fix_def2  | 
|
66  | 
using chain_iterate by (rule is_ub_thelub)  | 
|
67  | 
||
| 62175 | 68  | 
text \<open>  | 
| 
15637
 
d2a06007ebfa
changed comments to text blocks, cleaned up a few proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
69  | 
Kleene's fixed point theorems for continuous functions in pointed  | 
| 
 
d2a06007ebfa
changed comments to text blocks, cleaned up a few proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
70  | 
omega cpo's  | 
| 62175 | 71  | 
\<close>  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
72  | 
|
| 
18074
 
a92b7c5133de
reorganized; removed intermediate constant Ifix; changed iterate to a continuous type; added theorem fix_least_less
 
huffman 
parents: 
17816 
diff
changeset
 | 
73  | 
lemma fix_eq: "fix\<cdot>F = F\<cdot>(fix\<cdot>F)"  | 
| 67312 | 74  | 
apply (simp add: fix_def2)  | 
75  | 
apply (subst lub_range_shift [of _ 1, symmetric])  | 
|
76  | 
apply (rule chain_iterate)  | 
|
77  | 
apply (subst contlub_cfun_arg)  | 
|
78  | 
apply (rule chain_iterate)  | 
|
79  | 
apply simp  | 
|
80  | 
done  | 
|
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
81  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29138 
diff
changeset
 | 
82  | 
lemma fix_least_below: "F\<cdot>x \<sqsubseteq> x \<Longrightarrow> fix\<cdot>F \<sqsubseteq> x"  | 
| 67312 | 83  | 
apply (simp add: fix_def2)  | 
84  | 
apply (rule lub_below)  | 
|
85  | 
apply (rule chain_iterate)  | 
|
86  | 
apply (induct_tac i)  | 
|
87  | 
apply simp  | 
|
88  | 
apply simp  | 
|
89  | 
apply (erule rev_below_trans)  | 
|
90  | 
apply (erule monofun_cfun_arg)  | 
|
91  | 
done  | 
|
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
92  | 
|
| 16214 | 93  | 
lemma fix_least: "F\<cdot>x = x \<Longrightarrow> fix\<cdot>F \<sqsubseteq> x"  | 
| 67312 | 94  | 
by (rule fix_least_below) simp  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
95  | 
|
| 
27185
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
96  | 
lemma fix_eqI:  | 
| 67312 | 97  | 
assumes fixed: "F\<cdot>x = x"  | 
98  | 
and least: "\<And>z. F\<cdot>z = z \<Longrightarrow> x \<sqsubseteq> z"  | 
|
| 
27185
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
99  | 
shows "fix\<cdot>F = x"  | 
| 67312 | 100  | 
apply (rule below_antisym)  | 
101  | 
apply (rule fix_least [OF fixed])  | 
|
102  | 
apply (rule least [OF fix_eq [symmetric]])  | 
|
103  | 
done  | 
|
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
104  | 
|
| 16214 | 105  | 
lemma fix_eq2: "f \<equiv> fix\<cdot>F \<Longrightarrow> f = F\<cdot>f"  | 
| 67312 | 106  | 
by (simp add: fix_eq [symmetric])  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
107  | 
|
| 16214 | 108  | 
lemma fix_eq3: "f \<equiv> fix\<cdot>F \<Longrightarrow> f\<cdot>x = F\<cdot>f\<cdot>x"  | 
| 67312 | 109  | 
by (erule fix_eq2 [THEN cfun_fun_cong])  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
110  | 
|
| 16214 | 111  | 
lemma fix_eq4: "f = fix\<cdot>F \<Longrightarrow> f = F\<cdot>f"  | 
| 67312 | 112  | 
by (erule ssubst) (rule fix_eq)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
113  | 
|
| 16214 | 114  | 
lemma fix_eq5: "f = fix\<cdot>F \<Longrightarrow> f\<cdot>x = F\<cdot>f\<cdot>x"  | 
| 67312 | 115  | 
by (erule fix_eq4 [THEN cfun_fun_cong])  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents: 
14981 
diff
changeset
 | 
116  | 
|
| 69597 | 117  | 
text \<open>strictness of \<^term>\<open>fix\<close>\<close>  | 
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
118  | 
|
| 67312 | 119  | 
lemma fix_bottom_iff: "fix\<cdot>F = \<bottom> \<longleftrightarrow> F\<cdot>\<bottom> = \<bottom>"  | 
120  | 
apply (rule iffI)  | 
|
121  | 
apply (erule subst)  | 
|
122  | 
apply (rule fix_eq [symmetric])  | 
|
123  | 
apply (erule fix_least [THEN bottomI])  | 
|
124  | 
done  | 
|
| 16917 | 125  | 
|
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
126  | 
lemma fix_strict: "F\<cdot>\<bottom> = \<bottom> \<Longrightarrow> fix\<cdot>F = \<bottom>"  | 
| 67312 | 127  | 
by (simp add: fix_bottom_iff)  | 
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
128  | 
|
| 
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
129  | 
lemma fix_defined: "F\<cdot>\<bottom> \<noteq> \<bottom> \<Longrightarrow> fix\<cdot>F \<noteq> \<bottom>"  | 
| 67312 | 130  | 
by (simp add: fix_bottom_iff)  | 
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
131  | 
|
| 69597 | 132  | 
text \<open>\<^term>\<open>fix\<close> applied to identity and constant functions\<close>  | 
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
133  | 
|
| 
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
134  | 
lemma fix_id: "(\<mu> x. x) = \<bottom>"  | 
| 67312 | 135  | 
by (simp add: fix_strict)  | 
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
136  | 
|
| 
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
137  | 
lemma fix_const: "(\<mu> x. c) = c"  | 
| 67312 | 138  | 
by (subst fix_eq) simp  | 
139  | 
||
| 
16556
 
a0c8d0499b5f
added theorems fix_strict, fix_defined, fix_id, fix_const
 
huffman 
parents: 
16388 
diff
changeset
 | 
140  | 
|
| 62175 | 141  | 
subsection \<open>Fixed point induction\<close>  | 
| 
18090
 
9d5cfd71f510
moved adm_chfindom from Fix.thy to Cfun.thy; moved admw-related stuff to its own section
 
huffman 
parents: 
18078 
diff
changeset
 | 
142  | 
|
| 67312 | 143  | 
lemma fix_ind: "adm P \<Longrightarrow> P \<bottom> \<Longrightarrow> (\<And>x. P x \<Longrightarrow> P (F\<cdot>x)) \<Longrightarrow> P (fix\<cdot>F)"  | 
144  | 
unfolding fix_def2  | 
|
145  | 
apply (erule admD)  | 
|
146  | 
apply (rule chain_iterate)  | 
|
147  | 
apply (rule nat_induct, simp_all)  | 
|
148  | 
done  | 
|
| 
18090
 
9d5cfd71f510
moved adm_chfindom from Fix.thy to Cfun.thy; moved admw-related stuff to its own section
 
huffman 
parents: 
18078 
diff
changeset
 | 
149  | 
|
| 67312 | 150  | 
lemma cont_fix_ind: "cont F \<Longrightarrow> adm P \<Longrightarrow> P \<bottom> \<Longrightarrow> (\<And>x. P x \<Longrightarrow> P (F x)) \<Longrightarrow> P (fix\<cdot>(Abs_cfun F))"  | 
151  | 
by (simp add: fix_ind)  | 
|
| 
41324
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
152  | 
|
| 67312 | 153  | 
lemma def_fix_ind: "\<lbrakk>f \<equiv> fix\<cdot>F; adm P; P \<bottom>; \<And>x. P x \<Longrightarrow> P (F\<cdot>x)\<rbrakk> \<Longrightarrow> P f"  | 
154  | 
by (simp add: fix_ind)  | 
|
| 
18090
 
9d5cfd71f510
moved adm_chfindom from Fix.thy to Cfun.thy; moved admw-related stuff to its own section
 
huffman 
parents: 
18078 
diff
changeset
 | 
155  | 
|
| 
27185
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
156  | 
lemma fix_ind2:  | 
| 
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
157  | 
assumes adm: "adm P"  | 
| 
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
158  | 
assumes 0: "P \<bottom>" and 1: "P (F\<cdot>\<bottom>)"  | 
| 
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
159  | 
assumes step: "\<And>x. \<lbrakk>P x; P (F\<cdot>x)\<rbrakk> \<Longrightarrow> P (F\<cdot>(F\<cdot>x))"  | 
| 
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
160  | 
shows "P (fix\<cdot>F)"  | 
| 67312 | 161  | 
unfolding fix_def2  | 
162  | 
apply (rule admD [OF adm chain_iterate])  | 
|
163  | 
apply (rule nat_less_induct)  | 
|
164  | 
apply (case_tac n)  | 
|
165  | 
apply (simp add: 0)  | 
|
166  | 
apply (case_tac nat)  | 
|
167  | 
apply (simp add: 1)  | 
|
168  | 
apply (frule_tac x=nat in spec)  | 
|
169  | 
apply (simp add: step)  | 
|
170  | 
done  | 
|
| 
27185
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
171  | 
|
| 33590 | 172  | 
lemma parallel_fix_ind:  | 
173  | 
assumes adm: "adm (\<lambda>x. P (fst x) (snd x))"  | 
|
174  | 
assumes base: "P \<bottom> \<bottom>"  | 
|
175  | 
assumes step: "\<And>x y. P x y \<Longrightarrow> P (F\<cdot>x) (G\<cdot>y)"  | 
|
176  | 
shows "P (fix\<cdot>F) (fix\<cdot>G)"  | 
|
177  | 
proof -  | 
|
| 
61424
 
c3658c18b7bc
prod_case as canonical name for product type eliminator
 
haftmann 
parents: 
58880 
diff
changeset
 | 
178  | 
from adm have adm': "adm (case_prod P)"  | 
| 33590 | 179  | 
unfolding split_def .  | 
| 67312 | 180  | 
have "P (iterate i\<cdot>F\<cdot>\<bottom>) (iterate i\<cdot>G\<cdot>\<bottom>)" for i  | 
181  | 
by (induct i) (simp add: base, simp add: step)  | 
|
182  | 
then have "\<And>i. case_prod P (iterate i\<cdot>F\<cdot>\<bottom>, iterate i\<cdot>G\<cdot>\<bottom>)"  | 
|
| 33590 | 183  | 
by simp  | 
| 67312 | 184  | 
then have "case_prod P (\<Squnion>i. (iterate i\<cdot>F\<cdot>\<bottom>, iterate i\<cdot>G\<cdot>\<bottom>))"  | 
| 33590 | 185  | 
by - (rule admD [OF adm'], simp, assumption)  | 
| 67312 | 186  | 
then have "case_prod P (\<Squnion>i. iterate i\<cdot>F\<cdot>\<bottom>, \<Squnion>i. iterate i\<cdot>G\<cdot>\<bottom>)"  | 
| 40771 | 187  | 
by (simp add: lub_Pair)  | 
| 67312 | 188  | 
then have "P (\<Squnion>i. iterate i\<cdot>F\<cdot>\<bottom>) (\<Squnion>i. iterate i\<cdot>G\<cdot>\<bottom>)"  | 
| 33590 | 189  | 
by simp  | 
| 67312 | 190  | 
then show "P (fix\<cdot>F) (fix\<cdot>G)"  | 
| 33590 | 191  | 
by (simp add: fix_def2)  | 
192  | 
qed  | 
|
193  | 
||
| 
41324
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
194  | 
lemma cont_parallel_fix_ind:  | 
| 
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
195  | 
assumes "cont F" and "cont G"  | 
| 
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
196  | 
assumes "adm (\<lambda>x. P (fst x) (snd x))"  | 
| 
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
197  | 
assumes "P \<bottom> \<bottom>"  | 
| 
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
198  | 
assumes "\<And>x y. P x y \<Longrightarrow> P (F x) (G y)"  | 
| 
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
199  | 
shows "P (fix\<cdot>(Abs_cfun F)) (fix\<cdot>(Abs_cfun G))"  | 
| 67312 | 200  | 
by (rule parallel_fix_ind) (simp_all add: assms)  | 
201  | 
||
| 
41324
 
1383653efec3
make internal proofs for deflation and isodefl theorems more robust, by avoiding calls to the simplifier for beta-reduction
 
huffman 
parents: 
40774 
diff
changeset
 | 
202  | 
|
| 62175 | 203  | 
subsection \<open>Fixed-points on product types\<close>  | 
| 
18093
 
587692219f69
put iterate and fix in separate sections; added Letrec
 
huffman 
parents: 
18092 
diff
changeset
 | 
204  | 
|
| 62175 | 205  | 
text \<open>  | 
| 18095 | 206  | 
Bekic's Theorem: Simultaneous fixed points over pairs  | 
207  | 
can be written in terms of separate fixed points.  | 
|
| 62175 | 208  | 
\<close>  | 
| 18095 | 209  | 
|
210  | 
lemma fix_cprod:  | 
|
211  | 
"fix\<cdot>(F::'a \<times> 'b \<rightarrow> 'a \<times> 'b) =  | 
|
| 35921 | 212  | 
(\<mu> x. fst (F\<cdot>(x, \<mu> y. snd (F\<cdot>(x, y)))),  | 
213  | 
\<mu> y. snd (F\<cdot>(\<mu> x. fst (F\<cdot>(x, \<mu> y. snd (F\<cdot>(x, y)))), y)))"  | 
|
214  | 
(is "fix\<cdot>F = (?x, ?y)")  | 
|
| 
27185
 
0407630909ef
change orientation of fix_eqI and convert to rule_format;
 
huffman 
parents: 
25927 
diff
changeset
 | 
215  | 
proof (rule fix_eqI)  | 
| 67312 | 216  | 
have *: "fst (F\<cdot>(?x, ?y)) = ?x"  | 
| 18095 | 217  | 
by (rule trans [symmetric, OF fix_eq], simp)  | 
| 67312 | 218  | 
have "snd (F\<cdot>(?x, ?y)) = ?y"  | 
| 18095 | 219  | 
by (rule trans [symmetric, OF fix_eq], simp)  | 
| 67312 | 220  | 
with * show "F\<cdot>(?x, ?y) = (?x, ?y)"  | 
221  | 
by (simp add: prod_eq_iff)  | 
|
| 18095 | 222  | 
next  | 
| 67312 | 223  | 
fix z  | 
224  | 
assume F_z: "F\<cdot>z = z"  | 
|
225  | 
obtain x y where z: "z = (x, y)" by (rule prod.exhaust)  | 
|
| 35921 | 226  | 
from F_z z have F_x: "fst (F\<cdot>(x, y)) = x" by simp  | 
227  | 
from F_z z have F_y: "snd (F\<cdot>(x, y)) = y" by simp  | 
|
228  | 
let ?y1 = "\<mu> y. snd (F\<cdot>(x, y))"  | 
|
| 67312 | 229  | 
have "?y1 \<sqsubseteq> y"  | 
230  | 
by (rule fix_least) (simp add: F_y)  | 
|
231  | 
then have "fst (F\<cdot>(x, ?y1)) \<sqsubseteq> fst (F\<cdot>(x, y))"  | 
|
| 35921 | 232  | 
by (simp add: fst_monofun monofun_cfun)  | 
| 67312 | 233  | 
with F_x have "fst (F\<cdot>(x, ?y1)) \<sqsubseteq> x"  | 
234  | 
by simp  | 
|
235  | 
then have *: "?x \<sqsubseteq> x"  | 
|
236  | 
by (simp add: fix_least_below)  | 
|
237  | 
then have "snd (F\<cdot>(?x, y)) \<sqsubseteq> snd (F\<cdot>(x, y))"  | 
|
| 35921 | 238  | 
by (simp add: snd_monofun monofun_cfun)  | 
| 67312 | 239  | 
with F_y have "snd (F\<cdot>(?x, y)) \<sqsubseteq> y"  | 
240  | 
by simp  | 
|
241  | 
then have "?y \<sqsubseteq> y"  | 
|
242  | 
by (simp add: fix_least_below)  | 
|
243  | 
with z * show "(?x, ?y) \<sqsubseteq> z"  | 
|
244  | 
by simp  | 
|
| 18095 | 245  | 
qed  | 
246  | 
||
| 
243
 
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
 
nipkow 
parents:  
diff
changeset
 | 
247  | 
end  |