src/HOLCF/ConvexPD.thy
author wenzelm
Thu, 19 Jun 2008 20:48:01 +0200
changeset 27277 7b7ce2d7fafe
parent 27267 5ebfb7f25ebb
child 27289 c49d427867aa
permissions -rw-r--r--
export read_typ/cert_typ -- version with regular context operations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/ConvexPD.thy
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     2
    ID:         $Id$
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     3
    Author:     Brian Huffman
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     4
*)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     5
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     6
header {* Convex powerdomain *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     8
theory ConvexPD
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     9
imports UpperPD LowerPD
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    10
begin
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    11
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    12
subsection {* Basis preorder *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    13
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    14
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    15
  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
    16
  "convex_le = (\<lambda>u v. u \<le>\<sharp> v \<and> u \<le>\<flat> v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    17
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    18
lemma convex_le_refl [simp]: "t \<le>\<natural> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    19
unfolding convex_le_def by (fast intro: upper_le_refl lower_le_refl)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    20
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    21
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
    22
unfolding convex_le_def by (fast intro: upper_le_trans lower_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    23
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    24
interpretation convex_le: preorder [convex_le]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    25
by (rule preorder.intro, rule convex_le_refl, rule convex_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    26
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    27
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<natural> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    28
unfolding convex_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    29
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    30
lemma PDUnit_convex_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<natural> PDUnit y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
unfolding convex_le_def by (fast intro: PDUnit_upper_mono PDUnit_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
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
    34
unfolding convex_le_def by (fast intro: PDPlus_upper_mono PDPlus_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    35
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    36
lemma convex_le_PDUnit_PDUnit_iff [simp]:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    37
  "(PDUnit a \<le>\<natural> PDUnit b) = a \<sqsubseteq> b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    39
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    40
lemma convex_le_PDUnit_lemma1:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    41
  "(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
    42
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    43
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    44
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    45
lemma convex_le_PDUnit_PDPlus_iff [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    46
  "(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
    47
unfolding convex_le_PDUnit_lemma1 Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    49
lemma convex_le_PDUnit_lemma2:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    50
  "(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
    51
unfolding convex_le_def upper_le_def lower_le_def Rep_PDUnit
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    52
using Rep_pd_basis_nonempty [of t, folded ex_in_conv] by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    53
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
lemma convex_le_PDPlus_PDUnit_iff [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    55
  "(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
    56
unfolding convex_le_PDUnit_lemma2 Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    57
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    58
lemma convex_le_PDPlus_lemma:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    59
  assumes z: "PDPlus t u \<le>\<natural> z"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    60
  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
    61
proof (intro exI conjI)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    62
  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
    63
  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
    64
  let ?v = "Abs_pd_basis ?A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    65
  let ?w = "Abs_pd_basis ?B"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    66
  have Rep_v: "Rep_pd_basis ?v = ?A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    67
    apply (rule Abs_pd_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    68
    apply (rule Rep_pd_basis_nonempty [of t, folded ex_in_conv, THEN exE])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    69
    apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    70
    apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    71
    apply (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    72
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    73
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    74
  have Rep_w: "Rep_pd_basis ?w = ?B"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    75
    apply (rule Abs_pd_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    76
    apply (rule Rep_pd_basis_nonempty [of u, folded ex_in_conv, THEN exE])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    77
    apply (cut_tac z, simp only: convex_le_def lower_le_def, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    78
    apply (drule_tac x=x in bspec, simp add: Rep_PDPlus, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    79
    apply (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    80
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    81
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    82
  show "z = PDPlus ?v ?w"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    83
    apply (insert z)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    84
    apply (simp add: convex_le_def, erule conjE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    85
    apply (simp add: Rep_pd_basis_inject [symmetric] Rep_PDPlus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    86
    apply (simp add: Rep_v Rep_w)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    87
    apply (rule equalityI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    88
     apply (rule subsetI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    89
     apply (simp only: upper_le_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    90
     apply (drule (1) bspec, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    91
     apply (simp add: Rep_PDPlus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    92
     apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    93
    apply fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    94
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    95
  show "t \<le>\<natural> ?v" "u \<le>\<natural> ?w"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    96
   apply (insert z)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    97
   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
    98
   apply fast+
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    99
   done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   100
qed
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   101
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   102
lemma convex_le_induct [induct set: convex_le]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   103
  assumes le: "t \<le>\<natural> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   104
  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
   105
  assumes 3: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   106
  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
   107
  shows "P t u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   108
using le apply (induct t arbitrary: u rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   109
apply (erule rev_mp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   110
apply (induct_tac u rule: pd_basis_induct1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   111
apply (simp add: 3)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   112
apply (simp, clarify, rename_tac a b t)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   113
apply (subgoal_tac "P (PDPlus (PDUnit a) (PDUnit a)) (PDPlus (PDUnit b) t)")
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   114
apply (simp add: PDPlus_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   115
apply (erule (1) 4 [OF 3])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   116
apply (drule convex_le_PDPlus_lemma, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   117
apply (simp add: 4)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   118
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   119
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   120
lemma approx_pd_convex_mono1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   121
  "i \<le> j \<Longrightarrow> approx_pd i t \<le>\<natural> approx_pd j t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   122
apply (induct t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   123
apply (simp add: compact_approx_mono1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   124
apply (simp add: PDPlus_convex_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   125
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   126
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   127
lemma approx_pd_convex_le: "approx_pd i t \<le>\<natural> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   128
apply (induct t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   129
apply (simp add: compact_approx_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   130
apply (simp add: PDPlus_convex_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   131
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   132
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   133
lemma approx_pd_convex_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
  "t \<le>\<natural> u \<Longrightarrow> approx_pd n t \<le>\<natural> approx_pd n u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   135
apply (erule convex_le_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   136
apply (erule (1) convex_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   137
apply (simp add: compact_approx_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   138
apply (simp add: PDPlus_convex_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   139
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   140
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   141
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   142
subsection {* Type definition *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   143
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   144
cpodef (open) 'a convex_pd =
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   145
  "{S::'a::profinite pd_basis set. convex_le.ideal S}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   146
apply (simp add: convex_le.adm_ideal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   147
apply (fast intro: convex_le.ideal_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   148
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   149
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   150
lemma ideal_Rep_convex_pd: "convex_le.ideal (Rep_convex_pd xs)"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   151
by (rule Rep_convex_pd [unfolded mem_Collect_eq])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   152
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   153
lemma Rep_convex_pd_mono: "xs \<sqsubseteq> ys \<Longrightarrow> Rep_convex_pd xs \<subseteq> Rep_convex_pd ys"
26806
40b411ec05aa Adapted to encoding of sets as predicates
berghofe
parents: 26420
diff changeset
   154
unfolding less_convex_pd_def less_set_eq .
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   155
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   156
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   157
  convex_principal :: "'a pd_basis \<Rightarrow> 'a convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   158
  "convex_principal t = Abs_convex_pd {u. u \<le>\<natural> t}"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   159
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   160
lemma Rep_convex_principal:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   161
  "Rep_convex_pd (convex_principal t) = {u. u \<le>\<natural> t}"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   162
unfolding convex_principal_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   163
apply (rule Abs_convex_pd_inverse [simplified])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   164
apply (rule convex_le.ideal_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   165
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   166
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   167
interpretation convex_pd:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   168
  ideal_completion [convex_le approx_pd convex_principal Rep_convex_pd]
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   169
apply unfold_locales
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   170
apply (rule approx_pd_convex_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   171
apply (rule approx_pd_idem)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   172
apply (erule approx_pd_convex_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   173
apply (rule approx_pd_convex_mono1, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   174
apply (rule finite_range_approx_pd)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   175
apply (rule ex_approx_pd_eq)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   176
apply (rule ideal_Rep_convex_pd)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   177
apply (rule cont_Rep_convex_pd)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   178
apply (rule Rep_convex_principal)
26806
40b411ec05aa Adapted to encoding of sets as predicates
berghofe
parents: 26420
diff changeset
   179
apply (simp only: less_convex_pd_def less_set_eq)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   180
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   181
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   182
lemma convex_principal_less_iff [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   183
  "convex_principal t \<sqsubseteq> convex_principal u \<longleftrightarrow> t \<le>\<natural> u"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   184
by (rule convex_pd.principal_less_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   185
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   186
lemma convex_principal_eq_iff [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   187
  "convex_principal t = convex_principal u \<longleftrightarrow> t \<le>\<natural> u \<and> u \<le>\<natural> t"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   188
by (rule convex_pd.principal_eq_iff)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   189
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   190
lemma convex_principal_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   191
  "t \<le>\<natural> u \<Longrightarrow> convex_principal t \<sqsubseteq> convex_principal u"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   192
by (rule convex_pd.principal_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   193
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   194
lemma compact_convex_principal: "compact (convex_principal t)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   195
by (rule convex_pd.compact_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   196
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   197
lemma convex_pd_minimal: "convex_principal (PDUnit compact_bot) \<sqsubseteq> ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   198
by (induct ys rule: convex_pd.principal_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   199
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   200
instance convex_pd :: (bifinite) pcpo
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   201
by intro_classes (fast intro: convex_pd_minimal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   202
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   203
lemma inst_convex_pd_pcpo: "\<bottom> = convex_principal (PDUnit compact_bot)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   204
by (rule convex_pd_minimal [THEN UU_I, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   205
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   206
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   207
subsection {* Approximation *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   208
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   209
instantiation convex_pd :: (profinite) profinite
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   210
begin
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   211
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   212
definition
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   213
  approx_convex_pd_def: "approx = convex_pd.completion_approx"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   214
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   215
instance
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   216
apply (intro_classes, unfold approx_convex_pd_def)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   217
apply (simp add: convex_pd.chain_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   218
apply (rule convex_pd.lub_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   219
apply (rule convex_pd.completion_approx_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   220
apply (rule convex_pd.finite_fixes_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   221
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   222
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   223
end
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   224
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   225
instance convex_pd :: (bifinite) bifinite ..
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   226
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   227
lemma approx_convex_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   228
  "approx n\<cdot>(convex_principal t) = convex_principal (approx_pd n t)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   229
unfolding approx_convex_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   230
by (rule convex_pd.completion_approx_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   231
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   232
lemma approx_eq_convex_principal:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   233
  "\<exists>t\<in>Rep_convex_pd xs. approx n\<cdot>xs = convex_principal (approx_pd n t)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   234
unfolding approx_convex_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   235
by (rule convex_pd.completion_approx_eq_principal)
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   236
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   237
lemma compact_imp_convex_principal:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   238
  "compact xs \<Longrightarrow> \<exists>t. xs = convex_principal t"
27267
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26962
diff changeset
   239
by (rule convex_pd.compact_imp_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   240
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   241
lemma convex_principal_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   242
  "\<lbrakk>adm P; \<And>t. P (convex_principal t)\<rbrakk> \<Longrightarrow> P xs"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   243
by (rule convex_pd.principal_induct)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   244
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   245
lemma convex_principal_induct2:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   246
  "\<lbrakk>\<And>ys. adm (\<lambda>xs. P xs ys); \<And>xs. adm (\<lambda>ys. P xs ys);
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   247
    \<And>t u. P (convex_principal t) (convex_principal u)\<rbrakk> \<Longrightarrow> P xs ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   248
apply (rule_tac x=ys in spec)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   249
apply (rule_tac xs=xs in convex_principal_induct, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   250
apply (rule allI, rename_tac ys)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   251
apply (rule_tac xs=ys in convex_principal_induct, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   252
apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   253
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   254
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   255
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   256
subsection {* Monadic unit and plus *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   257
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   258
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   259
  convex_unit :: "'a \<rightarrow> 'a convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   260
  "convex_unit = compact_basis.basis_fun (\<lambda>a. convex_principal (PDUnit a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   261
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   262
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   263
  convex_plus :: "'a convex_pd \<rightarrow> 'a convex_pd \<rightarrow> 'a convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   264
  "convex_plus = convex_pd.basis_fun (\<lambda>t. convex_pd.basis_fun (\<lambda>u.
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   265
      convex_principal (PDPlus t u)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   266
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   267
abbreviation
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   268
  convex_add :: "'a convex_pd \<Rightarrow> 'a convex_pd \<Rightarrow> 'a convex_pd"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   269
    (infixl "+\<natural>" 65) where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   270
  "xs +\<natural> ys == convex_plus\<cdot>xs\<cdot>ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   271
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   272
syntax
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   273
  "_convex_pd" :: "args \<Rightarrow> 'a convex_pd" ("{_}\<natural>")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   274
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   275
translations
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   276
  "{x,xs}\<natural>" == "{x}\<natural> +\<natural> {xs}\<natural>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   277
  "{x}\<natural>" == "CONST convex_unit\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   278
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   279
lemma convex_unit_Rep_compact_basis [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   280
  "{Rep_compact_basis a}\<natural> = convex_principal (PDUnit a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   281
unfolding convex_unit_def
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   282
by (simp add: compact_basis.basis_fun_principal
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   283
    convex_principal_mono PDUnit_convex_mono)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   284
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   285
lemma convex_plus_principal [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   286
  "convex_principal t +\<natural> convex_principal u = convex_principal (PDPlus t u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   287
unfolding convex_plus_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   288
by (simp add: convex_pd.basis_fun_principal
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   289
    convex_pd.basis_fun_mono PDPlus_convex_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   290
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   291
lemma approx_convex_unit [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   292
  "approx n\<cdot>{x}\<natural> = {approx n\<cdot>x}\<natural>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   293
apply (induct x rule: compact_basis_induct, simp)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   294
apply (simp add: approx_Rep_compact_basis)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   295
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   296
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   297
lemma approx_convex_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   298
  "approx n\<cdot>(xs +\<natural> ys) = approx n\<cdot>xs +\<natural> approx n\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   299
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   300
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   301
lemma convex_plus_assoc:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   302
  "(xs +\<natural> ys) +\<natural> zs = xs +\<natural> (ys +\<natural> zs)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   303
apply (induct xs ys arbitrary: zs rule: convex_principal_induct2, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   304
apply (rule_tac xs=zs in convex_principal_induct, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   305
apply (simp add: PDPlus_assoc)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   306
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   307
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   308
lemma convex_plus_commute: "xs +\<natural> ys = ys +\<natural> xs"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   309
apply (induct xs ys rule: convex_principal_induct2, simp, simp)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   310
apply (simp add: PDPlus_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   311
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   312
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   313
lemma convex_plus_absorb: "xs +\<natural> xs = xs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   314
apply (induct xs rule: convex_principal_induct, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   315
apply (simp add: PDPlus_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   316
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   317
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   318
interpretation aci_convex_plus: ab_semigroup_idem_mult ["op +\<natural>"]
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   319
  by unfold_locales
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   320
    (rule convex_plus_assoc convex_plus_commute convex_plus_absorb)+
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   321
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   322
lemma convex_plus_left_commute: "xs +\<natural> (ys +\<natural> zs) = ys +\<natural> (xs +\<natural> zs)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   323
by (rule aci_convex_plus.mult_left_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   324
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   325
lemma convex_plus_left_absorb: "xs +\<natural> (xs +\<natural> ys) = xs +\<natural> ys"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   326
by (rule aci_convex_plus.mult_left_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   327
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   328
lemmas convex_plus_aci = aci_convex_plus.mult_ac_idem
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   329
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   330
lemma convex_unit_less_plus_iff [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   331
  "{x}\<natural> \<sqsubseteq> ys +\<natural> zs \<longleftrightarrow> {x}\<natural> \<sqsubseteq> ys \<and> {x}\<natural> \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   332
 apply (rule iffI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   333
  apply (subgoal_tac
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   334
    "adm (\<lambda>f. f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>ys \<and> f\<cdot>{x}\<natural> \<sqsubseteq> f\<cdot>zs)")
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25904
diff changeset
   335
   apply (drule admD, rule chain_approx)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   336
    apply (drule_tac f="approx i" in monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   337
    apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   338
    apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   339
    apply (cut_tac xs="approx i\<cdot>zs" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   340
    apply (clarify, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   341
   apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   342
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   343
 apply (erule conjE)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   344
 apply (subst convex_plus_absorb [of "{x}\<natural>", symmetric])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   345
 apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   346
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   347
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   348
lemma convex_plus_less_unit_iff [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   349
  "xs +\<natural> ys \<sqsubseteq> {z}\<natural> \<longleftrightarrow> xs \<sqsubseteq> {z}\<natural> \<and> ys \<sqsubseteq> {z}\<natural>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   350
 apply (rule iffI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   351
  apply (subgoal_tac
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   352
    "adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<natural> \<and> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<natural>)")
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25904
diff changeset
   353
   apply (drule admD, rule chain_approx)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   354
    apply (drule_tac f="approx i" in monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   355
    apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   356
    apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   357
    apply (cut_tac x="approx i\<cdot>z" in compact_imp_Rep_compact_basis, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   358
    apply (clarify, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   359
   apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   360
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   361
 apply (erule conjE)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   362
 apply (subst convex_plus_absorb [of "{z}\<natural>", symmetric])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   363
 apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   364
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   365
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   366
lemma convex_unit_less_iff [simp]: "{x}\<natural> \<sqsubseteq> {y}\<natural> \<longleftrightarrow> x \<sqsubseteq> y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   367
 apply (rule iffI)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   368
  apply (rule bifinite_less_ext)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   369
  apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   370
  apply (cut_tac x="approx i\<cdot>x" in compact_imp_Rep_compact_basis, simp)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   371
  apply (cut_tac x="approx i\<cdot>y" in compact_imp_Rep_compact_basis, simp)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   372
  apply (clarify, simp add: compact_le_def)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   373
 apply (erule monofun_cfun_arg)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   374
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   375
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   376
lemma convex_unit_eq_iff [simp]: "{x}\<natural> = {y}\<natural> \<longleftrightarrow> x = y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   377
unfolding po_eq_conv by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   378
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   379
lemma convex_unit_strict [simp]: "{\<bottom>}\<natural> = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   380
unfolding inst_convex_pd_pcpo Rep_compact_bot [symmetric] by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   381
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   382
lemma convex_unit_strict_iff [simp]: "{x}\<natural> = \<bottom> \<longleftrightarrow> x = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   383
unfolding convex_unit_strict [symmetric] by (rule convex_unit_eq_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   384
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   385
lemma compact_convex_unit_iff [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   386
  "compact {x}\<natural> \<longleftrightarrow> compact x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   387
unfolding bifinite_compact_iff by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   388
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   389
lemma compact_convex_plus [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   390
  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<natural> ys)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   391
apply (drule compact_imp_convex_principal)+
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   392
apply (auto simp add: compact_convex_principal)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   393
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   394
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   395
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   396
subsection {* Induction rules *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   397
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
lemma convex_pd_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   399
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   400
  assumes unit: "\<And>x. P {x}\<natural>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   401
  assumes insert: "\<And>x ys. \<lbrakk>P {x}\<natural>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<natural> +\<natural> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   402
  shows "P (xs::'a convex_pd)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   403
apply (induct xs rule: convex_principal_induct, rule P)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   404
apply (induct_tac t rule: pd_basis_induct1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   405
apply (simp only: convex_unit_Rep_compact_basis [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   406
apply (rule unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   407
apply (simp only: convex_unit_Rep_compact_basis [symmetric]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   408
                  convex_plus_principal [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   409
apply (erule insert [OF unit])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   410
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   411
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   412
lemma convex_pd_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   413
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   414
  assumes unit: "\<And>x. P {x}\<natural>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   415
  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<natural> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   416
  shows "P (xs::'a convex_pd)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   417
apply (induct xs rule: convex_principal_induct, rule P)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   418
apply (induct_tac t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   419
apply (simp only: convex_unit_Rep_compact_basis [symmetric] unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   420
apply (simp only: convex_plus_principal [symmetric] plus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   421
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   422
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   423
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   424
subsection {* Monadic bind *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   425
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   426
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   427
  convex_bind_basis ::
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   428
  "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   429
  "convex_bind_basis = fold_pd
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   430
    (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   431
    (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   432
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   433
lemma ACI_convex_bind:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   434
  "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<natural> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   435
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
   436
apply (simp add: convex_plus_assoc)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   437
apply (simp add: convex_plus_commute)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   438
apply (simp add: convex_plus_absorb eta_cfun)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   439
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   440
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   441
lemma convex_bind_basis_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   442
  "convex_bind_basis (PDUnit a) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   443
    (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   444
  "convex_bind_basis (PDPlus t u) =
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   445
    (\<Lambda> f. convex_bind_basis t\<cdot>f +\<natural> convex_bind_basis u\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   446
unfolding convex_bind_basis_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   447
apply -
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   448
apply (rule fold_pd_PDUnit [OF ACI_convex_bind])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   449
apply (rule fold_pd_PDPlus [OF ACI_convex_bind])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   450
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   451
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   452
lemma monofun_LAM:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   453
  "\<lbrakk>cont f; cont g; \<And>x. f x \<sqsubseteq> g x\<rbrakk> \<Longrightarrow> (\<Lambda> x. f x) \<sqsubseteq> (\<Lambda> x. g x)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   454
by (simp add: expand_cfun_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   455
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   456
lemma convex_bind_basis_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   457
  "t \<le>\<natural> u \<Longrightarrow> convex_bind_basis t \<sqsubseteq> convex_bind_basis u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   458
apply (erule convex_le_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   459
apply (erule (1) trans_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   460
apply (simp add: monofun_LAM compact_le_def monofun_cfun)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   461
apply (simp add: monofun_LAM compact_le_def monofun_cfun)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   462
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   463
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   464
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   465
  convex_bind :: "'a convex_pd \<rightarrow> ('a \<rightarrow> 'b convex_pd) \<rightarrow> 'b convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   466
  "convex_bind = convex_pd.basis_fun convex_bind_basis"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   467
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   468
lemma convex_bind_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   469
  "convex_bind\<cdot>(convex_principal t) = convex_bind_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   470
unfolding convex_bind_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   471
apply (rule convex_pd.basis_fun_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   472
apply (erule convex_bind_basis_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   473
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   474
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   475
lemma convex_bind_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   476
  "convex_bind\<cdot>{x}\<natural>\<cdot>f = f\<cdot>x"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   477
by (induct x rule: compact_basis_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   478
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   479
lemma convex_bind_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   480
  "convex_bind\<cdot>(xs +\<natural> ys)\<cdot>f = convex_bind\<cdot>xs\<cdot>f +\<natural> convex_bind\<cdot>ys\<cdot>f"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   481
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   482
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   483
lemma convex_bind_strict [simp]: "convex_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   484
unfolding convex_unit_strict [symmetric] by (rule convex_bind_unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   485
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   486
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   487
subsection {* Map and join *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   488
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   489
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   490
  convex_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a convex_pd \<rightarrow> 'b convex_pd" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   491
  "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
   492
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   493
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   494
  convex_join :: "'a convex_pd convex_pd \<rightarrow> 'a convex_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   495
  "convex_join = (\<Lambda> xss. convex_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   496
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   497
lemma convex_map_unit [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   498
  "convex_map\<cdot>f\<cdot>(convex_unit\<cdot>x) = convex_unit\<cdot>(f\<cdot>x)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   499
unfolding convex_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   500
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   501
lemma convex_map_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   502
  "convex_map\<cdot>f\<cdot>(xs +\<natural> ys) = convex_map\<cdot>f\<cdot>xs +\<natural> convex_map\<cdot>f\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   503
unfolding convex_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   504
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   505
lemma convex_join_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   506
  "convex_join\<cdot>{xs}\<natural> = xs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   507
unfolding convex_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   508
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   509
lemma convex_join_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   510
  "convex_join\<cdot>(xss +\<natural> yss) = convex_join\<cdot>xss +\<natural> convex_join\<cdot>yss"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   511
unfolding convex_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   512
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   513
lemma convex_map_ident: "convex_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   514
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   515
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   516
lemma convex_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   517
  "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
   518
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   519
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   520
lemma convex_join_map_unit:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   521
  "convex_join\<cdot>(convex_map\<cdot>convex_unit\<cdot>xs) = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   522
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   523
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   524
lemma convex_join_map_join:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   525
  "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
   526
by (induct xsss rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   527
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   528
lemma convex_join_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   529
  "convex_join\<cdot>(convex_map\<cdot>(convex_map\<cdot>f)\<cdot>xss) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   530
   convex_map\<cdot>f\<cdot>(convex_join\<cdot>xss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   531
by (induct xss rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   532
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   533
lemma convex_map_approx: "convex_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   534
by (induct xs rule: convex_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   535
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   536
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   537
subsection {* Conversions to other powerdomains *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   538
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   539
text {* Convex to upper *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   540
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   541
lemma convex_le_imp_upper_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<sharp> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   542
unfolding convex_le_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   543
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   544
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   545
  convex_to_upper :: "'a convex_pd \<rightarrow> 'a upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   546
  "convex_to_upper = convex_pd.basis_fun upper_principal"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   547
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   548
lemma convex_to_upper_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   549
  "convex_to_upper\<cdot>(convex_principal t) = upper_principal t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   550
unfolding convex_to_upper_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   551
apply (rule convex_pd.basis_fun_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   552
apply (rule upper_principal_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   553
apply (erule convex_le_imp_upper_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   554
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   555
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   556
lemma convex_to_upper_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   557
  "convex_to_upper\<cdot>{x}\<natural> = {x}\<sharp>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   558
by (induct x rule: compact_basis_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   559
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   560
lemma convex_to_upper_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   561
  "convex_to_upper\<cdot>(xs +\<natural> ys) = convex_to_upper\<cdot>xs +\<sharp> convex_to_upper\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   562
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   563
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   564
lemma approx_convex_to_upper:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   565
  "approx i\<cdot>(convex_to_upper\<cdot>xs) = convex_to_upper\<cdot>(approx i\<cdot>xs)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   566
by (induct xs rule: convex_pd_induct, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   567
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   568
text {* Convex to lower *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   569
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   570
lemma convex_le_imp_lower_le: "t \<le>\<natural> u \<Longrightarrow> t \<le>\<flat> u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   571
unfolding convex_le_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   572
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   573
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   574
  convex_to_lower :: "'a convex_pd \<rightarrow> 'a lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   575
  "convex_to_lower = convex_pd.basis_fun lower_principal"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   576
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   577
lemma convex_to_lower_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   578
  "convex_to_lower\<cdot>(convex_principal t) = lower_principal t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   579
unfolding convex_to_lower_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   580
apply (rule convex_pd.basis_fun_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   581
apply (rule lower_principal_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   582
apply (erule convex_le_imp_lower_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   583
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   584
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   585
lemma convex_to_lower_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   586
  "convex_to_lower\<cdot>{x}\<natural> = {x}\<flat>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   587
by (induct x rule: compact_basis_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   588
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   589
lemma convex_to_lower_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   590
  "convex_to_lower\<cdot>(xs +\<natural> ys) = convex_to_lower\<cdot>xs +\<flat> convex_to_lower\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   591
by (induct xs ys rule: convex_principal_induct2, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   592
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   593
lemma approx_convex_to_lower:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   594
  "approx i\<cdot>(convex_to_lower\<cdot>xs) = convex_to_lower\<cdot>(approx i\<cdot>xs)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   595
by (induct xs rule: convex_pd_induct, simp, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   596
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   597
text {* Ordering property *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   598
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   599
lemma convex_pd_less_iff:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   600
  "(xs \<sqsubseteq> ys) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   601
    (convex_to_upper\<cdot>xs \<sqsubseteq> convex_to_upper\<cdot>ys \<and>
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   602
     convex_to_lower\<cdot>xs \<sqsubseteq> convex_to_lower\<cdot>ys)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   603
 apply (safe elim!: monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   604
 apply (rule bifinite_less_ext)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   605
 apply (drule_tac f="approx i" in monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   606
 apply (drule_tac f="approx i" in monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   607
 apply (cut_tac xs="approx i\<cdot>xs" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   608
 apply (cut_tac xs="approx i\<cdot>ys" in compact_imp_convex_principal, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   609
 apply clarify
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   610
 apply (simp add: approx_convex_to_upper approx_convex_to_lower convex_le_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   611
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   612
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   613
lemmas convex_plus_less_plus_iff =
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   614
  convex_pd_less_iff [where xs="xs +\<natural> ys" and ys="zs +\<natural> ws", standard]
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   615
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   616
lemmas convex_pd_less_simps =
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   617
  convex_unit_less_plus_iff
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   618
  convex_plus_less_unit_iff
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   619
  convex_plus_less_plus_iff
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   620
  convex_unit_less_iff
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   621
  convex_to_upper_unit
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   622
  convex_to_upper_plus
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   623
  convex_to_lower_unit
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   624
  convex_to_lower_plus
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   625
  upper_pd_less_simps
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   626
  lower_pd_less_simps
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   627
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   628
end