src/HOL/HOLCF/ConvexPD.thy
author wenzelm
Thu, 18 Apr 2024 13:06:48 +0200
changeset 80136 12ce957231e0
parent 67682 00c436488398
permissions -rw-r--r--
back to post-release mode -- after fork point;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42151
4da4fc77664b tuned headers;
wenzelm
parents: 41479
diff changeset
     1
(*  Title:      HOL/HOLCF/ConvexPD.thy
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     3
*)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     4
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
     5
section \<open>Convex powerdomain\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     6
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
theory ConvexPD
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     8
imports UpperPD LowerPD
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     9
begin
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    10
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
    11
subsection \<open>Basis preorder\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    12
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    13
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    14
  convex_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<natural>" 50) where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    15
  "convex_le = (\<lambda>u v. u \<le>\<sharp> v \<and> u \<le>\<flat> v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    16
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    17
lemma convex_le_refl [simp]: "t \<le>\<natural> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    18
unfolding convex_le_def by (fast intro: upper_le_refl lower_le_refl)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    19
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    20
lemma convex_le_trans: "\<lbrakk>t \<le>\<natural> u; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> t \<le>\<natural> v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    21
unfolding convex_le_def by (fast intro: upper_le_trans lower_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    22
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29990
diff changeset
    23
interpretation convex_le: preorder convex_le
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    24
by (rule preorder.intro, rule convex_le_refl, rule convex_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    25
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    26
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<natural> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    27
unfolding convex_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    28
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    29
lemma PDUnit_convex_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    30
unfolding convex_le_def by (fast intro: PDUnit_upper_mono PDUnit_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
lemma PDPlus_convex_mono: "\<lbrakk>s \<le>\<natural> t; u \<le>\<natural> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<natural> PDPlus t v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
unfolding convex_le_def by (fast intro: PDPlus_upper_mono PDPlus_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    34
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    35
lemma convex_le_PDUnit_PDUnit_iff [simp]:
40436
adb22dbb5242 (infixl "<<" 55) -> (infix "<<" 50)
huffman
parents: 40433
diff changeset
    36
  "(PDUnit a \<le>\<natural> PDUnit b) = (a \<sqsubseteq> b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    37
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    39
lemma convex_le_PDUnit_lemma1:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    40
  "(PDUnit a \<le>\<natural> t) = (\<forall>b\<in>Rep_pd_basis t. a \<sqsubseteq> b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    41
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    42
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    43
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    44
lemma convex_le_PDUnit_PDPlus_iff [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    45
  "(PDUnit a \<le>\<natural> PDPlus t u) = (PDUnit a \<le>\<natural> t \<and> PDUnit a \<le>\<natural> u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    46
unfolding convex_le_PDUnit_lemma1 Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    47
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
lemma convex_le_PDUnit_lemma2:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    49
  "(t \<le>\<natural> PDUnit b) = (\<forall>a\<in>Rep_pd_basis t. a \<sqsubseteq> b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    50
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    51
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    52
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    53
lemma convex_le_PDPlus_PDUnit_iff [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
  "(PDPlus t u \<le>\<natural> PDUnit a) = (t \<le>\<natural> PDUnit a \<and> u \<le>\<natural> PDUnit a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    55
unfolding convex_le_PDUnit_lemma2 Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    56
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    57
lemma convex_le_PDPlus_lemma:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    58
  assumes z: "PDPlus t u \<le>\<natural> z"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    59
  shows "\<exists>v w. z = PDPlus v w \<and> t \<le>\<natural> v \<and> u \<le>\<natural> w"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    60
proof (intro exI conjI)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    61
  let ?A = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis t. a \<sqsubseteq> b}"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    62
  let ?B = "{b\<in>Rep_pd_basis z. \<exists>a\<in>Rep_pd_basis u. a \<sqsubseteq> b}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    63
  let ?v = "Abs_pd_basis ?A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    64
  let ?w = "Abs_pd_basis ?B"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    65
  have Rep_v: "Rep_pd_basis ?v = ?A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    66
    apply (rule Abs_pd_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    67
    apply (rule Rep_pd_basis_nonempty [of t, folded ex_in_conv, THEN exE])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    68
    apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    69
    apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    70
    apply (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    71
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    72
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    73
  have Rep_w: "Rep_pd_basis ?w = ?B"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    74
    apply (rule Abs_pd_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    75
    apply (rule Rep_pd_basis_nonempty [of u, folded ex_in_conv, THEN exE])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    76
    apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    77
    apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    78
    apply (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    79
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    80
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    81
  show "z = PDPlus ?v ?w"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    82
    apply (insert z)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    83
    apply (simp add: convex_le_def, erule conjE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    84
    apply (simp add: Rep_pd_basis_inject [symmetric] Rep_PDPlus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    85
    apply (simp add: Rep_v Rep_w)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    86
    apply (rule equalityI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    87
     apply (rule subsetI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    88
     apply (simp only: upper_le_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    89
     apply (drule (1) bspec, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    90
     apply (simp add: Rep_PDPlus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    91
     apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    92
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    93
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    94
  show "t \<le>\<natural> ?v" "u \<le>\<natural> ?w"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    95
   apply (insert z)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    96
   apply (simp_all add: convex_le_def upper_le_def lower_le_def Rep_PDPlus Rep_v Rep_w)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    97
   apply fast+
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    98
   done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    99
qed
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   100
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   101
lemma convex_le_induct [induct set: convex_le]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   102
  assumes le: "t \<le>\<natural> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   103
  assumes 2: "\<And>t u v. \<lbrakk>P t u; P u v\<rbrakk> \<Longrightarrow> P t v"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   104
  assumes 3: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   105
  assumes 4: "\<And>t u v w. \<lbrakk>P t v; P u w\<rbrakk> \<Longrightarrow> P (PDPlus t u) (PDPlus v w)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   106
  shows "P t u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   107
using le apply (induct t arbitrary: u rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   108
apply (erule rev_mp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   109
apply (induct_tac u rule: pd_basis_induct1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   110
apply (simp add: 3)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   111
apply (simp, clarify, rename_tac a b t)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   112
apply (subgoal_tac "P (PDPlus (PDUnit a) (PDUnit a)) (PDPlus (PDUnit b) t)")
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   113
apply (simp add: PDPlus_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   114
apply (erule (1) 4 [OF 3])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   115
apply (drule convex_le_PDPlus_lemma, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   116
apply (simp add: 4)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   117
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   118
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   119
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   120
subsection \<open>Type definition\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   121
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61169
diff changeset
   122
typedef 'a convex_pd  ("('(_')\<natural>)") =
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   123
  "{S::'a pd_basis set. convex_le.ideal S}"
40888
28cd51cff70c reformulate lemma preorder.ex_ideal, and use it for typedefs
huffman
parents: 40774
diff changeset
   124
by (rule convex_le.ex_ideal)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   125
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   126
instantiation convex_pd :: (bifinite) below
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   127
begin
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   128
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   129
definition
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   130
  "x \<sqsubseteq> y \<longleftrightarrow> Rep_convex_pd x \<subseteq> Rep_convex_pd y"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   131
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   132
instance ..
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   133
end
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   135
instance convex_pd :: (bifinite) po
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   136
using type_definition_convex_pd below_convex_pd_def
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   137
by (rule convex_le.typedef_ideal_po)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   138
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   139
instance convex_pd :: (bifinite) cpo
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   140
using type_definition_convex_pd below_convex_pd_def
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   141
by (rule convex_le.typedef_ideal_cpo)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   142
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   143
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   144
  convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   145
  "convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   146
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29990
diff changeset
   147
interpretation convex_pd:
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   148
  ideal_completion convex_le convex_principal Rep_convex_pd
39984
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   149
using type_definition_convex_pd below_convex_pd_def
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   150
using convex_principal_def pd_basis_countable
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   151
by (rule convex_le.typedef_ideal_completion)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   152
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   153
text \<open>Convex powerdomain is pointed\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   154
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   155
lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   156
by (induct ys rule: convex_pd.principal_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   157
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   158
instance convex_pd :: (bifinite) pcpo
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   159
by intro_classes (fast intro: convex_pd_minimal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   160
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   161
lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)"
41430
1aa23e9f2c87 change some lemma names containing 'UU' to 'bottom'
huffman
parents: 41402
diff changeset
   162
by (rule convex_pd_minimal [THEN bottomI, symmetric])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   163
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   164
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   165
subsection \<open>Monadic unit and plus\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   166
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   167
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   168
  convex_unit :: "'a \<rightarrow> 'a convex_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   169
  "convex_unit = compact_basis.extension (\<lambda>a. convex_principal (PDUnit a))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   170
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   171
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   172
  convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   173
  "convex_plus = convex_pd.extension (\<lambda>t. convex_pd.extension (\<lambda>u.
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   174
      convex_principal (PDPlus t u)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   175
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   176
abbreviation
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   177
  convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   178
    (infixl "\<union>\<natural>" 65) where
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   179
  "xs \<union>\<natural> ys == convex_plus\<cdot>xs\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   180
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   181
syntax
41479
655f583840d0 use proper syntactic types for 'syntax' commands
huffman
parents: 41430
diff changeset
   182
  "_convex_pd" :: "args \<Rightarrow> logic" ("{_}\<natural>")
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   183
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   184
translations
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   185
  "{x,xs}\<natural>" == "{x}\<natural> \<union>\<natural> {xs}\<natural>"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   186
  "{x}\<natural>" == "CONST convex_unit\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   187
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   188
lemma convex_unit_Rep_compact_basis [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   189
  "{Rep_compact_basis a}\<natural> = convex_principal (PDUnit a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   190
unfolding convex_unit_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   191
by (simp add: compact_basis.extension_principal PDUnit_convex_mono)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   192
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   193
lemma convex_plus_principal [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   194
  "convex_principal t \<union>\<natural> convex_principal u = convex_principal (PDPlus t u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   195
unfolding convex_plus_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   196
by (simp add: convex_pd.extension_principal
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   197
    convex_pd.extension_mono PDPlus_convex_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   198
37770
cddb3106adb8 avoid explicit mandatory prefix markers when prefixes are mandatory implicitly
haftmann
parents: 36635
diff changeset
   199
interpretation convex_add: semilattice convex_add proof
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   200
  fix xs ys zs :: "'a convex_pd"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   201
  show "(xs \<union>\<natural> ys) \<union>\<natural> zs = xs \<union>\<natural> (ys \<union>\<natural> zs)"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   202
    apply (induct xs rule: convex_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   203
    apply (induct ys rule: convex_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   204
    apply (induct zs rule: convex_pd.principal_induct, simp)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   205
    apply (simp add: PDPlus_assoc)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   206
    done
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   207
  show "xs \<union>\<natural> ys = ys \<union>\<natural> xs"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   208
    apply (induct xs rule: convex_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   209
    apply (induct ys rule: convex_pd.principal_induct, simp)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   210
    apply (simp add: PDPlus_commute)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   211
    done
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   212
  show "xs \<union>\<natural> xs = xs"
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   213
    apply (induct xs rule: convex_pd.principal_induct, simp)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   214
    apply (simp add: PDPlus_absorb)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   215
    done
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   216
qed
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   217
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   218
lemmas convex_plus_assoc = convex_add.assoc
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   219
lemmas convex_plus_commute = convex_add.commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   220
lemmas convex_plus_absorb = convex_add.idem
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   221
lemmas convex_plus_left_commute = convex_add.left_commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   222
lemmas convex_plus_left_absorb = convex_add.left_idem
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   223
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   224
text \<open>Useful for \<open>simp add: convex_plus_ac\<close>\<close>
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   225
lemmas convex_plus_ac =
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   226
  convex_plus_assoc convex_plus_commute convex_plus_left_commute
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   227
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   228
text \<open>Useful for \<open>simp only: convex_plus_aci\<close>\<close>
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   229
lemmas convex_plus_aci =
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   230
  convex_plus_ac convex_plus_absorb convex_plus_left_absorb
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   231
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   232
lemma convex_unit_below_plus_iff [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   233
  "{x}\<natural> \<sqsubseteq> ys \<union>\<natural> zs \<longleftrightarrow> {x}\<natural> \<sqsubseteq> ys \<and> {x}\<natural> \<sqsubseteq> zs"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   234
apply (induct x rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   235
apply (induct ys rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   236
apply (induct zs rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   237
apply simp
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   238
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   239
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   240
lemma convex_plus_below_unit_iff [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   241
  "xs \<union>\<natural> ys \<sqsubseteq> {z}\<natural> \<longleftrightarrow> xs \<sqsubseteq> {z}\<natural> \<and> ys \<sqsubseteq> {z}\<natural>"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   242
apply (induct xs rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   243
apply (induct ys rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   244
apply (induct z rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   245
apply simp
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   246
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   247
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   248
lemma convex_unit_below_iff [simp]: "{x}\<natural> \<sqsubseteq> {y}\<natural> \<longleftrightarrow> x \<sqsubseteq> y"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   249
apply (induct x rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   250
apply (induct y rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   251
apply simp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   252
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   253
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   254
lemma convex_unit_eq_iff [simp]: "{x}\<natural> = {y}\<natural> \<longleftrightarrow> x = y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   255
unfolding po_eq_conv by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   256
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   257
lemma convex_unit_strict [simp]: "{\<bottom>}\<natural> = \<bottom>"
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   258
using convex_unit_Rep_compact_basis [of compact_bot]
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   259
by (simp add: inst_convex_pd_pcpo)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   260
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40002
diff changeset
   261
lemma convex_unit_bottom_iff [simp]: "{x}\<natural> = \<bottom> \<longleftrightarrow> x = \<bottom>"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   262
unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   263
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   264
lemma compact_convex_unit: "compact x \<Longrightarrow> compact {x}\<natural>"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   265
by (auto dest!: compact_basis.compact_imp_principal)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   266
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   267
lemma compact_convex_unit_iff [simp]: "compact {x}\<natural> \<longleftrightarrow> compact x"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   268
apply (safe elim!: compact_convex_unit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   269
apply (simp only: compact_def convex_unit_below_iff [symmetric])
40327
1dfdbd66093a renamed {Rep,Abs}_CFun to {Rep,Abs}_cfun
huffman
parents: 40321
diff changeset
   270
apply (erule adm_subst [OF cont_Rep_cfun2])
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   271
done
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   272
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   273
lemma compact_convex_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   274
  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs \<union>\<natural> ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   275
by (auto dest!: convex_pd.compact_imp_principal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   276
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   277
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   278
subsection \<open>Induction rules\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   279
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   280
lemma convex_pd_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   281
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   282
  assumes unit: "\<And>x. P {x}\<natural>"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   283
  assumes insert: "\<And>x ys. \<lbrakk>P {x}\<natural>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<natural> \<union>\<natural> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   284
  shows "P (xs::'a convex_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   285
apply (induct xs rule: convex_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   286
apply (induct_tac a rule: pd_basis_induct1)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   287
apply (simp only: convex_unit_Rep_compact_basis [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   288
apply (rule unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   289
apply (simp only: convex_unit_Rep_compact_basis [symmetric]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   290
                  convex_plus_principal [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   291
apply (erule insert [OF unit])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   292
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   293
40576
fa5e0cacd5e7 declare {upper,lower,convex}_pd_induct as default induction rules
huffman
parents: 40497
diff changeset
   294
lemma convex_pd_induct
fa5e0cacd5e7 declare {upper,lower,convex}_pd_induct as default induction rules
huffman
parents: 40497
diff changeset
   295
  [case_names adm convex_unit convex_plus, induct type: convex_pd]:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   296
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   297
  assumes unit: "\<And>x. P {x}\<natural>"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   298
  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs \<union>\<natural> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   299
  shows "P (xs::'a convex_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   300
apply (induct xs rule: convex_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   301
apply (induct_tac a rule: pd_basis_induct)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   302
apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   303
apply (simp only: convex_plus_principal [symmetric] plus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   304
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   305
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   306
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   307
subsection \<open>Monadic bind\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   308
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   309
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   310
  convex_bind_basis ::
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   311
  "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   312
  "convex_bind_basis = fold_pd
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   313
    (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   314
    (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<natural> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   315
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   316
lemma ACI_convex_bind:
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 49834
diff changeset
   317
  "semilattice (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<natural> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   318
apply unfold_locales
26041
c2e15e65165f locales ACf, ACIf, ACIfSL and ACIfSLlin have been abandoned in favour of the existing algebraic classes ab_semigroup_mult, ab_semigroup_idem_mult, lower_semilattice (resp. uper_semilattice) and linorder
haftmann
parents: 25925
diff changeset
   319
apply (simp add: convex_plus_assoc)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   320
apply (simp add: convex_plus_commute)
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   321
apply (simp add: eta_cfun)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   322
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   323
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   324
lemma convex_bind_basis_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   325
  "convex_bind_basis (PDUnit a) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   326
    (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   327
  "convex_bind_basis (PDPlus t u) =
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   328
    (\<Lambda> f. convex_bind_basis t\<cdot>f \<union>\<natural> convex_bind_basis u\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   329
unfolding convex_bind_basis_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   330
apply -
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   331
apply (rule fold_pd_PDUnit [OF ACI_convex_bind])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   332
apply (rule fold_pd_PDPlus [OF ACI_convex_bind])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   333
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   334
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   335
lemma convex_bind_basis_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   336
  "t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   337
apply (erule convex_le_induct)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   338
apply (erule (1) below_trans)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   339
apply (simp add: monofun_LAM monofun_cfun)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   340
apply (simp add: monofun_LAM monofun_cfun)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   341
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   342
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   343
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   344
  convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   345
  "convex_bind = convex_pd.extension convex_bind_basis"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   346
41036
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   347
syntax
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   348
  "_convex_bind" :: "[logic, logic, logic] \<Rightarrow> logic"
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   349
    ("(3\<Union>\<natural>_\<in>_./ _)" [0, 0, 10] 10)
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   350
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   351
translations
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   352
  "\<Union>\<natural>x\<in>xs. e" == "CONST convex_bind\<cdot>xs\<cdot>(\<Lambda> x. e)"
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   353
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   354
lemma convex_bind_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   355
  "convex_bind\<cdot>(convex_principal t) = convex_bind_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   356
unfolding convex_bind_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   357
apply (rule convex_pd.extension_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   358
apply (erule convex_bind_basis_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   359
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   360
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   361
lemma convex_bind_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   362
  "convex_bind\<cdot>{x}\<natural>\<cdot>f = f\<cdot>x"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   363
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   364
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   365
lemma convex_bind_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   366
  "convex_bind\<cdot>(xs \<union>\<natural> ys)\<cdot>f = convex_bind\<cdot>xs\<cdot>f \<union>\<natural> convex_bind\<cdot>ys\<cdot>f"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   367
by (induct xs rule: convex_pd.principal_induct, simp,
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   368
    induct ys rule: convex_pd.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   369
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   370
lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   371
unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   372
40589
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   373
lemma convex_bind_bind:
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   374
  "convex_bind\<cdot>(convex_bind\<cdot>xs\<cdot>f)\<cdot>g =
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   375
    convex_bind\<cdot>xs\<cdot>(\<Lambda> x. convex_bind\<cdot>(f\<cdot>x)\<cdot>g)"
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   376
by (induct xs, simp_all)
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   377
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   378
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   379
subsection \<open>Map\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   380
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   381
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   382
  convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   383
  "convex_map = (\<Lambda> f xs. convex_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<natural>))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   384
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   385
lemma convex_map_unit [simp]:
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   386
  "convex_map\<cdot>f\<cdot>{x}\<natural> = {f\<cdot>x}\<natural>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   387
unfolding convex_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   388
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   389
lemma convex_map_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   390
  "convex_map\<cdot>f\<cdot>(xs \<union>\<natural> ys) = convex_map\<cdot>f\<cdot>xs \<union>\<natural> convex_map\<cdot>f\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   391
unfolding convex_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   392
40577
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   393
lemma convex_map_bottom [simp]: "convex_map\<cdot>f\<cdot>\<bottom> = {f\<cdot>\<bottom>}\<natural>"
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   394
unfolding convex_map_def by simp
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   395
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   396
lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   397
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
33808
31169fdc5ae7 add map_ID lemmas
huffman
parents: 33585
diff changeset
   399
lemma convex_map_ID: "convex_map\<cdot>ID = ID"
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 39989
diff changeset
   400
by (simp add: cfun_eq_iff ID_def convex_map_ident)
33808
31169fdc5ae7 add map_ID lemmas
huffman
parents: 33585
diff changeset
   401
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   402
lemma convex_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   403
  "convex_map\<cdot>f\<cdot>(convex_map\<cdot>g\<cdot>xs) = convex_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   404
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   405
41110
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   406
lemma convex_bind_map:
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   407
  "convex_bind\<cdot>(convex_map\<cdot>f\<cdot>xs)\<cdot>g = convex_bind\<cdot>xs\<cdot>(\<Lambda> x. g\<cdot>(f\<cdot>x))"
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   408
by (simp add: convex_map_def convex_bind_bind)
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   409
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   410
lemma convex_map_bind:
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   411
  "convex_map\<cdot>f\<cdot>(convex_bind\<cdot>xs\<cdot>g) = convex_bind\<cdot>xs\<cdot>(\<Lambda> x. convex_map\<cdot>f\<cdot>(g\<cdot>x))"
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   412
by (simp add: convex_map_def convex_bind_bind)
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   413
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   414
lemma ep_pair_convex_map: "ep_pair e p \<Longrightarrow> ep_pair (convex_map\<cdot>e) (convex_map\<cdot>p)"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 58880
diff changeset
   415
apply standard
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   416
apply (induct_tac x rule: convex_pd_induct, simp_all add: ep_pair.e_inverse)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   417
apply (induct_tac y rule: convex_pd_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   418
apply (simp_all add: ep_pair.e_p_below monofun_cfun)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   419
done
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   420
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   421
lemma deflation_convex_map: "deflation d \<Longrightarrow> deflation (convex_map\<cdot>d)"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 58880
diff changeset
   422
apply standard
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   423
apply (induct_tac x rule: convex_pd_induct, simp_all add: deflation.idem)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   424
apply (induct_tac x rule: convex_pd_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   425
apply (simp_all add: deflation.below monofun_cfun)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   426
done
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   427
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   428
(* FIXME: long proof! *)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   429
lemma finite_deflation_convex_map:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   430
  assumes "finite_deflation d" shows "finite_deflation (convex_map\<cdot>d)"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   431
proof (rule finite_deflation_intro)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   432
  interpret d: finite_deflation d by fact
67682
00c436488398 tuned proofs -- prefer explicit names for facts from 'interpret';
wenzelm
parents: 62175
diff changeset
   433
  from d.deflation_axioms show "deflation (convex_map\<cdot>d)"
00c436488398 tuned proofs -- prefer explicit names for facts from 'interpret';
wenzelm
parents: 62175
diff changeset
   434
    by (rule deflation_convex_map)
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   435
  have "finite (range (\<lambda>x. d\<cdot>x))" by (rule d.finite_range)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   436
  hence "finite (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   437
    by (rule finite_vimageI, simp add: inj_on_def Rep_compact_basis_inject)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   438
  hence "finite (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x)))" by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   439
  hence "finite (Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   440
    by (rule finite_vimageI, simp add: inj_on_def Rep_pd_basis_inject)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   441
  hence *: "finite (convex_principal ` Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))" by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   442
  hence "finite (range (\<lambda>xs. convex_map\<cdot>d\<cdot>xs))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   443
    apply (rule rev_finite_subset)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   444
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   445
    apply (induct_tac xs rule: convex_pd.principal_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   446
    apply (simp add: adm_mem_finite *)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   447
    apply (rename_tac t, induct_tac t rule: pd_basis_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   448
    apply (simp only: convex_unit_Rep_compact_basis [symmetric] convex_map_unit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   449
    apply simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   450
    apply (subgoal_tac "\<exists>b. d\<cdot>(Rep_compact_basis a) = Rep_compact_basis b")
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   451
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   452
    apply (rule imageI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   453
    apply (rule vimageI2)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   454
    apply (simp add: Rep_PDUnit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   455
    apply (rule range_eqI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   456
    apply (erule sym)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   457
    apply (rule exI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   458
    apply (rule Abs_compact_basis_inverse [symmetric])
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   459
    apply (simp add: d.compact)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   460
    apply (simp only: convex_plus_principal [symmetric] convex_map_plus)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   461
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   462
    apply (rule imageI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   463
    apply (rule vimageI2)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   464
    apply (simp add: Rep_PDPlus)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   465
    done
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   466
  thus "finite {xs. convex_map\<cdot>d\<cdot>xs = xs}"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   467
    by (rule finite_range_imp_finite_fixes)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   468
qed
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   469
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   470
subsection \<open>Convex powerdomain is bifinite\<close>
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   471
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   472
lemma approx_chain_convex_map:
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   473
  assumes "approx_chain a"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   474
  shows "approx_chain (\<lambda>i. convex_map\<cdot>(a i))"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   475
  using assms unfolding approx_chain_def
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   476
  by (simp add: lub_APP convex_map_ID finite_deflation_convex_map)
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   477
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   478
instance convex_pd :: (bifinite) bifinite
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   479
proof
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   480
  show "\<exists>(a::nat \<Rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd). approx_chain a"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   481
    using bifinite [where 'a='a]
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   482
    by (fast intro!: approx_chain_convex_map)
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   483
qed
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41111
diff changeset
   484
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   485
subsection \<open>Join\<close>
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   486
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   487
definition
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   488
  convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   489
  "convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   490
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   491
lemma convex_join_unit [simp]:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   492
  "convex_join\<cdot>{xs}\<natural> = xs"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   493
unfolding convex_join_def by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   494
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   495
lemma convex_join_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   496
  "convex_join\<cdot>(xss \<union>\<natural> yss) = convex_join\<cdot>xss \<union>\<natural> convex_join\<cdot>yss"
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   497
unfolding convex_join_def by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   498
40577
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   499
lemma convex_join_bottom [simp]: "convex_join\<cdot>\<bottom> = \<bottom>"
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   500
unfolding convex_join_def by simp
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   501
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   502
lemma convex_join_map_unit:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   503
  "convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   504
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   505
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   506
lemma convex_join_map_join:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   507
  "convex_join\<cdot>(convex_map\<cdot>convex_join\<cdot>xsss) = convex_join\<cdot>(convex_join\<cdot>xsss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   508
by (induct xsss rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   509
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   510
lemma convex_join_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   511
  "convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   512
   convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   513
by (induct xss rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   514
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   515
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   516
subsection \<open>Conversions to other powerdomains\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   517
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   518
text \<open>Convex to upper\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   519
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   520
lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   521
unfolding convex_le_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   522
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   523
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   524
  convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   525
  "convex_to_upper = convex_pd.extension upper_principal"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   526
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   527
lemma convex_to_upper_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   528
  "convex_to_upper\<cdot>(convex_principal t) = upper_principal t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   529
unfolding convex_to_upper_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   530
apply (rule convex_pd.extension_principal)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   531
apply (rule upper_pd.principal_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   532
apply (erule convex_le_imp_upper_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   533
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   534
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   535
lemma convex_to_upper_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   536
  "convex_to_upper\<cdot>{x}\<natural> = {x}\<sharp>"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   537
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   538
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   539
lemma convex_to_upper_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   540
  "convex_to_upper\<cdot>(xs \<union>\<natural> ys) = convex_to_upper\<cdot>xs \<union>\<sharp> convex_to_upper\<cdot>ys"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   541
by (induct xs rule: convex_pd.principal_induct, simp,
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   542
    induct ys rule: convex_pd.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   543
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   544
lemma convex_to_upper_bind [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   545
  "convex_to_upper\<cdot>(convex_bind\<cdot>xs\<cdot>f) =
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   546
    upper_bind\<cdot>(convex_to_upper\<cdot>xs)\<cdot>(convex_to_upper oo f)"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   547
by (induct xs rule: convex_pd_induct, simp, simp, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   548
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   549
lemma convex_to_upper_map [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   550
  "convex_to_upper\<cdot>(convex_map\<cdot>f\<cdot>xs) = upper_map\<cdot>f\<cdot>(convex_to_upper\<cdot>xs)"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   551
by (simp add: convex_map_def upper_map_def cfcomp_LAM)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   552
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   553
lemma convex_to_upper_join [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   554
  "convex_to_upper\<cdot>(convex_join\<cdot>xss) =
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   555
    upper_bind\<cdot>(convex_to_upper\<cdot>xss)\<cdot>convex_to_upper"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   556
by (simp add: convex_join_def upper_join_def cfcomp_LAM eta_cfun)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   557
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   558
text \<open>Convex to lower\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   559
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   560
lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   561
unfolding convex_le_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   562
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   563
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   564
  convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   565
  "convex_to_lower = convex_pd.extension lower_principal"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   566
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   567
lemma convex_to_lower_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   568
  "convex_to_lower\<cdot>(convex_principal t) = lower_principal t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   569
unfolding convex_to_lower_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   570
apply (rule convex_pd.extension_principal)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   571
apply (rule lower_pd.principal_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   572
apply (erule convex_le_imp_lower_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   573
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   574
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   575
lemma convex_to_lower_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   576
  "convex_to_lower\<cdot>{x}\<natural> = {x}\<flat>"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   577
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   578
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   579
lemma convex_to_lower_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   580
  "convex_to_lower\<cdot>(xs \<union>\<natural> ys) = convex_to_lower\<cdot>xs \<union>\<flat> convex_to_lower\<cdot>ys"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   581
by (induct xs rule: convex_pd.principal_induct, simp,
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   582
    induct ys rule: convex_pd.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   583
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   584
lemma convex_to_lower_bind [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   585
  "convex_to_lower\<cdot>(convex_bind\<cdot>xs\<cdot>f) =
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   586
    lower_bind\<cdot>(convex_to_lower\<cdot>xs)\<cdot>(convex_to_lower oo f)"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   587
by (induct xs rule: convex_pd_induct, simp, simp, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   588
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   589
lemma convex_to_lower_map [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   590
  "convex_to_lower\<cdot>(convex_map\<cdot>f\<cdot>xs) = lower_map\<cdot>f\<cdot>(convex_to_lower\<cdot>xs)"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   591
by (simp add: convex_map_def lower_map_def cfcomp_LAM)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   592
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   593
lemma convex_to_lower_join [simp]:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   594
  "convex_to_lower\<cdot>(convex_join\<cdot>xss) =
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   595
    lower_bind\<cdot>(convex_to_lower\<cdot>xss)\<cdot>convex_to_lower"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   596
by (simp add: convex_join_def lower_join_def cfcomp_LAM eta_cfun)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   597
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   598
text \<open>Ordering property\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   599
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   600
lemma convex_pd_below_iff:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   601
  "(xs \<sqsubseteq> ys) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   602
    (convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and>
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   603
     convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   604
apply (induct xs rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   605
apply (induct ys rule: convex_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   606
apply (simp add: convex_le_def)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   607
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   608
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   609
lemmas convex_plus_below_plus_iff =
45606
b1e1508643b1 eliminated obsolete "standard";
wenzelm
parents: 42151
diff changeset
   610
  convex_pd_below_iff [where xs="xs \<union>\<natural> ys" and ys="zs \<union>\<natural> ws"]
b1e1508643b1 eliminated obsolete "standard";
wenzelm
parents: 42151
diff changeset
   611
  for xs ys zs ws
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   612
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   613
lemmas convex_pd_below_simps =
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   614
  convex_unit_below_plus_iff
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   615
  convex_plus_below_unit_iff
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   616
  convex_plus_below_plus_iff
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   617
  convex_unit_below_iff
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   618
  convex_to_upper_unit
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   619
  convex_to_upper_plus
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   620
  convex_to_lower_unit
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   621
  convex_to_lower_plus
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   622
  upper_pd_below_simps
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   623
  lower_pd_below_simps
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   624
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   625
end