30 by intro_classes simp |
30 by intro_classes simp |
31 |
31 |
32 |
32 |
33 subsection {* Product type is a partial order *} |
33 subsection {* Product type is a partial order *} |
34 |
34 |
35 instantiation "*" :: (sq_ord, sq_ord) sq_ord |
35 instantiation "*" :: (below, below) below |
36 begin |
36 begin |
37 |
37 |
38 definition |
38 definition |
39 less_cprod_def: "(op \<sqsubseteq>) \<equiv> \<lambda>p1 p2. (fst p1 \<sqsubseteq> fst p2 \<and> snd p1 \<sqsubseteq> snd p2)" |
39 below_prod_def: "(op \<sqsubseteq>) \<equiv> \<lambda>p1 p2. (fst p1 \<sqsubseteq> fst p2 \<and> snd p1 \<sqsubseteq> snd p2)" |
40 |
40 |
41 instance .. |
41 instance .. |
42 end |
42 end |
43 |
43 |
44 instance "*" :: (po, po) po |
44 instance "*" :: (po, po) po |
45 proof |
45 proof |
46 fix x :: "'a \<times> 'b" |
46 fix x :: "'a \<times> 'b" |
47 show "x \<sqsubseteq> x" |
47 show "x \<sqsubseteq> x" |
48 unfolding less_cprod_def by simp |
48 unfolding below_prod_def by simp |
49 next |
49 next |
50 fix x y :: "'a \<times> 'b" |
50 fix x y :: "'a \<times> 'b" |
51 assume "x \<sqsubseteq> y" "y \<sqsubseteq> x" thus "x = y" |
51 assume "x \<sqsubseteq> y" "y \<sqsubseteq> x" thus "x = y" |
52 unfolding less_cprod_def Pair_fst_snd_eq |
52 unfolding below_prod_def Pair_fst_snd_eq |
53 by (fast intro: antisym_less) |
53 by (fast intro: below_antisym) |
54 next |
54 next |
55 fix x y z :: "'a \<times> 'b" |
55 fix x y z :: "'a \<times> 'b" |
56 assume "x \<sqsubseteq> y" "y \<sqsubseteq> z" thus "x \<sqsubseteq> z" |
56 assume "x \<sqsubseteq> y" "y \<sqsubseteq> z" thus "x \<sqsubseteq> z" |
57 unfolding less_cprod_def |
57 unfolding below_prod_def |
58 by (fast intro: trans_less) |
58 by (fast intro: below_trans) |
59 qed |
59 qed |
60 |
60 |
61 subsection {* Monotonicity of @{text "(_,_)"}, @{term fst}, @{term snd} *} |
61 subsection {* Monotonicity of @{text "(_,_)"}, @{term fst}, @{term snd} *} |
62 |
62 |
63 lemma prod_lessI: "\<lbrakk>fst p \<sqsubseteq> fst q; snd p \<sqsubseteq> snd q\<rbrakk> \<Longrightarrow> p \<sqsubseteq> q" |
63 lemma prod_belowI: "\<lbrakk>fst p \<sqsubseteq> fst q; snd p \<sqsubseteq> snd q\<rbrakk> \<Longrightarrow> p \<sqsubseteq> q" |
64 unfolding less_cprod_def by simp |
64 unfolding below_prod_def by simp |
65 |
65 |
66 lemma Pair_less_iff [simp]: "(a, b) \<sqsubseteq> (c, d) \<longleftrightarrow> a \<sqsubseteq> c \<and> b \<sqsubseteq> d" |
66 lemma Pair_below_iff [simp]: "(a, b) \<sqsubseteq> (c, d) \<longleftrightarrow> a \<sqsubseteq> c \<and> b \<sqsubseteq> d" |
67 unfolding less_cprod_def by simp |
67 unfolding below_prod_def by simp |
68 |
68 |
69 text {* Pair @{text "(_,_)"} is monotone in both arguments *} |
69 text {* Pair @{text "(_,_)"} is monotone in both arguments *} |
70 |
70 |
71 lemma monofun_pair1: "monofun (\<lambda>x. (x, y))" |
71 lemma monofun_pair1: "monofun (\<lambda>x. (x, y))" |
72 by (simp add: monofun_def) |
72 by (simp add: monofun_def) |
79 by simp |
79 by simp |
80 |
80 |
81 text {* @{term fst} and @{term snd} are monotone *} |
81 text {* @{term fst} and @{term snd} are monotone *} |
82 |
82 |
83 lemma monofun_fst: "monofun fst" |
83 lemma monofun_fst: "monofun fst" |
84 by (simp add: monofun_def less_cprod_def) |
84 by (simp add: monofun_def below_prod_def) |
85 |
85 |
86 lemma monofun_snd: "monofun snd" |
86 lemma monofun_snd: "monofun snd" |
87 by (simp add: monofun_def less_cprod_def) |
87 by (simp add: monofun_def below_prod_def) |
88 |
88 |
89 subsection {* Product type is a cpo *} |
89 subsection {* Product type is a cpo *} |
90 |
90 |
91 lemma is_lub_Pair: |
91 lemma is_lub_Pair: |
92 "\<lbrakk>range X <<| x; range Y <<| y\<rbrakk> \<Longrightarrow> range (\<lambda>i. (X i, Y i)) <<| (x, y)" |
92 "\<lbrakk>range X <<| x; range Y <<| y\<rbrakk> \<Longrightarrow> range (\<lambda>i. (X i, Y i)) <<| (x, y)" |
93 apply (rule is_lubI [OF ub_rangeI]) |
93 apply (rule is_lubI [OF ub_rangeI]) |
94 apply (simp add: less_cprod_def is_ub_lub) |
94 apply (simp add: below_prod_def is_ub_lub) |
95 apply (frule ub2ub_monofun [OF monofun_fst]) |
95 apply (frule ub2ub_monofun [OF monofun_fst]) |
96 apply (drule ub2ub_monofun [OF monofun_snd]) |
96 apply (drule ub2ub_monofun [OF monofun_snd]) |
97 apply (simp add: less_cprod_def is_lub_lub) |
97 apply (simp add: below_prod_def is_lub_lub) |
98 done |
98 done |
99 |
99 |
100 lemma lub_cprod: |
100 lemma lub_cprod: |
101 fixes S :: "nat \<Rightarrow> ('a::cpo \<times> 'b::cpo)" |
101 fixes S :: "nat \<Rightarrow> ('a::cpo \<times> 'b::cpo)" |
102 assumes S: "chain S" |
102 assumes S: "chain S" |
132 |
132 |
133 instance "*" :: (discrete_cpo, discrete_cpo) discrete_cpo |
133 instance "*" :: (discrete_cpo, discrete_cpo) discrete_cpo |
134 proof |
134 proof |
135 fix x y :: "'a \<times> 'b" |
135 fix x y :: "'a \<times> 'b" |
136 show "x \<sqsubseteq> y \<longleftrightarrow> x = y" |
136 show "x \<sqsubseteq> y \<longleftrightarrow> x = y" |
137 unfolding less_cprod_def Pair_fst_snd_eq |
137 unfolding below_prod_def Pair_fst_snd_eq |
138 by simp |
138 by simp |
139 qed |
139 qed |
140 |
140 |
141 subsection {* Product type is pointed *} |
141 subsection {* Product type is pointed *} |
142 |
142 |
143 lemma minimal_cprod: "(\<bottom>, \<bottom>) \<sqsubseteq> p" |
143 lemma minimal_cprod: "(\<bottom>, \<bottom>) \<sqsubseteq> p" |
144 by (simp add: less_cprod_def) |
144 by (simp add: below_prod_def) |
145 |
145 |
146 instance "*" :: (pcpo, pcpo) pcpo |
146 instance "*" :: (pcpo, pcpo) pcpo |
147 by intro_classes (fast intro: minimal_cprod) |
147 by intro_classes (fast intro: minimal_cprod) |
148 |
148 |
149 lemma inst_cprod_pcpo: "\<bottom> = (\<bottom>, \<bottom>)" |
149 lemma inst_cprod_pcpo: "\<bottom> = (\<bottom>, \<bottom>)" |
255 done |
255 done |
256 qed |
256 qed |
257 |
257 |
258 subsection {* Compactness and chain-finiteness *} |
258 subsection {* Compactness and chain-finiteness *} |
259 |
259 |
260 lemma fst_less_iff: "fst (x::'a \<times> 'b) \<sqsubseteq> y \<longleftrightarrow> x \<sqsubseteq> (y, snd x)" |
260 lemma fst_below_iff: "fst (x::'a \<times> 'b) \<sqsubseteq> y \<longleftrightarrow> x \<sqsubseteq> (y, snd x)" |
261 unfolding less_cprod_def by simp |
261 unfolding below_prod_def by simp |
262 |
262 |
263 lemma snd_less_iff: "snd (x::'a \<times> 'b) \<sqsubseteq> y = x \<sqsubseteq> (fst x, y)" |
263 lemma snd_below_iff: "snd (x::'a \<times> 'b) \<sqsubseteq> y \<longleftrightarrow> x \<sqsubseteq> (fst x, y)" |
264 unfolding less_cprod_def by simp |
264 unfolding below_prod_def by simp |
265 |
265 |
266 lemma compact_fst: "compact x \<Longrightarrow> compact (fst x)" |
266 lemma compact_fst: "compact x \<Longrightarrow> compact (fst x)" |
267 by (rule compactI, simp add: fst_less_iff) |
267 by (rule compactI, simp add: fst_below_iff) |
268 |
268 |
269 lemma compact_snd: "compact x \<Longrightarrow> compact (snd x)" |
269 lemma compact_snd: "compact x \<Longrightarrow> compact (snd x)" |
270 by (rule compactI, simp add: snd_less_iff) |
270 by (rule compactI, simp add: snd_below_iff) |
271 |
271 |
272 lemma compact_Pair: "\<lbrakk>compact x; compact y\<rbrakk> \<Longrightarrow> compact (x, y)" |
272 lemma compact_Pair: "\<lbrakk>compact x; compact y\<rbrakk> \<Longrightarrow> compact (x, y)" |
273 by (rule compactI, simp add: less_cprod_def) |
273 by (rule compactI, simp add: below_prod_def) |
274 |
274 |
275 lemma compact_Pair_iff [simp]: "compact (x, y) \<longleftrightarrow> compact x \<and> compact y" |
275 lemma compact_Pair_iff [simp]: "compact (x, y) \<longleftrightarrow> compact x \<and> compact y" |
276 apply (safe intro!: compact_Pair) |
276 apply (safe intro!: compact_Pair) |
277 apply (drule compact_fst, simp) |
277 apply (drule compact_fst, simp) |
278 apply (drule compact_snd, simp) |
278 apply (drule compact_snd, simp) |