src/HOLCF/Cprod.thy
author huffman
Thu, 17 Jan 2008 00:51:20 +0100
changeset 25921 0ca392ab7f37
parent 25913 e1b6521c1f94
child 26018 9b5b4bd44f7a
permissions -rw-r--r--
change class axiom chfin to rule_format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15600
a59f07556a8d fixed filename in header
huffman
parents: 15593
diff changeset
     1
(*  Title:      HOLCF/Cprod.thy
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     2
    ID:         $Id$
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     3
    Author:     Franz Regensburger
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     4
16070
4a83dd540b88 removed LICENCE note -- everything is subject to Isabelle licence as
wenzelm
parents: 16057
diff changeset
     5
Partial ordering for cartesian product of HOL products.
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     6
*)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     7
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     8
header {* The cpo of cartesian products *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     9
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    10
theory Cprod
25910
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
    11
imports Bifinite
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    13
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    14
defaultsort cpo
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    15
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    16
subsection {* Type @{typ unit} is a pcpo *}
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    17
25907
695a9d88d697 new-style instantiation proof for unit :: po
huffman
parents: 25906
diff changeset
    18
instantiation unit :: po
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    19
begin
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    20
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    21
definition
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    22
  less_unit_def [simp]: "x \<sqsubseteq> (y::unit) \<equiv> True"
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    23
25907
695a9d88d697 new-style instantiation proof for unit :: po
huffman
parents: 25906
diff changeset
    24
instance
695a9d88d697 new-style instantiation proof for unit :: po
huffman
parents: 25906
diff changeset
    25
by intro_classes simp_all
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    26
25907
695a9d88d697 new-style instantiation proof for unit :: po
huffman
parents: 25906
diff changeset
    27
end
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    28
25815
c7b1e7b7087b instance unit :: finite_po
huffman
parents: 25784
diff changeset
    29
instance unit :: finite_po ..
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    30
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    31
instance unit :: pcpo
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    32
by intro_classes simp
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    33
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
    34
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
    35
  unit_when :: "'a \<rightarrow> unit \<rightarrow> 'a" where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
    36
  "unit_when = (\<Lambda> a _. a)"
16008
861a255cf1e7 pcpo instance for type unit
huffman
parents: 15609
diff changeset
    37
18289
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    38
translations
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
    39
  "\<Lambda>(). t" == "CONST unit_when\<cdot>t"
18289
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    40
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    41
lemma unit_when [simp]: "unit_when\<cdot>a\<cdot>u = a"
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    42
by (simp add: unit_when_def)
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    43
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    44
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    45
subsection {* Product type is a partial order *}
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    46
25908
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
    47
instantiation "*" :: (po, po) po
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    48
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    49
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    50
definition
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    51
  less_cprod_def: "(op \<sqsubseteq>) \<equiv> \<lambda>p1 p2. (fst p1 \<sqsubseteq> fst p2 \<and> snd p1 \<sqsubseteq> snd p2)"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    52
25908
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
    53
instance
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    54
proof
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    55
  fix x :: "'a \<times> 'b"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    56
  show "x \<sqsubseteq> x"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    57
    unfolding less_cprod_def by simp
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    58
next
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    59
  fix x y :: "'a \<times> 'b"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    60
  assume "x \<sqsubseteq> y" "y \<sqsubseteq> x" thus "x = y"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    61
    unfolding less_cprod_def Pair_fst_snd_eq
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    62
    by (fast intro: antisym_less)
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    63
next
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    64
  fix x y z :: "'a \<times> 'b"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    65
  assume "x \<sqsubseteq> y" "y \<sqsubseteq> z" thus "x \<sqsubseteq> z"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    66
    unfolding less_cprod_def
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    67
    by (fast intro: trans_less)
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    68
qed
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    69
25908
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
    70
end
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    71
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    72
subsection {* Monotonicity of @{text "(_,_)"}, @{term fst}, @{term snd} *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    73
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    74
text {* Pair @{text "(_,_)"}  is monotone in both arguments *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    75
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    76
lemma monofun_pair1: "monofun (\<lambda>x. (x, y))"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
    77
by (simp add: monofun_def less_cprod_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    78
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    79
lemma monofun_pair2: "monofun (\<lambda>y. (x, y))"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
    80
by (simp add: monofun_def less_cprod_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    81
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    82
lemma monofun_pair:
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    83
  "\<lbrakk>x1 \<sqsubseteq> x2; y1 \<sqsubseteq> y2\<rbrakk> \<Longrightarrow> (x1, y1) \<sqsubseteq> (x2, y2)"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
    84
by (simp add: less_cprod_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    85
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    86
text {* @{term fst} and @{term snd} are monotone *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    87
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    88
lemma monofun_fst: "monofun fst"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
    89
by (simp add: monofun_def less_cprod_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    90
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    91
lemma monofun_snd: "monofun snd"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
    92
by (simp add: monofun_def less_cprod_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    93
18289
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
    94
subsection {* Product type is a cpo *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    95
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    96
lemma lub_cprod:
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    97
  fixes S :: "nat \<Rightarrow> ('a::cpo \<times> 'b::cpo)"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    98
  assumes S: "chain S"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
    99
  shows "range S <<| (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   100
apply (rule is_lubI)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   101
apply (rule ub_rangeI)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   102
apply (rule_tac t = "S i" in surjective_pairing [THEN ssubst])
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   103
apply (rule monofun_pair)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   104
apply (rule is_ub_thelub)
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   105
apply (rule ch2ch_monofun [OF monofun_fst S])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   106
apply (rule is_ub_thelub)
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   107
apply (rule ch2ch_monofun [OF monofun_snd S])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   108
apply (rule_tac t = "u" in surjective_pairing [THEN ssubst])
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   109
apply (rule monofun_pair)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   110
apply (rule is_lub_thelub)
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   111
apply (rule ch2ch_monofun [OF monofun_fst S])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   112
apply (erule monofun_fst [THEN ub2ub_monofun])
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   113
apply (rule is_lub_thelub)
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   114
apply (rule ch2ch_monofun [OF monofun_snd S])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   115
apply (erule monofun_snd [THEN ub2ub_monofun])
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   116
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   117
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   118
lemma thelub_cprod:
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   119
  "chain (S::nat \<Rightarrow> 'a::cpo \<times> 'b::cpo)
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   120
    \<Longrightarrow> lub (range S) = (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   121
by (rule lub_cprod [THEN thelubI])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   122
25784
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   123
instance "*" :: (cpo, cpo) cpo
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   124
proof
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   125
  fix S :: "nat \<Rightarrow> ('a \<times> 'b)"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   126
  assume "chain S"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   127
  hence "range S <<| (\<Squnion>i. fst (S i), \<Squnion>i. snd (S i))"
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   128
    by (rule lub_cprod)
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   129
  thus "\<exists>x. range S <<| x" ..
71157f7e671e update instance proofs for sq_ord, po; new instance proofs for dcpo
huffman
parents: 25131
diff changeset
   130
qed
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   131
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25815
diff changeset
   132
instance "*" :: (finite_po, finite_po) finite_po ..
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25815
diff changeset
   133
18289
56ddf617d6e8 add constant unit_when
huffman
parents: 18078
diff changeset
   134
subsection {* Product type is pointed *}
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   135
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   136
lemma minimal_cprod: "(\<bottom>, \<bottom>) \<sqsubseteq> p"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   137
by (simp add: less_cprod_def)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   138
25908
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
   139
instance "*" :: (pcpo, pcpo) pcpo
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
   140
by intro_classes (fast intro: minimal_cprod)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   141
25908
d8ce142f7e6e cleaned up instance proofs
huffman
parents: 25907
diff changeset
   142
lemma inst_cprod_pcpo: "\<bottom> = (\<bottom>, \<bottom>)"
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   143
by (rule minimal_cprod [THEN UU_I, symmetric])
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   144
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   145
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   146
subsection {* Continuity of @{text "(_,_)"}, @{term fst}, @{term snd} *}
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   147
16916
da331e0a4a81 add theorem cpair_defined_iff
huffman
parents: 16750
diff changeset
   148
lemma contlub_pair1: "contlub (\<lambda>x. (x, y))"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   149
apply (rule contlubI)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   150
apply (subst thelub_cprod)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   151
apply (erule monofun_pair1 [THEN ch2ch_monofun])
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   152
apply simp
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   153
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   154
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   155
lemma contlub_pair2: "contlub (\<lambda>y. (x, y))"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   156
apply (rule contlubI)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   157
apply (subst thelub_cprod)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   158
apply (erule monofun_pair2 [THEN ch2ch_monofun])
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   159
apply simp
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   160
done
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   161
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   162
lemma cont_pair1: "cont (\<lambda>x. (x, y))"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   163
apply (rule monocontlub2cont)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   164
apply (rule monofun_pair1)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   165
apply (rule contlub_pair1)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   166
done
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   167
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   168
lemma cont_pair2: "cont (\<lambda>y. (x, y))"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   169
apply (rule monocontlub2cont)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   170
apply (rule monofun_pair2)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   171
apply (rule contlub_pair2)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   172
done
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   173
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   174
lemma contlub_fst: "contlub fst"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   175
apply (rule contlubI)
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   176
apply (simp add: thelub_cprod)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   177
done
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   178
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   179
lemma contlub_snd: "contlub snd"
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   180
apply (rule contlubI)
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   181
apply (simp add: thelub_cprod)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   182
done
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   183
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   184
lemma cont_fst: "cont fst"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   185
apply (rule monocontlub2cont)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   186
apply (rule monofun_fst)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   187
apply (rule contlub_fst)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   188
done
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   189
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   190
lemma cont_snd: "cont snd"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   191
apply (rule monocontlub2cont)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   192
apply (rule monofun_snd)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   193
apply (rule contlub_snd)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   194
done
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   195
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   196
subsection {* Continuous versions of constants *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   197
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   198
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   199
  cpair :: "'a \<rightarrow> 'b \<rightarrow> ('a * 'b)"  -- {* continuous pairing *}  where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   200
  "cpair = (\<Lambda> x y. (x, y))"
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   201
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   202
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   203
  cfst :: "('a * 'b) \<rightarrow> 'a" where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   204
  "cfst = (\<Lambda> p. fst p)"
17834
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   205
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   206
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   207
  csnd :: "('a * 'b) \<rightarrow> 'b" where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   208
  "csnd = (\<Lambda> p. snd p)"      
17834
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   209
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   210
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   211
  csplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a * 'b) \<rightarrow> 'c" where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   212
  "csplit = (\<Lambda> f p. f\<cdot>(cfst\<cdot>p)\<cdot>(csnd\<cdot>p))"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   213
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   214
syntax
17834
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   215
  "_ctuple" :: "['a, args] \<Rightarrow> 'a * 'b"  ("(1<_,/ _>)")
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   216
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   217
syntax (xsymbols)
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   218
  "_ctuple" :: "['a, args] \<Rightarrow> 'a * 'b"  ("(1\<langle>_,/ _\<rangle>)")
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   219
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   220
translations
18078
20e5a6440790 change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents: 18077
diff changeset
   221
  "\<langle>x, y, z\<rangle>" == "\<langle>x, \<langle>y, z\<rangle>\<rangle>"
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   222
  "\<langle>x, y\<rangle>"    == "CONST cpair\<cdot>x\<cdot>y"
17834
28414668b43d added xsymbols syntax for pairs; cleaned up
huffman
parents: 17816
diff changeset
   223
17816
9942c5ed866a new syntax translations for continuous lambda abstraction
huffman
parents: 16916
diff changeset
   224
translations
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 18289
diff changeset
   225
  "\<Lambda>(CONST cpair\<cdot>x\<cdot>y). t" == "CONST csplit\<cdot>(\<Lambda> x y. t)"
17816
9942c5ed866a new syntax translations for continuous lambda abstraction
huffman
parents: 16916
diff changeset
   226
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   227
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   228
subsection {* Convert all lemmas to the continuous versions *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   229
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   230
lemma cpair_eq_pair: "<x, y> = (x, y)"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   231
by (simp add: cpair_def cont_pair1 cont_pair2)
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   232
25910
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   233
lemma pair_eq_cpair: "(x, y) = <x, y>"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   234
by (simp add: cpair_def cont_pair1 cont_pair2)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   235
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   236
lemma inject_cpair: "<a,b> = <aa,ba> \<Longrightarrow> a = aa \<and> b = ba"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   237
by (simp add: cpair_eq_pair)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   238
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   239
lemma cpair_eq [iff]: "(<a, b> = <a', b'>) = (a = a' \<and> b = b')"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   240
by (simp add: cpair_eq_pair)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   241
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   242
lemma cpair_less [iff]: "(<a, b> \<sqsubseteq> <a', b'>) = (a \<sqsubseteq> a' \<and> b \<sqsubseteq> b')"
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   243
by (simp add: cpair_eq_pair less_cprod_def)
16057
e23a61b3406f added lemma cpair_eq, made cfst_strict and csnd_strict into simp rules
huffman
parents: 16008
diff changeset
   244
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   245
lemma cpair_defined_iff [iff]: "(<x, y> = \<bottom>) = (x = \<bottom> \<and> y = \<bottom>)"
16916
da331e0a4a81 add theorem cpair_defined_iff
huffman
parents: 16750
diff changeset
   246
by (simp add: inst_cprod_pcpo cpair_eq_pair)
da331e0a4a81 add theorem cpair_defined_iff
huffman
parents: 16750
diff changeset
   247
25913
e1b6521c1f94 declare cpair_strict [simp]
huffman
parents: 25910
diff changeset
   248
lemma cpair_strict [simp]: "\<langle>\<bottom>, \<bottom>\<rangle> = \<bottom>"
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   249
by simp
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   250
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   251
lemma inst_cprod_pcpo2: "\<bottom> = <\<bottom>, \<bottom>>"
16916
da331e0a4a81 add theorem cpair_defined_iff
huffman
parents: 16750
diff changeset
   252
by (rule cpair_strict [symmetric])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   253
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   254
lemma defined_cpair_rev: 
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   255
 "<a,b> = \<bottom> \<Longrightarrow> a = \<bottom> \<and> b = \<bottom>"
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   256
by simp
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   257
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   258
lemma Exh_Cprod2: "\<exists>a b. z = <a, b>"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   259
by (simp add: cpair_eq_pair)
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   260
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   261
lemma cprodE: "\<lbrakk>\<And>x y. p = <x, y> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   262
by (cut_tac Exh_Cprod2, auto)
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   263
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   264
lemma cfst_cpair [simp]: "cfst\<cdot><x, y> = x"
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   265
by (simp add: cpair_eq_pair cfst_def cont_fst)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   266
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   267
lemma csnd_cpair [simp]: "csnd\<cdot><x, y> = y"
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   268
by (simp add: cpair_eq_pair csnd_def cont_snd)
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   269
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   270
lemma cfst_strict [simp]: "cfst\<cdot>\<bottom> = \<bottom>"
25913
e1b6521c1f94 declare cpair_strict [simp]
huffman
parents: 25910
diff changeset
   271
unfolding inst_cprod_pcpo2 by (rule cfst_cpair)
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   272
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   273
lemma csnd_strict [simp]: "csnd\<cdot>\<bottom> = \<bottom>"
25913
e1b6521c1f94 declare cpair_strict [simp]
huffman
parents: 25910
diff changeset
   274
unfolding inst_cprod_pcpo2 by (rule csnd_cpair)
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   275
25910
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   276
lemma cpair_cfst_csnd: "\<langle>cfst\<cdot>p, csnd\<cdot>p\<rangle> = p"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   277
by (cases p rule: cprodE, simp)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   278
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   279
lemmas surjective_pairing_Cprod2 = cpair_cfst_csnd
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   280
16750
282d092b1dbd add lemma eq_cprod
huffman
parents: 16553
diff changeset
   281
lemma less_cprod: "x \<sqsubseteq> y = (cfst\<cdot>x \<sqsubseteq> cfst\<cdot>y \<and> csnd\<cdot>x \<sqsubseteq> csnd\<cdot>y)"
16315
bfb2f513916a added theorem less_cprod
huffman
parents: 16210
diff changeset
   282
by (simp add: less_cprod_def cfst_def csnd_def cont_fst cont_snd)
bfb2f513916a added theorem less_cprod
huffman
parents: 16210
diff changeset
   283
16750
282d092b1dbd add lemma eq_cprod
huffman
parents: 16553
diff changeset
   284
lemma eq_cprod: "(x = y) = (cfst\<cdot>x = cfst\<cdot>y \<and> csnd\<cdot>x = csnd\<cdot>y)"
282d092b1dbd add lemma eq_cprod
huffman
parents: 16553
diff changeset
   285
by (auto simp add: po_eq_conv less_cprod)
282d092b1dbd add lemma eq_cprod
huffman
parents: 16553
diff changeset
   286
25879
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   287
lemma cfst_less_iff: "cfst\<cdot>x \<sqsubseteq> y = x \<sqsubseteq> <y, csnd\<cdot>x>"
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   288
by (simp add: less_cprod)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   289
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   290
lemma csnd_less_iff: "csnd\<cdot>x \<sqsubseteq> y = x \<sqsubseteq> <cfst\<cdot>x, y>"
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   291
by (simp add: less_cprod)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   292
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   293
lemma compact_cfst: "compact x \<Longrightarrow> compact (cfst\<cdot>x)"
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   294
by (rule compactI, simp add: cfst_less_iff)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   295
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   296
lemma compact_csnd: "compact x \<Longrightarrow> compact (csnd\<cdot>x)"
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   297
by (rule compactI, simp add: csnd_less_iff)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   298
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   299
lemma compact_cpair: "\<lbrakk>compact x; compact y\<rbrakk> \<Longrightarrow> compact <x, y>"
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17834
diff changeset
   300
by (rule compactI, simp add: less_cprod)
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17834
diff changeset
   301
25879
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   302
lemma compact_cpair_iff [simp]: "compact <x, y> = (compact x \<and> compact y)"
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   303
apply (safe intro!: compact_cpair)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   304
apply (drule compact_cfst, simp)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   305
apply (drule compact_csnd, simp)
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   306
done
98b93782c3b1 new compactness lemmas
huffman
parents: 25827
diff changeset
   307
25905
098469c6c351 simplified chfin instance proof
huffman
parents: 25879
diff changeset
   308
instance "*" :: (chfin, chfin) chfin
25921
0ca392ab7f37 change class axiom chfin to rule_format
huffman
parents: 25913
diff changeset
   309
apply intro_classes
25905
098469c6c351 simplified chfin instance proof
huffman
parents: 25879
diff changeset
   310
apply (erule compact_imp_max_in_chain)
098469c6c351 simplified chfin instance proof
huffman
parents: 25879
diff changeset
   311
apply (rule_tac p="\<Squnion>i. Y i" in cprodE, simp)
098469c6c351 simplified chfin instance proof
huffman
parents: 25879
diff changeset
   312
done
098469c6c351 simplified chfin instance proof
huffman
parents: 25879
diff changeset
   313
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   314
lemma lub_cprod2: 
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   315
  "chain S \<Longrightarrow> range S <<| <\<Squnion>i. cfst\<cdot>(S i), \<Squnion>i. csnd\<cdot>(S i)>"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   316
apply (simp add: cpair_eq_pair cfst_def csnd_def cont_fst cont_snd)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   317
apply (erule lub_cprod)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   318
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   319
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   320
lemma thelub_cprod2:
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   321
  "chain S \<Longrightarrow> lub (range S) = <\<Squnion>i. cfst\<cdot>(S i), \<Squnion>i. csnd\<cdot>(S i)>"
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   322
by (rule lub_cprod2 [THEN thelubI])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   323
18077
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   324
lemma csplit1 [simp]: "csplit\<cdot>f\<cdot>\<bottom> = f\<cdot>\<bottom>\<cdot>\<bottom>"
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   325
by (simp add: csplit_def)
f1f4f951ec8d make cpair_less, cpair_defined_iff into iff rules; add lemma csplit1
huffman
parents: 17837
diff changeset
   326
16081
81a4b4a245b0 cleaned up, added cpair_less and cpair_eq_pair, removed some obsolete stuff
huffman
parents: 16070
diff changeset
   327
lemma csplit2 [simp]: "csplit\<cdot>f\<cdot><x,y> = f\<cdot>x\<cdot>y"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   328
by (simp add: csplit_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   329
16553
aa36d41e4263 add csplit3, ssplit3, fup3 as simp rules
huffman
parents: 16315
diff changeset
   330
lemma csplit3 [simp]: "csplit\<cdot>cpair\<cdot>z = z"
25910
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   331
by (simp add: csplit_def cpair_cfst_csnd)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   332
16210
5d1b752cacc1 changed to use new contlubI, monofun_def; renamed cfst2, csnd2 to cfst_cpair, csnd_cpair; added lemma cpair_strict
huffman
parents: 16093
diff changeset
   333
lemmas Cprod_rews = cfst_cpair csnd_cpair csplit2
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   334
25910
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   335
subsection {* Product type is a bifinite domain *}
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   336
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   337
instance "*" :: (bifinite_cpo, bifinite_cpo) approx ..
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   338
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   339
defs (overloaded)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   340
  approx_cprod_def:
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   341
    "approx \<equiv> \<lambda>n. \<Lambda>\<langle>x, y\<rangle>. \<langle>approx n\<cdot>x, approx n\<cdot>y\<rangle>"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   342
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   343
instance "*" :: (bifinite_cpo, bifinite_cpo) bifinite_cpo
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   344
proof
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   345
  fix i :: nat and x :: "'a \<times> 'b"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   346
  show "chain (\<lambda>i. approx i\<cdot>x)"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   347
    unfolding approx_cprod_def by simp
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   348
  show "(\<Squnion>i. approx i\<cdot>x) = x"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   349
    unfolding approx_cprod_def
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   350
    by (simp add: lub_distribs eta_cfun)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   351
  show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   352
    unfolding approx_cprod_def csplit_def by simp
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   353
  have "{x::'a \<times> 'b. approx i\<cdot>x = x} \<subseteq>
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   354
        {x::'a. approx i\<cdot>x = x} \<times> {x::'b. approx i\<cdot>x = x}"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   355
    unfolding approx_cprod_def
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   356
    by (clarsimp simp add: pair_eq_cpair)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   357
  thus "finite {x::'a \<times> 'b. approx i\<cdot>x = x}"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   358
    by (rule finite_subset,
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   359
        intro finite_cartesian_product finite_fixes_approx)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   360
qed
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   361
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   362
instance "*" :: (bifinite, bifinite) bifinite ..
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   363
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   364
lemma approx_cpair [simp]:
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   365
  "approx i\<cdot>\<langle>x, y\<rangle> = \<langle>approx i\<cdot>x, approx i\<cdot>y\<rangle>"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   366
unfolding approx_cprod_def by simp
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   367
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   368
lemma cfst_approx: "cfst\<cdot>(approx i\<cdot>p) = approx i\<cdot>(cfst\<cdot>p)"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   369
by (cases p rule: cprodE, simp)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   370
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   371
lemma csnd_approx: "csnd\<cdot>(approx i\<cdot>p) = approx i\<cdot>(csnd\<cdot>p)"
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   372
by (cases p rule: cprodE, simp)
25533eb2b914 add bifinite instances
huffman
parents: 25908
diff changeset
   373
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   374
end