src/HOLCF/LowerPD.thy
author wenzelm
Fri, 15 Aug 2008 16:08:08 +0200
changeset 27893 7c97cf70d663
parent 27405 785f5dbec8f4
child 29138 661a8db7e647
child 29237 e90d9d51106b
permissions -rw-r--r--
added README;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/LowerPD.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 {* Lower powerdomain *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     8
theory LowerPD
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     9
imports CompactBasis
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
  lower_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<flat>" 50) where
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    16
  "lower_le = (\<lambda>u v. \<forall>x\<in>Rep_pd_basis u. \<exists>y\<in>Rep_pd_basis v. x \<sqsubseteq> y)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    17
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    18
lemma lower_le_refl [simp]: "t \<le>\<flat> t"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    19
unfolding lower_le_def by fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    20
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    21
lemma lower_le_trans: "\<lbrakk>t \<le>\<flat> u; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> t \<le>\<flat> v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    22
unfolding lower_le_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    23
apply (rule ballI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    24
apply (drule (1) bspec, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    25
apply (drule (1) bspec, erule bexE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    26
apply (erule rev_bexI)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    27
apply (erule (1) trans_less)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    28
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    29
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    30
interpretation lower_le: preorder [lower_le]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
by (rule preorder.intro, rule lower_le_refl, rule lower_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
lemma lower_le_minimal [simp]: "PDUnit compact_bot \<le>\<flat> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    34
unfolding lower_le_def Rep_PDUnit
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    35
by (simp, rule Rep_pd_basis_nonempty [folded ex_in_conv])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    36
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    37
lemma PDUnit_lower_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<flat> PDUnit y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
unfolding 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 PDPlus_lower_mono: "\<lbrakk>s \<le>\<flat> t; u \<le>\<flat> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<flat> PDPlus t v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    41
unfolding lower_le_def Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    42
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    43
lemma PDPlus_lower_less: "t \<le>\<flat> PDPlus t u"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    44
unfolding lower_le_def Rep_PDPlus by fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    45
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    46
lemma lower_le_PDUnit_PDUnit_iff [simp]:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    47
  "(PDUnit a \<le>\<flat> PDUnit b) = a \<sqsubseteq> b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
unfolding lower_le_def Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    49
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    50
lemma lower_le_PDUnit_PDPlus_iff:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    51
  "(PDUnit a \<le>\<flat> PDPlus t u) = (PDUnit a \<le>\<flat> t \<or> PDUnit a \<le>\<flat> u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    52
unfolding lower_le_def Rep_PDPlus Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    53
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
lemma lower_le_PDPlus_iff: "(PDPlus t u \<le>\<flat> v) = (t \<le>\<flat> v \<and> u \<le>\<flat> v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    55
unfolding lower_le_def 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 lower_le_induct [induct set: lower_le]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    58
  assumes le: "t \<le>\<flat> u"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    59
  assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    60
  assumes 2: "\<And>t u a. P (PDUnit a) t \<Longrightarrow> P (PDUnit a) (PDPlus t u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    61
  assumes 3: "\<And>t u v. \<lbrakk>P t v; P u v\<rbrakk> \<Longrightarrow> P (PDPlus t u) v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    62
  shows "P t u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    63
using le
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    64
apply (induct t arbitrary: u rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    65
apply (erule rev_mp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    66
apply (induct_tac u rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    67
apply (simp add: 1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    68
apply (simp add: lower_le_PDUnit_PDPlus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    69
apply (simp add: 2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    70
apply (subst PDPlus_commute)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    71
apply (simp add: 2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    72
apply (simp add: lower_le_PDPlus_iff 3)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    73
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    74
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    75
lemma pd_take_lower_chain:
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    76
  "pd_take n t \<le>\<flat> pd_take (Suc n) t"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    77
apply (induct t rule: pd_basis_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    78
apply (simp add: compact_basis.take_chain)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    79
apply (simp add: PDPlus_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    80
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    81
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    82
lemma pd_take_lower_le: "pd_take i t \<le>\<flat> t"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    83
apply (induct t rule: pd_basis_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    84
apply (simp add: compact_basis.take_less)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    85
apply (simp add: PDPlus_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    86
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    87
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    88
lemma pd_take_lower_mono:
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    89
  "t \<le>\<flat> u \<Longrightarrow> pd_take n t \<le>\<flat> pd_take n u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    90
apply (erule lower_le_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    91
apply (simp add: compact_basis.take_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    92
apply (simp add: lower_le_PDUnit_PDPlus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    93
apply (simp add: lower_le_PDPlus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    94
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    95
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    96
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    97
subsection {* Type definition *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    98
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    99
typedef (open) 'a lower_pd =
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   100
  "{S::'a pd_basis set. lower_le.ideal S}"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   101
by (fast intro: lower_le.ideal_principal)
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   102
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   103
instantiation lower_pd :: (profinite) sq_ord
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   104
begin
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   105
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   106
definition
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   107
  "x \<sqsubseteq> y \<longleftrightarrow> Rep_lower_pd x \<subseteq> Rep_lower_pd y"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   108
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   109
instance ..
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   110
end
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   111
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   112
instance lower_pd :: (profinite) po
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   113
by (rule lower_le.typedef_ideal_po
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   114
    [OF type_definition_lower_pd sq_le_lower_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   115
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   116
instance lower_pd :: (profinite) cpo
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   117
by (rule lower_le.typedef_ideal_cpo
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   118
    [OF type_definition_lower_pd sq_le_lower_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   119
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   120
lemma Rep_lower_pd_lub:
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   121
  "chain Y \<Longrightarrow> Rep_lower_pd (\<Squnion>i. Y i) = (\<Union>i. Rep_lower_pd (Y i))"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   122
by (rule lower_le.typedef_ideal_rep_contlub
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   123
    [OF type_definition_lower_pd sq_le_lower_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   124
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   125
lemma ideal_Rep_lower_pd: "lower_le.ideal (Rep_lower_pd xs)"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   126
by (rule Rep_lower_pd [unfolded mem_Collect_eq])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   127
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   128
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   129
  lower_principal :: "'a pd_basis \<Rightarrow> 'a lower_pd" where
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   130
  "lower_principal t = Abs_lower_pd {u. u \<le>\<flat> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   131
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   132
lemma Rep_lower_principal:
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   133
  "Rep_lower_pd (lower_principal t) = {u. u \<le>\<flat> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
unfolding lower_principal_def
27297
2c42b1505f25 removed SetPcpo.thy and cpo instance for type bool;
huffman
parents: 27289
diff changeset
   135
by (simp add: Abs_lower_pd_inverse lower_le.ideal_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   136
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   137
interpretation lower_pd:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   138
  ideal_completion [lower_le pd_take lower_principal Rep_lower_pd]
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   139
apply unfold_locales
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   140
apply (rule pd_take_lower_le)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   141
apply (rule pd_take_idem)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   142
apply (erule pd_take_lower_mono)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   143
apply (rule pd_take_lower_chain)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   144
apply (rule finite_range_pd_take)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   145
apply (rule pd_take_covers)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   146
apply (rule ideal_Rep_lower_pd)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   147
apply (erule Rep_lower_pd_lub)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   148
apply (rule Rep_lower_principal)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   149
apply (simp only: sq_le_lower_pd_def)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   150
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   151
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   152
text {* Lower powerdomain is pointed *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   153
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   154
lemma lower_pd_minimal: "lower_principal (PDUnit compact_bot) \<sqsubseteq> ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   155
by (induct ys rule: lower_pd.principal_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   156
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   157
instance lower_pd :: (bifinite) pcpo
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   158
by intro_classes (fast intro: lower_pd_minimal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   159
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   160
lemma inst_lower_pd_pcpo: "\<bottom> = lower_principal (PDUnit compact_bot)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   161
by (rule lower_pd_minimal [THEN UU_I, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   162
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   163
text {* Lower powerdomain is profinite *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   164
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   165
instantiation lower_pd :: (profinite) profinite
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   166
begin
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   167
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   168
definition
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   169
  approx_lower_pd_def: "approx = lower_pd.completion_approx"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   170
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   171
instance
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   172
apply (intro_classes, unfold approx_lower_pd_def)
27310
d0229bc6c461 simplify profinite class axioms
huffman
parents: 27309
diff changeset
   173
apply (rule lower_pd.chain_completion_approx)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   174
apply (rule lower_pd.lub_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   175
apply (rule lower_pd.completion_approx_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   176
apply (rule lower_pd.finite_fixes_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   177
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   178
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   179
end
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   180
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   181
instance lower_pd :: (bifinite) bifinite ..
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   182
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   183
lemma approx_lower_principal [simp]:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   184
  "approx n\<cdot>(lower_principal t) = lower_principal (pd_take n t)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   185
unfolding approx_lower_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   186
by (rule lower_pd.completion_approx_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   187
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   188
lemma approx_eq_lower_principal:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   189
  "\<exists>t\<in>Rep_lower_pd xs. approx n\<cdot>xs = lower_principal (pd_take n t)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   190
unfolding approx_lower_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   191
by (rule lower_pd.completion_approx_eq_principal)
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   192
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   193
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   194
subsection {* Monadic unit and plus *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   195
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   196
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   197
  lower_unit :: "'a \<rightarrow> 'a lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   198
  "lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   199
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   200
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   201
  lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   202
  "lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u.
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   203
      lower_principal (PDPlus t u)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   204
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   205
abbreviation
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   206
  lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   207
    (infixl "+\<flat>" 65) where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   208
  "xs +\<flat> ys == lower_plus\<cdot>xs\<cdot>ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   209
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   210
syntax
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   211
  "_lower_pd" :: "args \<Rightarrow> 'a lower_pd" ("{_}\<flat>")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   212
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   213
translations
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   214
  "{x,xs}\<flat>" == "{x}\<flat> +\<flat> {xs}\<flat>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   215
  "{x}\<flat>" == "CONST lower_unit\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   216
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   217
lemma lower_unit_Rep_compact_basis [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   218
  "{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   219
unfolding lower_unit_def
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   220
by (simp add: compact_basis.basis_fun_principal PDUnit_lower_mono)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   221
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   222
lemma lower_plus_principal [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   223
  "lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   224
unfolding lower_plus_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   225
by (simp add: lower_pd.basis_fun_principal
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   226
    lower_pd.basis_fun_mono PDPlus_lower_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   227
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   228
lemma approx_lower_unit [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   229
  "approx n\<cdot>{x}\<flat> = {approx n\<cdot>x}\<flat>"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   230
apply (induct x rule: compact_basis.principal_induct, simp)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   231
apply (simp add: approx_Rep_compact_basis)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   232
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   233
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   234
lemma approx_lower_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   235
  "approx n\<cdot>(xs +\<flat> ys) = (approx n\<cdot>xs) +\<flat> (approx n\<cdot>ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   236
by (induct xs ys rule: lower_pd.principal_induct2, simp, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   237
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   238
lemma lower_plus_assoc: "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   239
apply (induct xs ys arbitrary: zs rule: lower_pd.principal_induct2, simp, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   240
apply (rule_tac x=zs in lower_pd.principal_induct, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   241
apply (simp add: PDPlus_assoc)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   242
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   243
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   244
lemma lower_plus_commute: "xs +\<flat> ys = ys +\<flat> xs"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   245
apply (induct xs ys rule: lower_pd.principal_induct2, simp, simp)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   246
apply (simp add: PDPlus_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   247
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   248
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   249
lemma lower_plus_absorb: "xs +\<flat> xs = xs"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   250
apply (induct xs rule: lower_pd.principal_induct, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   251
apply (simp add: PDPlus_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   252
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   253
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   254
interpretation aci_lower_plus: ab_semigroup_idem_mult ["op +\<flat>"]
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   255
  by unfold_locales
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   256
    (rule lower_plus_assoc lower_plus_commute lower_plus_absorb)+
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   257
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   258
lemma lower_plus_left_commute: "xs +\<flat> (ys +\<flat> zs) = ys +\<flat> (xs +\<flat> zs)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   259
by (rule aci_lower_plus.mult_left_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   260
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   261
lemma lower_plus_left_absorb: "xs +\<flat> (xs +\<flat> ys) = xs +\<flat> ys"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   262
by (rule aci_lower_plus.mult_left_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   263
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   264
lemmas lower_plus_aci = aci_lower_plus.mult_ac_idem
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   265
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   266
lemma lower_plus_less1: "xs \<sqsubseteq> xs +\<flat> ys"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   267
apply (induct xs ys rule: lower_pd.principal_induct2, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   268
apply (simp add: PDPlus_lower_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   269
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   270
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   271
lemma lower_plus_less2: "ys \<sqsubseteq> xs +\<flat> ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   272
by (subst lower_plus_commute, rule lower_plus_less1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   273
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   274
lemma lower_plus_least: "\<lbrakk>xs \<sqsubseteq> zs; ys \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs +\<flat> ys \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   275
apply (subst lower_plus_absorb [of zs, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   276
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   277
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   278
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   279
lemma lower_plus_less_iff:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   280
  "xs +\<flat> ys \<sqsubseteq> zs \<longleftrightarrow> xs \<sqsubseteq> zs \<and> ys \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   281
apply safe
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   282
apply (erule trans_less [OF lower_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   283
apply (erule trans_less [OF lower_plus_less2])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   284
apply (erule (1) lower_plus_least)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   285
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   286
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   287
lemma lower_unit_less_plus_iff:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   288
  "{x}\<flat> \<sqsubseteq> ys +\<flat> zs \<longleftrightarrow> {x}\<flat> \<sqsubseteq> ys \<or> {x}\<flat> \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   289
 apply (rule iffI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   290
  apply (subgoal_tac
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   291
    "adm (\<lambda>f. f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>ys \<or> f\<cdot>{x}\<flat> \<sqsubseteq> f\<cdot>zs)")
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25904
diff changeset
   292
   apply (drule admD, rule chain_approx)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   293
    apply (drule_tac f="approx i" in monofun_cfun_arg)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   294
    apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   295
    apply (cut_tac x="approx i\<cdot>ys" in lower_pd.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   296
    apply (cut_tac x="approx i\<cdot>zs" in lower_pd.compact_imp_principal, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   297
    apply (clarify, simp add: lower_le_PDUnit_PDPlus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   298
   apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   299
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   300
 apply (erule disjE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   301
  apply (erule trans_less [OF _ lower_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   302
 apply (erule trans_less [OF _ lower_plus_less2])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   303
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   304
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   305
lemma lower_unit_less_iff [simp]: "{x}\<flat> \<sqsubseteq> {y}\<flat> \<longleftrightarrow> x \<sqsubseteq> y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   306
 apply (rule iffI)
27309
c74270fd72a8 clean up and rename some profinite lemmas
huffman
parents: 27297
diff changeset
   307
  apply (rule profinite_less_ext)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   308
  apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   309
  apply (cut_tac x="approx i\<cdot>x" in compact_basis.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   310
  apply (cut_tac x="approx i\<cdot>y" in compact_basis.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   311
  apply clarsimp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   312
 apply (erule monofun_cfun_arg)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   313
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   314
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   315
lemmas lower_pd_less_simps =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   316
  lower_unit_less_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   317
  lower_plus_less_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   318
  lower_unit_less_plus_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   319
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   320
lemma fooble:
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   321
  fixes f :: "'a::po \<Rightarrow> 'b::po"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   322
  assumes f: "\<And>x y. f x \<sqsubseteq> f y \<longleftrightarrow> x \<sqsubseteq> y"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   323
  shows "f x = f y \<longleftrightarrow> x = y"
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   324
unfolding po_eq_conv by (simp add: f)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   325
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   326
lemma lower_unit_eq_iff [simp]: "{x}\<flat> = {y}\<flat> \<longleftrightarrow> x = y"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   327
by (rule lower_unit_less_iff [THEN fooble])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   328
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   329
lemma lower_unit_strict [simp]: "{\<bottom>}\<flat> = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   330
unfolding inst_lower_pd_pcpo Rep_compact_bot [symmetric] by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   331
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   332
lemma lower_unit_strict_iff [simp]: "{x}\<flat> = \<bottom> \<longleftrightarrow> x = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   333
unfolding lower_unit_strict [symmetric] by (rule lower_unit_eq_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   334
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   335
lemma lower_plus_strict_iff [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   336
  "xs +\<flat> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<and> ys = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   337
apply safe
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   338
apply (rule UU_I, erule subst, rule lower_plus_less1)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   339
apply (rule UU_I, erule subst, rule lower_plus_less2)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   340
apply (rule lower_plus_absorb)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   341
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   342
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   343
lemma lower_plus_strict1 [simp]: "\<bottom> +\<flat> ys = ys"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   344
apply (rule antisym_less [OF _ lower_plus_less2])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   345
apply (simp add: lower_plus_least)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   346
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   347
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   348
lemma lower_plus_strict2 [simp]: "xs +\<flat> \<bottom> = xs"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   349
apply (rule antisym_less [OF _ lower_plus_less1])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   350
apply (simp add: lower_plus_least)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   351
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   352
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   353
lemma compact_lower_unit_iff [simp]: "compact {x}\<flat> \<longleftrightarrow> compact x"
27309
c74270fd72a8 clean up and rename some profinite lemmas
huffman
parents: 27297
diff changeset
   354
unfolding profinite_compact_iff by simp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   355
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   356
lemma compact_lower_plus [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   357
  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<flat> ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   358
by (auto dest!: lower_pd.compact_imp_principal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   359
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   360
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   361
subsection {* Induction rules *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   362
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   363
lemma lower_pd_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   364
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   365
  assumes unit: "\<And>x. P {x}\<flat>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   366
  assumes insert:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   367
    "\<And>x ys. \<lbrakk>P {x}\<flat>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<flat> +\<flat> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   368
  shows "P (xs::'a lower_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   369
apply (induct xs rule: lower_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   370
apply (induct_tac a rule: pd_basis_induct1)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   371
apply (simp only: lower_unit_Rep_compact_basis [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   372
apply (rule unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   373
apply (simp only: lower_unit_Rep_compact_basis [symmetric]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   374
                  lower_plus_principal [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   375
apply (erule insert [OF unit])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   376
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   377
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   378
lemma lower_pd_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   379
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   380
  assumes unit: "\<And>x. P {x}\<flat>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   381
  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<flat> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   382
  shows "P (xs::'a lower_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   383
apply (induct xs rule: lower_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   384
apply (induct_tac a rule: pd_basis_induct)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   385
apply (simp only: lower_unit_Rep_compact_basis [symmetric] unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   386
apply (simp only: lower_plus_principal [symmetric] plus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   387
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   388
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   389
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   390
subsection {* Monadic bind *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   391
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   392
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   393
  lower_bind_basis ::
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   394
  "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   395
  "lower_bind_basis = fold_pd
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   396
    (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   397
    (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   399
lemma ACI_lower_bind:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   400
  "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<flat> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   401
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
   402
apply (simp add: lower_plus_assoc)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   403
apply (simp add: lower_plus_commute)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   404
apply (simp add: lower_plus_absorb eta_cfun)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   405
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   406
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   407
lemma lower_bind_basis_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   408
  "lower_bind_basis (PDUnit a) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   409
    (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   410
  "lower_bind_basis (PDPlus t u) =
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   411
    (\<Lambda> f. lower_bind_basis t\<cdot>f +\<flat> lower_bind_basis u\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   412
unfolding lower_bind_basis_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   413
apply -
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   414
apply (rule fold_pd_PDUnit [OF ACI_lower_bind])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   415
apply (rule fold_pd_PDPlus [OF ACI_lower_bind])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   416
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   417
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   418
lemma lower_bind_basis_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   419
  "t \<le>\<flat> u \<Longrightarrow> lower_bind_basis t \<sqsubseteq> lower_bind_basis u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   420
unfolding expand_cfun_less
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   421
apply (erule lower_le_induct, safe)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   422
apply (simp add: monofun_cfun)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   423
apply (simp add: rev_trans_less [OF lower_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   424
apply (simp add: lower_plus_less_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   425
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   426
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   427
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   428
  lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   429
  "lower_bind = lower_pd.basis_fun lower_bind_basis"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   430
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   431
lemma lower_bind_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   432
  "lower_bind\<cdot>(lower_principal t) = lower_bind_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   433
unfolding lower_bind_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   434
apply (rule lower_pd.basis_fun_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   435
apply (erule lower_bind_basis_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   436
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   437
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   438
lemma lower_bind_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   439
  "lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   440
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   441
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   442
lemma lower_bind_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   443
  "lower_bind\<cdot>(xs +\<flat> ys)\<cdot>f = lower_bind\<cdot>xs\<cdot>f +\<flat> lower_bind\<cdot>ys\<cdot>f"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   444
by (induct xs ys rule: lower_pd.principal_induct2, simp, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   445
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   446
lemma lower_bind_strict [simp]: "lower_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   447
unfolding lower_unit_strict [symmetric] by (rule lower_bind_unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   448
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   449
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   450
subsection {* Map and join *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   451
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   452
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   453
  lower_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a lower_pd \<rightarrow> 'b lower_pd" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   454
  "lower_map = (\<Lambda> f xs. lower_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<flat>))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   455
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   456
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   457
  lower_join :: "'a lower_pd lower_pd \<rightarrow> 'a lower_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   458
  "lower_join = (\<Lambda> xss. lower_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   459
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   460
lemma lower_map_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   461
  "lower_map\<cdot>f\<cdot>{x}\<flat> = {f\<cdot>x}\<flat>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   462
unfolding lower_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   463
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   464
lemma lower_map_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   465
  "lower_map\<cdot>f\<cdot>(xs +\<flat> ys) = lower_map\<cdot>f\<cdot>xs +\<flat> lower_map\<cdot>f\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   466
unfolding lower_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   467
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   468
lemma lower_join_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   469
  "lower_join\<cdot>{xs}\<flat> = xs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   470
unfolding lower_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   471
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   472
lemma lower_join_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   473
  "lower_join\<cdot>(xss +\<flat> yss) = lower_join\<cdot>xss +\<flat> lower_join\<cdot>yss"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   474
unfolding lower_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   475
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   476
lemma lower_map_ident: "lower_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   477
by (induct xs rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   478
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   479
lemma lower_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   480
  "lower_map\<cdot>f\<cdot>(lower_map\<cdot>g\<cdot>xs) = lower_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   481
by (induct xs rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   482
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   483
lemma lower_join_map_unit:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   484
  "lower_join\<cdot>(lower_map\<cdot>lower_unit\<cdot>xs) = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   485
by (induct xs rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   486
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   487
lemma lower_join_map_join:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   488
  "lower_join\<cdot>(lower_map\<cdot>lower_join\<cdot>xsss) = lower_join\<cdot>(lower_join\<cdot>xsss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   489
by (induct xsss rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   490
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   491
lemma lower_join_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   492
  "lower_join\<cdot>(lower_map\<cdot>(lower_map\<cdot>f)\<cdot>xss) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   493
   lower_map\<cdot>f\<cdot>(lower_join\<cdot>xss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   494
by (induct xss rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   495
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   496
lemma lower_map_approx: "lower_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   497
by (induct xs rule: lower_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   498
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   499
end