| author | wenzelm | 
| Sun, 31 Jan 2021 20:39:16 +0100 | |
| changeset 73215 | a81ec42bac45 | 
| parent 68358 | e761afd35baa | 
| child 81583 | b6df83045178 | 
| permissions | -rw-r--r-- | 
| 42151 | 1  | 
(* Title: HOL/HOLCF/Map_Functions.thy  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
2  | 
Author: Brian Huffman  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
3  | 
*)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
4  | 
|
| 62175 | 5  | 
section \<open>Map functions for various types\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
6  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
7  | 
theory Map_Functions  | 
| 67312 | 8  | 
imports Deflation Sprod Ssum Sfun Up  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
9  | 
begin  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
10  | 
|
| 62175 | 11  | 
subsection \<open>Map operator for continuous function space\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
12  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
13  | 
default_sort cpo  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
14  | 
|
| 67312 | 15  | 
definition cfun_map :: "('b \<rightarrow> 'a) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> ('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'd)"
 | 
16  | 
where "cfun_map = (\<Lambda> a b f x. b\<cdot>(f\<cdot>(a\<cdot>x)))"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
17  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
18  | 
lemma cfun_map_beta [simp]: "cfun_map\<cdot>a\<cdot>b\<cdot>f\<cdot>x = b\<cdot>(f\<cdot>(a\<cdot>x))"  | 
| 67312 | 19  | 
by (simp add: cfun_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
20  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
21  | 
lemma cfun_map_ID: "cfun_map\<cdot>ID\<cdot>ID = ID"  | 
| 67312 | 22  | 
by (simp add: cfun_eq_iff)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
23  | 
|
| 67312 | 24  | 
lemma cfun_map_map: "cfun_map\<cdot>f1\<cdot>g1\<cdot>(cfun_map\<cdot>f2\<cdot>g2\<cdot>p) = cfun_map\<cdot>(\<Lambda> x. f2\<cdot>(f1\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
25  | 
by (rule cfun_eqI) simp  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
26  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
27  | 
lemma ep_pair_cfun_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
28  | 
assumes "ep_pair e1 p1" and "ep_pair e2 p2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
29  | 
shows "ep_pair (cfun_map\<cdot>p1\<cdot>e2) (cfun_map\<cdot>e1\<cdot>p2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
30  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
31  | 
interpret e1p1: ep_pair e1 p1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
32  | 
interpret e2p2: ep_pair e2 p2 by fact  | 
| 67312 | 33  | 
show "cfun_map\<cdot>e1\<cdot>p2\<cdot>(cfun_map\<cdot>p1\<cdot>e2\<cdot>f) = f" for f  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
34  | 
by (simp add: cfun_eq_iff)  | 
| 67312 | 35  | 
show "cfun_map\<cdot>p1\<cdot>e2\<cdot>(cfun_map\<cdot>e1\<cdot>p2\<cdot>g) \<sqsubseteq> g" for g  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
36  | 
apply (rule cfun_belowI, simp)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
37  | 
apply (rule below_trans [OF e2p2.e_p_below])  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
38  | 
apply (rule monofun_cfun_arg)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
39  | 
apply (rule e1p1.e_p_below)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
40  | 
done  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
41  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
42  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
43  | 
lemma deflation_cfun_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
44  | 
assumes "deflation d1" and "deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
45  | 
shows "deflation (cfun_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
46  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
47  | 
interpret d1: deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
48  | 
interpret d2: deflation d2 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
49  | 
fix f  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
50  | 
show "cfun_map\<cdot>d1\<cdot>d2\<cdot>(cfun_map\<cdot>d1\<cdot>d2\<cdot>f) = cfun_map\<cdot>d1\<cdot>d2\<cdot>f"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
51  | 
by (simp add: cfun_eq_iff d1.idem d2.idem)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
52  | 
show "cfun_map\<cdot>d1\<cdot>d2\<cdot>f \<sqsubseteq> f"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
53  | 
apply (rule cfun_belowI, simp)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
54  | 
apply (rule below_trans [OF d2.below])  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
55  | 
apply (rule monofun_cfun_arg)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
56  | 
apply (rule d1.below)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
57  | 
done  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
58  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
59  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
60  | 
lemma finite_range_cfun_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
61  | 
assumes a: "finite (range (\<lambda>x. a\<cdot>x))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
62  | 
assumes b: "finite (range (\<lambda>y. b\<cdot>y))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
63  | 
shows "finite (range (\<lambda>f. cfun_map\<cdot>a\<cdot>b\<cdot>f))" (is "finite (range ?h)")  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
64  | 
proof (rule finite_imageD)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
65  | 
let ?f = "\<lambda>g. range (\<lambda>x. (a\<cdot>x, g\<cdot>x))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
66  | 
show "finite (?f ` range ?h)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
67  | 
proof (rule finite_subset)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
68  | 
let ?B = "Pow (range (\<lambda>x. a\<cdot>x) \<times> range (\<lambda>y. b\<cdot>y))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
69  | 
show "?f ` range ?h \<subseteq> ?B"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
70  | 
by clarsimp  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
71  | 
show "finite ?B"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
72  | 
by (simp add: a b)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
73  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
74  | 
show "inj_on ?f (range ?h)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
75  | 
proof (rule inj_onI, rule cfun_eqI, clarsimp)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
76  | 
fix x f g  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
77  | 
assume "range (\<lambda>x. (a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x)))) = range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"  | 
| 67312 | 78  | 
then have "range (\<lambda>x. (a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x)))) \<subseteq> range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
79  | 
by (rule equalityD1)  | 
| 67312 | 80  | 
then have "(a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x))) \<in> range (\<lambda>x. (a\<cdot>x, b\<cdot>(g\<cdot>(a\<cdot>x))))"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
81  | 
by (simp add: subset_eq)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
82  | 
then obtain y where "(a\<cdot>x, b\<cdot>(f\<cdot>(a\<cdot>x))) = (a\<cdot>y, b\<cdot>(g\<cdot>(a\<cdot>y)))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
83  | 
by (rule rangeE)  | 
| 67312 | 84  | 
then show "b\<cdot>(f\<cdot>(a\<cdot>x)) = b\<cdot>(g\<cdot>(a\<cdot>x))"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
85  | 
by clarsimp  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
86  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
87  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
88  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
89  | 
lemma finite_deflation_cfun_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
90  | 
assumes "finite_deflation d1" and "finite_deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
91  | 
shows "finite_deflation (cfun_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
92  | 
proof (rule finite_deflation_intro)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
93  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
94  | 
interpret d2: finite_deflation d2 by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
95  | 
from d1.deflation_axioms d2.deflation_axioms show "deflation (cfun_map\<cdot>d1\<cdot>d2)"  | 
| 67312 | 96  | 
by (rule deflation_cfun_map)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
97  | 
have "finite (range (\<lambda>f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f))"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
98  | 
using d1.finite_range d2.finite_range  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
99  | 
by (rule finite_range_cfun_map)  | 
| 67312 | 100  | 
  then show "finite {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
 | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
101  | 
by (rule finite_range_imp_finite_fixes)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
102  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
103  | 
|
| 62175 | 104  | 
text \<open>Finite deflations are compact elements of the function space\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
105  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
106  | 
lemma finite_deflation_imp_compact: "finite_deflation d \<Longrightarrow> compact d"  | 
| 67312 | 107  | 
apply (frule finite_deflation_imp_deflation)  | 
108  | 
apply (subgoal_tac "compact (cfun_map\<cdot>d\<cdot>d\<cdot>d)")  | 
|
109  | 
apply (simp add: cfun_map_def deflation.idem eta_cfun)  | 
|
110  | 
apply (rule finite_deflation.compact)  | 
|
111  | 
apply (simp only: finite_deflation_cfun_map)  | 
|
112  | 
done  | 
|
113  | 
||
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
114  | 
|
| 62175 | 115  | 
subsection \<open>Map operator for product type\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
116  | 
|
| 67312 | 117  | 
definition prod_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<times> 'c \<rightarrow> 'b \<times> 'd"
 | 
118  | 
where "prod_map = (\<Lambda> f g p. (f\<cdot>(fst p), g\<cdot>(snd p)))"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
119  | 
|
| 41297 | 120  | 
lemma prod_map_Pair [simp]: "prod_map\<cdot>f\<cdot>g\<cdot>(x, y) = (f\<cdot>x, g\<cdot>y)"  | 
| 67312 | 121  | 
by (simp add: prod_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
122  | 
|
| 41297 | 123  | 
lemma prod_map_ID: "prod_map\<cdot>ID\<cdot>ID = ID"  | 
| 67312 | 124  | 
by (auto simp: cfun_eq_iff)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
125  | 
|
| 67312 | 126  | 
lemma prod_map_map: "prod_map\<cdot>f1\<cdot>g1\<cdot>(prod_map\<cdot>f2\<cdot>g2\<cdot>p) = prod_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
127  | 
by (induct p) simp  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
128  | 
|
| 41297 | 129  | 
lemma ep_pair_prod_map:  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
130  | 
assumes "ep_pair e1 p1" and "ep_pair e2 p2"  | 
| 41297 | 131  | 
shows "ep_pair (prod_map\<cdot>e1\<cdot>e2) (prod_map\<cdot>p1\<cdot>p2)"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
132  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
133  | 
interpret e1p1: ep_pair e1 p1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
134  | 
interpret e2p2: ep_pair e2 p2 by fact  | 
| 67312 | 135  | 
show "prod_map\<cdot>p1\<cdot>p2\<cdot>(prod_map\<cdot>e1\<cdot>e2\<cdot>x) = x" for x  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
136  | 
by (induct x) simp  | 
| 67312 | 137  | 
show "prod_map\<cdot>e1\<cdot>e2\<cdot>(prod_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y" for y  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
138  | 
by (induct y) (simp add: e1p1.e_p_below e2p2.e_p_below)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
139  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
140  | 
|
| 41297 | 141  | 
lemma deflation_prod_map:  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
142  | 
assumes "deflation d1" and "deflation d2"  | 
| 41297 | 143  | 
shows "deflation (prod_map\<cdot>d1\<cdot>d2)"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
144  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
145  | 
interpret d1: deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
146  | 
interpret d2: deflation d2 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
147  | 
fix x  | 
| 41297 | 148  | 
show "prod_map\<cdot>d1\<cdot>d2\<cdot>(prod_map\<cdot>d1\<cdot>d2\<cdot>x) = prod_map\<cdot>d1\<cdot>d2\<cdot>x"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
149  | 
by (induct x) (simp add: d1.idem d2.idem)  | 
| 41297 | 150  | 
show "prod_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
151  | 
by (induct x) (simp add: d1.below d2.below)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
152  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
153  | 
|
| 41297 | 154  | 
lemma finite_deflation_prod_map:  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
155  | 
assumes "finite_deflation d1" and "finite_deflation d2"  | 
| 41297 | 156  | 
shows "finite_deflation (prod_map\<cdot>d1\<cdot>d2)"  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
157  | 
proof (rule finite_deflation_intro)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
158  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
159  | 
interpret d2: finite_deflation d2 by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
160  | 
from d1.deflation_axioms d2.deflation_axioms show "deflation (prod_map\<cdot>d1\<cdot>d2)"  | 
| 
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
161  | 
by (rule deflation_prod_map)  | 
| 41297 | 162  | 
  have "{p. prod_map\<cdot>d1\<cdot>d2\<cdot>p = p} \<subseteq> {x. d1\<cdot>x = x} \<times> {y. d2\<cdot>y = y}"
 | 
| 67312 | 163  | 
by auto  | 
164  | 
  then show "finite {p. prod_map\<cdot>d1\<cdot>d2\<cdot>p = p}"
 | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
165  | 
by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
166  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
167  | 
|
| 67312 | 168  | 
|
| 62175 | 169  | 
subsection \<open>Map function for lifted cpo\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
170  | 
|
| 67312 | 171  | 
definition u_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a u \<rightarrow> 'b u"
 | 
172  | 
where "u_map = (\<Lambda> f. fup\<cdot>(up oo f))"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
173  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
174  | 
lemma u_map_strict [simp]: "u_map\<cdot>f\<cdot>\<bottom> = \<bottom>"  | 
| 67312 | 175  | 
by (simp add: u_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
176  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
177  | 
lemma u_map_up [simp]: "u_map\<cdot>f\<cdot>(up\<cdot>x) = up\<cdot>(f\<cdot>x)"  | 
| 67312 | 178  | 
by (simp add: u_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
179  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
180  | 
lemma u_map_ID: "u_map\<cdot>ID = ID"  | 
| 67312 | 181  | 
by (simp add: u_map_def cfun_eq_iff eta_cfun)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
182  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
183  | 
lemma u_map_map: "u_map\<cdot>f\<cdot>(u_map\<cdot>g\<cdot>p) = u_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>p"  | 
| 67312 | 184  | 
by (induct p) simp_all  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
185  | 
|
| 41291 | 186  | 
lemma u_map_oo: "u_map\<cdot>(f oo g) = u_map\<cdot>f oo u_map\<cdot>g"  | 
| 67312 | 187  | 
by (simp add: cfcomp1 u_map_map eta_cfun)  | 
| 41291 | 188  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
189  | 
lemma ep_pair_u_map: "ep_pair e p \<Longrightarrow> ep_pair (u_map\<cdot>e) (u_map\<cdot>p)"  | 
| 67312 | 190  | 
apply standard  | 
| 68358 | 191  | 
subgoal for x by (cases x) (simp_all add: ep_pair.e_inverse)  | 
192  | 
subgoal for y by (cases y) (simp_all add: ep_pair.e_p_below)  | 
|
| 67312 | 193  | 
done  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
194  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
195  | 
lemma deflation_u_map: "deflation d \<Longrightarrow> deflation (u_map\<cdot>d)"  | 
| 67312 | 196  | 
apply standard  | 
| 68358 | 197  | 
subgoal for x by (cases x) (simp_all add: deflation.idem)  | 
198  | 
subgoal for x by (cases x) (simp_all add: deflation.below)  | 
|
| 67312 | 199  | 
done  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
200  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
201  | 
lemma finite_deflation_u_map:  | 
| 67312 | 202  | 
assumes "finite_deflation d"  | 
203  | 
shows "finite_deflation (u_map\<cdot>d)"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
204  | 
proof (rule finite_deflation_intro)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
205  | 
interpret d: finite_deflation d by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
206  | 
from d.deflation_axioms show "deflation (u_map\<cdot>d)"  | 
| 67312 | 207  | 
by (rule deflation_u_map)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
208  | 
  have "{x. u_map\<cdot>d\<cdot>x = x} \<subseteq> insert \<bottom> ((\<lambda>x. up\<cdot>x) ` {x. d\<cdot>x = x})"
 | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
209  | 
by (rule subsetI, case_tac x, simp_all)  | 
| 67312 | 210  | 
  then show "finite {x. u_map\<cdot>d\<cdot>x = x}"
 | 
211  | 
by (rule finite_subset) (simp add: d.finite_fixes)  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
212  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
213  | 
|
| 67312 | 214  | 
|
| 62175 | 215  | 
subsection \<open>Map function for strict products\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
216  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
217  | 
default_sort pcpo  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
218  | 
|
| 67312 | 219  | 
definition sprod_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<otimes> 'c \<rightarrow> 'b \<otimes> 'd"
 | 
220  | 
where "sprod_map = (\<Lambda> f g. ssplit\<cdot>(\<Lambda> x y. (:f\<cdot>x, g\<cdot>y:)))"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
221  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
222  | 
lemma sprod_map_strict [simp]: "sprod_map\<cdot>a\<cdot>b\<cdot>\<bottom> = \<bottom>"  | 
| 67312 | 223  | 
by (simp add: sprod_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
224  | 
|
| 67312 | 225  | 
lemma sprod_map_spair [simp]: "x \<noteq> \<bottom> \<Longrightarrow> y \<noteq> \<bottom> \<Longrightarrow> sprod_map\<cdot>f\<cdot>g\<cdot>(:x, y:) = (:f\<cdot>x, g\<cdot>y:)"  | 
226  | 
by (simp add: sprod_map_def)  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
227  | 
|
| 67312 | 228  | 
lemma sprod_map_spair': "f\<cdot>\<bottom> = \<bottom> \<Longrightarrow> g\<cdot>\<bottom> = \<bottom> \<Longrightarrow> sprod_map\<cdot>f\<cdot>g\<cdot>(:x, y:) = (:f\<cdot>x, g\<cdot>y:)"  | 
229  | 
by (cases "x = \<bottom> \<or> y = \<bottom>") auto  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
230  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
231  | 
lemma sprod_map_ID: "sprod_map\<cdot>ID\<cdot>ID = ID"  | 
| 67312 | 232  | 
by (simp add: sprod_map_def cfun_eq_iff eta_cfun)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
233  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
234  | 
lemma sprod_map_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
235  | 
"\<lbrakk>f1\<cdot>\<bottom> = \<bottom>; g1\<cdot>\<bottom> = \<bottom>\<rbrakk> \<Longrightarrow>  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
236  | 
sprod_map\<cdot>f1\<cdot>g1\<cdot>(sprod_map\<cdot>f2\<cdot>g2\<cdot>p) =  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
237  | 
sprod_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
| 68358 | 238  | 
proof (induct p)  | 
239  | 
case bottom  | 
|
240  | 
then show ?case by simp  | 
|
241  | 
next  | 
|
242  | 
case (spair x y)  | 
|
243  | 
then show ?case  | 
|
244  | 
apply (cases "f2\<cdot>x = \<bottom>", simp)  | 
|
245  | 
apply (cases "g2\<cdot>y = \<bottom>", simp)  | 
|
246  | 
apply simp  | 
|
247  | 
done  | 
|
248  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
249  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
250  | 
lemma ep_pair_sprod_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
251  | 
assumes "ep_pair e1 p1" and "ep_pair e2 p2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
252  | 
shows "ep_pair (sprod_map\<cdot>e1\<cdot>e2) (sprod_map\<cdot>p1\<cdot>p2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
253  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
254  | 
interpret e1p1: pcpo_ep_pair e1 p1 unfolding pcpo_ep_pair_def by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
255  | 
interpret e2p2: pcpo_ep_pair e2 p2 unfolding pcpo_ep_pair_def by fact  | 
| 67312 | 256  | 
show "sprod_map\<cdot>p1\<cdot>p2\<cdot>(sprod_map\<cdot>e1\<cdot>e2\<cdot>x) = x" for x  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
257  | 
by (induct x) simp_all  | 
| 67312 | 258  | 
show "sprod_map\<cdot>e1\<cdot>e2\<cdot>(sprod_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y" for y  | 
| 68358 | 259  | 
proof (induct y)  | 
260  | 
case bottom  | 
|
261  | 
then show ?case by simp  | 
|
262  | 
next  | 
|
263  | 
case (spair x y)  | 
|
264  | 
then show ?case  | 
|
265  | 
apply simp  | 
|
266  | 
apply (cases "p1\<cdot>x = \<bottom>", simp, cases "p2\<cdot>y = \<bottom>", simp)  | 
|
267  | 
apply (simp add: monofun_cfun e1p1.e_p_below e2p2.e_p_below)  | 
|
268  | 
done  | 
|
269  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
270  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
271  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
272  | 
lemma deflation_sprod_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
273  | 
assumes "deflation d1" and "deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
274  | 
shows "deflation (sprod_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
275  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
276  | 
interpret d1: deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
277  | 
interpret d2: deflation d2 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
278  | 
fix x  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
279  | 
show "sprod_map\<cdot>d1\<cdot>d2\<cdot>(sprod_map\<cdot>d1\<cdot>d2\<cdot>x) = sprod_map\<cdot>d1\<cdot>d2\<cdot>x"  | 
| 68358 | 280  | 
proof (induct x)  | 
281  | 
case bottom  | 
|
282  | 
then show ?case by simp  | 
|
283  | 
next  | 
|
284  | 
case (spair x y)  | 
|
285  | 
then show ?case  | 
|
286  | 
apply (cases "d1\<cdot>x = \<bottom>", simp, cases "d2\<cdot>y = \<bottom>", simp)  | 
|
287  | 
apply (simp add: d1.idem d2.idem)  | 
|
288  | 
done  | 
|
289  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
290  | 
show "sprod_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"  | 
| 68358 | 291  | 
proof (induct x)  | 
292  | 
case bottom  | 
|
293  | 
then show ?case by simp  | 
|
294  | 
next  | 
|
295  | 
case spair  | 
|
296  | 
then show ?case by (simp add: monofun_cfun d1.below d2.below)  | 
|
297  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
298  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
299  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
300  | 
lemma finite_deflation_sprod_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
301  | 
assumes "finite_deflation d1" and "finite_deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
302  | 
shows "finite_deflation (sprod_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
303  | 
proof (rule finite_deflation_intro)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
304  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
305  | 
interpret d2: finite_deflation d2 by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
306  | 
from d1.deflation_axioms d2.deflation_axioms show "deflation (sprod_map\<cdot>d1\<cdot>d2)"  | 
| 67312 | 307  | 
by (rule deflation_sprod_map)  | 
308  | 
  have "{x. sprod_map\<cdot>d1\<cdot>d2\<cdot>x = x} \<subseteq>
 | 
|
309  | 
      insert \<bottom> ((\<lambda>(x, y). (:x, y:)) ` ({x. d1\<cdot>x = x} \<times> {y. d2\<cdot>y = y}))"
 | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
310  | 
by (rule subsetI, case_tac x, auto simp add: spair_eq_iff)  | 
| 67312 | 311  | 
  then show "finite {x. sprod_map\<cdot>d1\<cdot>d2\<cdot>x = x}"
 | 
312  | 
by (rule finite_subset) (simp add: d1.finite_fixes d2.finite_fixes)  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
313  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
314  | 
|
| 67312 | 315  | 
|
| 62175 | 316  | 
subsection \<open>Map function for strict sums\<close>  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
317  | 
|
| 67312 | 318  | 
definition ssum_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<oplus> 'c \<rightarrow> 'b \<oplus> 'd"
 | 
319  | 
where "ssum_map = (\<Lambda> f g. sscase\<cdot>(sinl oo f)\<cdot>(sinr oo g))"  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
320  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
321  | 
lemma ssum_map_strict [simp]: "ssum_map\<cdot>f\<cdot>g\<cdot>\<bottom> = \<bottom>"  | 
| 67312 | 322  | 
by (simp add: ssum_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
323  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
324  | 
lemma ssum_map_sinl [simp]: "x \<noteq> \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = sinl\<cdot>(f\<cdot>x)"  | 
| 67312 | 325  | 
by (simp add: ssum_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
326  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
327  | 
lemma ssum_map_sinr [simp]: "x \<noteq> \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>x) = sinr\<cdot>(g\<cdot>x)"  | 
| 67312 | 328  | 
by (simp add: ssum_map_def)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
329  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
330  | 
lemma ssum_map_sinl': "f\<cdot>\<bottom> = \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = sinl\<cdot>(f\<cdot>x)"  | 
| 67312 | 331  | 
by (cases "x = \<bottom>") simp_all  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
332  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
333  | 
lemma ssum_map_sinr': "g\<cdot>\<bottom> = \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>x) = sinr\<cdot>(g\<cdot>x)"  | 
| 67312 | 334  | 
by (cases "x = \<bottom>") simp_all  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
335  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
336  | 
lemma ssum_map_ID: "ssum_map\<cdot>ID\<cdot>ID = ID"  | 
| 67312 | 337  | 
by (simp add: ssum_map_def cfun_eq_iff eta_cfun)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
338  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
339  | 
lemma ssum_map_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
340  | 
"\<lbrakk>f1\<cdot>\<bottom> = \<bottom>; g1\<cdot>\<bottom> = \<bottom>\<rbrakk> \<Longrightarrow>  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
341  | 
ssum_map\<cdot>f1\<cdot>g1\<cdot>(ssum_map\<cdot>f2\<cdot>g2\<cdot>p) =  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
342  | 
ssum_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
| 68358 | 343  | 
proof (induct p)  | 
344  | 
case bottom  | 
|
345  | 
then show ?case by simp  | 
|
346  | 
next  | 
|
347  | 
case (sinl x)  | 
|
348  | 
then show ?case by (cases "f2\<cdot>x = \<bottom>") simp_all  | 
|
349  | 
next  | 
|
350  | 
case (sinr y)  | 
|
351  | 
then show ?case by (cases "g2\<cdot>y = \<bottom>") simp_all  | 
|
352  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
353  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
354  | 
lemma ep_pair_ssum_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
355  | 
assumes "ep_pair e1 p1" and "ep_pair e2 p2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
356  | 
shows "ep_pair (ssum_map\<cdot>e1\<cdot>e2) (ssum_map\<cdot>p1\<cdot>p2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
357  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
358  | 
interpret e1p1: pcpo_ep_pair e1 p1 unfolding pcpo_ep_pair_def by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
359  | 
interpret e2p2: pcpo_ep_pair e2 p2 unfolding pcpo_ep_pair_def by fact  | 
| 67312 | 360  | 
show "ssum_map\<cdot>p1\<cdot>p2\<cdot>(ssum_map\<cdot>e1\<cdot>e2\<cdot>x) = x" for x  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
361  | 
by (induct x) simp_all  | 
| 67312 | 362  | 
show "ssum_map\<cdot>e1\<cdot>e2\<cdot>(ssum_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y" for y  | 
| 68358 | 363  | 
proof (induct y)  | 
364  | 
case bottom  | 
|
365  | 
then show ?case by simp  | 
|
366  | 
next  | 
|
367  | 
case (sinl x)  | 
|
368  | 
then show ?case by (cases "p1\<cdot>x = \<bottom>") (simp_all add: e1p1.e_p_below)  | 
|
369  | 
next  | 
|
370  | 
case (sinr y)  | 
|
371  | 
then show ?case by (cases "p2\<cdot>y = \<bottom>") (simp_all add: e2p2.e_p_below)  | 
|
372  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
373  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
374  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
375  | 
lemma deflation_ssum_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
376  | 
assumes "deflation d1" and "deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
377  | 
shows "deflation (ssum_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
378  | 
proof  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
379  | 
interpret d1: deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
380  | 
interpret d2: deflation d2 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
381  | 
fix x  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
382  | 
show "ssum_map\<cdot>d1\<cdot>d2\<cdot>(ssum_map\<cdot>d1\<cdot>d2\<cdot>x) = ssum_map\<cdot>d1\<cdot>d2\<cdot>x"  | 
| 68358 | 383  | 
proof (induct x)  | 
384  | 
case bottom  | 
|
385  | 
then show ?case by simp  | 
|
386  | 
next  | 
|
387  | 
case (sinl x)  | 
|
388  | 
then show ?case by (cases "d1\<cdot>x = \<bottom>") (simp_all add: d1.idem)  | 
|
389  | 
next  | 
|
390  | 
case (sinr y)  | 
|
391  | 
then show ?case by (cases "d2\<cdot>y = \<bottom>") (simp_all add: d2.idem)  | 
|
392  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
393  | 
show "ssum_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"  | 
| 68358 | 394  | 
proof (induct x)  | 
395  | 
case bottom  | 
|
396  | 
then show ?case by simp  | 
|
397  | 
next  | 
|
398  | 
case (sinl x)  | 
|
399  | 
then show ?case by (cases "d1\<cdot>x = \<bottom>") (simp_all add: d1.below)  | 
|
400  | 
next  | 
|
401  | 
case (sinr y)  | 
|
402  | 
then show ?case by (cases "d2\<cdot>y = \<bottom>") (simp_all add: d2.below)  | 
|
403  | 
qed  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
404  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
405  | 
|
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
406  | 
lemma finite_deflation_ssum_map:  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
407  | 
assumes "finite_deflation d1" and "finite_deflation d2"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
408  | 
shows "finite_deflation (ssum_map\<cdot>d1\<cdot>d2)"  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
409  | 
proof (rule finite_deflation_intro)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
410  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
411  | 
interpret d2: finite_deflation d2 by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
412  | 
from d1.deflation_axioms d2.deflation_axioms show "deflation (ssum_map\<cdot>d1\<cdot>d2)"  | 
| 67312 | 413  | 
by (rule deflation_ssum_map)  | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
414  | 
  have "{x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x} \<subseteq>
 | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
415  | 
        (\<lambda>x. sinl\<cdot>x) ` {x. d1\<cdot>x = x} \<union>
 | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
416  | 
        (\<lambda>x. sinr\<cdot>x) ` {x. d2\<cdot>x = x} \<union> {\<bottom>}"
 | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
417  | 
by (rule subsetI, case_tac x, simp_all)  | 
| 67312 | 418  | 
  then show "finite {x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x}"
 | 
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
419  | 
by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
420  | 
qed  | 
| 
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
421  | 
|
| 67312 | 422  | 
|
| 62175 | 423  | 
subsection \<open>Map operator for strict function space\<close>  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
424  | 
|
| 67312 | 425  | 
definition sfun_map :: "('b \<rightarrow> 'a) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> ('a \<rightarrow>! 'c) \<rightarrow> ('b \<rightarrow>! 'd)"
 | 
426  | 
where "sfun_map = (\<Lambda> a b. sfun_abs oo cfun_map\<cdot>a\<cdot>b oo sfun_rep)"  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
427  | 
|
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
428  | 
lemma sfun_map_ID: "sfun_map\<cdot>ID\<cdot>ID = ID"  | 
| 67312 | 429  | 
by (simp add: sfun_map_def cfun_map_ID cfun_eq_iff)  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
430  | 
|
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
431  | 
lemma sfun_map_map:  | 
| 67312 | 432  | 
assumes "f2\<cdot>\<bottom> = \<bottom>" and "g2\<cdot>\<bottom> = \<bottom>"  | 
433  | 
shows "sfun_map\<cdot>f1\<cdot>g1\<cdot>(sfun_map\<cdot>f2\<cdot>g2\<cdot>p) =  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
434  | 
sfun_map\<cdot>(\<Lambda> x. f2\<cdot>(f1\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
| 67312 | 435  | 
by (simp add: sfun_map_def cfun_eq_iff strictify_cancel assms cfun_map_map)  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
436  | 
|
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
437  | 
lemma ep_pair_sfun_map:  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
438  | 
assumes 1: "ep_pair e1 p1"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
439  | 
assumes 2: "ep_pair e2 p2"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
440  | 
shows "ep_pair (sfun_map\<cdot>p1\<cdot>e2) (sfun_map\<cdot>e1\<cdot>p2)"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
441  | 
proof  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
442  | 
interpret e1p1: pcpo_ep_pair e1 p1  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
443  | 
unfolding pcpo_ep_pair_def by fact  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
444  | 
interpret e2p2: pcpo_ep_pair e2 p2  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
445  | 
unfolding pcpo_ep_pair_def by fact  | 
| 67312 | 446  | 
show "sfun_map\<cdot>e1\<cdot>p2\<cdot>(sfun_map\<cdot>p1\<cdot>e2\<cdot>f) = f" for f  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
447  | 
unfolding sfun_map_def  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
448  | 
apply (simp add: sfun_eq_iff strictify_cancel)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
449  | 
apply (rule ep_pair.e_inverse)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
450  | 
apply (rule ep_pair_cfun_map [OF 1 2])  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
451  | 
done  | 
| 67312 | 452  | 
show "sfun_map\<cdot>p1\<cdot>e2\<cdot>(sfun_map\<cdot>e1\<cdot>p2\<cdot>g) \<sqsubseteq> g" for g  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
453  | 
unfolding sfun_map_def  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
454  | 
apply (simp add: sfun_below_iff strictify_cancel)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
455  | 
apply (rule ep_pair.e_p_below)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
456  | 
apply (rule ep_pair_cfun_map [OF 1 2])  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
457  | 
done  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
458  | 
qed  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
459  | 
|
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
460  | 
lemma deflation_sfun_map:  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
461  | 
assumes 1: "deflation d1"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
462  | 
assumes 2: "deflation d2"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
463  | 
shows "deflation (sfun_map\<cdot>d1\<cdot>d2)"  | 
| 67312 | 464  | 
apply (simp add: sfun_map_def)  | 
465  | 
apply (rule deflation.intro)  | 
|
466  | 
apply simp  | 
|
467  | 
apply (subst strictify_cancel)  | 
|
468  | 
apply (simp add: cfun_map_def deflation_strict 1 2)  | 
|
469  | 
apply (simp add: cfun_map_def deflation.idem 1 2)  | 
|
470  | 
apply (simp add: sfun_below_iff)  | 
|
471  | 
apply (subst strictify_cancel)  | 
|
472  | 
apply (simp add: cfun_map_def deflation_strict 1 2)  | 
|
473  | 
apply (rule deflation.below)  | 
|
474  | 
apply (rule deflation_cfun_map [OF 1 2])  | 
|
475  | 
done  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
476  | 
|
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
477  | 
lemma finite_deflation_sfun_map:  | 
| 67312 | 478  | 
assumes "finite_deflation d1"  | 
479  | 
and "finite_deflation d2"  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
480  | 
shows "finite_deflation (sfun_map\<cdot>d1\<cdot>d2)"  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
481  | 
proof (intro finite_deflation_intro)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
482  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
483  | 
interpret d2: finite_deflation d2 by fact  | 
| 
67682
 
00c436488398
tuned proofs -- prefer explicit names for facts from 'interpret';
 
wenzelm 
parents: 
67312 
diff
changeset
 | 
484  | 
from d1.deflation_axioms d2.deflation_axioms show "deflation (sfun_map\<cdot>d1\<cdot>d2)"  | 
| 67312 | 485  | 
by (rule deflation_sfun_map)  | 
486  | 
from assms have "finite_deflation (cfun_map\<cdot>d1\<cdot>d2)"  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
487  | 
by (rule finite_deflation_cfun_map)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
488  | 
  then have "finite {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
 | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
489  | 
by (rule finite_deflation.finite_fixes)  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
490  | 
moreover have "inj (\<lambda>f. sfun_rep\<cdot>f)"  | 
| 67312 | 491  | 
by (rule inj_onI) (simp add: sfun_eq_iff)  | 
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
492  | 
  ultimately have "finite ((\<lambda>f. sfun_rep\<cdot>f) -` {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f})"
 | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
493  | 
by (rule finite_vimageI)  | 
| 67312 | 494  | 
  with \<open>deflation d1\<close> \<open>deflation d2\<close> show "finite {f. sfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
 | 
495  | 
by (simp add: sfun_map_def sfun_eq_iff strictify_cancel deflation_strict)  | 
|
| 
40592
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
496  | 
qed  | 
| 
 
f432973ce0f6
move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
 
huffman 
parents: 
40502 
diff
changeset
 | 
497  | 
|
| 
40502
 
8e92772bc0e8
move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
 
huffman 
parents:  
diff
changeset
 | 
498  | 
end  |