src/HOLCF/UpperPD.thy
author wenzelm
Thu, 28 Aug 2008 19:29:56 +0200
changeset 28043 4d05f04cc671
parent 27405 785f5dbec8f4
child 29138 661a8db7e647
child 29237 e90d9d51106b
permissions -rw-r--r--
refined option -W: output stream;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/UpperPD.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 {* Upper powerdomain *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     8
theory UpperPD
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
  upper_le :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix "\<le>\<sharp>" 50) where
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    16
  "upper_le = (\<lambda>u v. \<forall>y\<in>Rep_pd_basis v. \<exists>x\<in>Rep_pd_basis u. 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 upper_le_refl [simp]: "t \<le>\<sharp> t"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    19
unfolding upper_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 upper_le_trans: "\<lbrakk>t \<le>\<sharp> u; u \<le>\<sharp> v\<rbrakk> \<Longrightarrow> t \<le>\<sharp> v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    22
unfolding upper_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 upper_le: preorder [upper_le]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
by (rule preorder.intro, rule upper_le_refl, rule upper_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<sharp> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    34
unfolding upper_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    35
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    36
lemma PDUnit_upper_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<sharp> PDUnit y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    37
unfolding upper_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    39
lemma PDPlus_upper_mono: "\<lbrakk>s \<le>\<sharp> t; u \<le>\<sharp> v\<rbrakk> \<Longrightarrow> PDPlus s u \<le>\<sharp> PDPlus t v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    40
unfolding upper_le_def Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    41
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    42
lemma PDPlus_upper_less: "PDPlus t u \<le>\<sharp> t"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    43
unfolding upper_le_def Rep_PDPlus by fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    44
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    45
lemma upper_le_PDUnit_PDUnit_iff [simp]:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    46
  "(PDUnit a \<le>\<sharp> PDUnit b) = a \<sqsubseteq> b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    47
unfolding upper_le_def Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    49
lemma upper_le_PDPlus_PDUnit_iff:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    50
  "(PDPlus t u \<le>\<sharp> PDUnit a) = (t \<le>\<sharp> PDUnit a \<or> u \<le>\<sharp> PDUnit a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    51
unfolding upper_le_def Rep_PDPlus Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    52
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    53
lemma upper_le_PDPlus_iff: "(t \<le>\<sharp> PDPlus u v) = (t \<le>\<sharp> u \<and> t \<le>\<sharp> v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
unfolding upper_le_def Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    55
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    56
lemma upper_le_induct [induct set: upper_le]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    57
  assumes le: "t \<le>\<sharp> u"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    58
  assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    59
  assumes 2: "\<And>t u a. P t (PDUnit a) \<Longrightarrow> P (PDPlus t u) (PDUnit a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    60
  assumes 3: "\<And>t u v. \<lbrakk>P t u; P t v\<rbrakk> \<Longrightarrow> P t (PDPlus u v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    61
  shows "P t u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    62
using le apply (induct u arbitrary: t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    63
apply (erule rev_mp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    64
apply (induct_tac t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    65
apply (simp add: 1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    66
apply (simp add: upper_le_PDPlus_PDUnit_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    67
apply (simp add: 2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    68
apply (subst PDPlus_commute)
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 (simp add: upper_le_PDPlus_iff 3)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    71
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    72
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    73
lemma pd_take_upper_chain:
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    74
  "pd_take n t \<le>\<sharp> pd_take (Suc n) t"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    75
apply (induct t rule: pd_basis_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    76
apply (simp add: compact_basis.take_chain)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    77
apply (simp add: PDPlus_upper_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    78
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    79
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    80
lemma pd_take_upper_le: "pd_take i t \<le>\<sharp> t"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    81
apply (induct t rule: pd_basis_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    82
apply (simp add: compact_basis.take_less)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    83
apply (simp add: PDPlus_upper_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    84
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    85
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    86
lemma pd_take_upper_mono:
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
    87
  "t \<le>\<sharp> u \<Longrightarrow> pd_take n t \<le>\<sharp> pd_take n u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    88
apply (erule upper_le_induct)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
    89
apply (simp add: compact_basis.take_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    90
apply (simp add: upper_le_PDPlus_PDUnit_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    91
apply (simp add: upper_le_PDPlus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    92
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    93
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    94
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    95
subsection {* Type definition *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    96
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    97
typedef (open) 'a upper_pd =
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    98
  "{S::'a pd_basis set. upper_le.ideal S}"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    99
by (fast intro: upper_le.ideal_principal)
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   100
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   101
instantiation upper_pd :: (profinite) sq_ord
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   102
begin
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   103
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   104
definition
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   105
  "x \<sqsubseteq> y \<longleftrightarrow> Rep_upper_pd x \<subseteq> Rep_upper_pd y"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   106
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   107
instance ..
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   108
end
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   109
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   110
instance upper_pd :: (profinite) po
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   111
by (rule upper_le.typedef_ideal_po
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   112
    [OF type_definition_upper_pd sq_le_upper_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   113
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   114
instance upper_pd :: (profinite) cpo
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   115
by (rule upper_le.typedef_ideal_cpo
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   116
    [OF type_definition_upper_pd sq_le_upper_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   117
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   118
lemma Rep_upper_pd_lub:
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   119
  "chain Y \<Longrightarrow> Rep_upper_pd (\<Squnion>i. Y i) = (\<Union>i. Rep_upper_pd (Y i))"
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   120
by (rule upper_le.typedef_ideal_rep_contlub
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   121
    [OF type_definition_upper_pd sq_le_upper_pd_def])
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   122
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   123
lemma ideal_Rep_upper_pd: "upper_le.ideal (Rep_upper_pd xs)"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   124
by (rule Rep_upper_pd [unfolded mem_Collect_eq])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   125
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   126
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   127
  upper_principal :: "'a pd_basis \<Rightarrow> 'a upper_pd" where
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   128
  "upper_principal t = Abs_upper_pd {u. u \<le>\<sharp> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   129
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   130
lemma Rep_upper_principal:
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   131
  "Rep_upper_pd (upper_principal t) = {u. u \<le>\<sharp> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   132
unfolding upper_principal_def
27297
2c42b1505f25 removed SetPcpo.thy and cpo instance for type bool;
huffman
parents: 27289
diff changeset
   133
by (simp add: Abs_upper_pd_inverse upper_le.ideal_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   135
interpretation upper_pd:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   136
  ideal_completion [upper_le pd_take upper_principal Rep_upper_pd]
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   137
apply unfold_locales
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   138
apply (rule pd_take_upper_le)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   139
apply (rule pd_take_idem)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   140
apply (erule pd_take_upper_mono)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   141
apply (rule pd_take_upper_chain)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   142
apply (rule finite_range_pd_take)
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   143
apply (rule pd_take_covers)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   144
apply (rule ideal_Rep_upper_pd)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   145
apply (erule Rep_upper_pd_lub)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   146
apply (rule Rep_upper_principal)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   147
apply (simp only: sq_le_upper_pd_def)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   148
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   149
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   150
text {* Upper powerdomain is pointed *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   151
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   152
lemma upper_pd_minimal: "upper_principal (PDUnit compact_bot) \<sqsubseteq> ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   153
by (induct ys rule: upper_pd.principal_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   154
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   155
instance upper_pd :: (bifinite) pcpo
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   156
by intro_classes (fast intro: upper_pd_minimal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   157
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   158
lemma inst_upper_pd_pcpo: "\<bottom> = upper_principal (PDUnit compact_bot)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   159
by (rule upper_pd_minimal [THEN UU_I, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   160
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   161
text {* Upper powerdomain is profinite *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   162
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   163
instantiation upper_pd :: (profinite) profinite
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   164
begin
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   165
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   166
definition
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   167
  approx_upper_pd_def: "approx = upper_pd.completion_approx"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   168
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   169
instance
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   170
apply (intro_classes, unfold approx_upper_pd_def)
27310
d0229bc6c461 simplify profinite class axioms
huffman
parents: 27309
diff changeset
   171
apply (rule upper_pd.chain_completion_approx)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   172
apply (rule upper_pd.lub_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   173
apply (rule upper_pd.completion_approx_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   174
apply (rule upper_pd.finite_fixes_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   175
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   176
26962
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   177
end
c8b20f615d6c use new class package for classes profinite, bifinite; remove approx class
huffman
parents: 26927
diff changeset
   178
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   179
instance upper_pd :: (bifinite) bifinite ..
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   180
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   181
lemma approx_upper_principal [simp]:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   182
  "approx n\<cdot>(upper_principal t) = upper_principal (pd_take n t)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   183
unfolding approx_upper_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   184
by (rule upper_pd.completion_approx_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   185
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   186
lemma approx_eq_upper_principal:
27405
785f5dbec8f4 rename approx_pd to pd_take
huffman
parents: 27373
diff changeset
   187
  "\<exists>t\<in>Rep_upper_pd xs. approx n\<cdot>xs = upper_principal (pd_take n t)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   188
unfolding approx_upper_pd_def
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   189
by (rule upper_pd.completion_approx_eq_principal)
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   190
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   191
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   192
subsection {* Monadic unit and plus *}
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   193
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   194
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   195
  upper_unit :: "'a \<rightarrow> 'a upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   196
  "upper_unit = compact_basis.basis_fun (\<lambda>a. upper_principal (PDUnit a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   197
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   198
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   199
  upper_plus :: "'a upper_pd \<rightarrow> 'a upper_pd \<rightarrow> 'a upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   200
  "upper_plus = upper_pd.basis_fun (\<lambda>t. upper_pd.basis_fun (\<lambda>u.
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   201
      upper_principal (PDPlus t u)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   202
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   203
abbreviation
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   204
  upper_add :: "'a upper_pd \<Rightarrow> 'a upper_pd \<Rightarrow> 'a upper_pd"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   205
    (infixl "+\<sharp>" 65) where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   206
  "xs +\<sharp> ys == upper_plus\<cdot>xs\<cdot>ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   207
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   208
syntax
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   209
  "_upper_pd" :: "args \<Rightarrow> 'a upper_pd" ("{_}\<sharp>")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   210
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   211
translations
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   212
  "{x,xs}\<sharp>" == "{x}\<sharp> +\<sharp> {xs}\<sharp>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   213
  "{x}\<sharp>" == "CONST upper_unit\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   214
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   215
lemma upper_unit_Rep_compact_basis [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   216
  "{Rep_compact_basis a}\<sharp> = upper_principal (PDUnit a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   217
unfolding upper_unit_def
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   218
by (simp add: compact_basis.basis_fun_principal PDUnit_upper_mono)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   219
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   220
lemma upper_plus_principal [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   221
  "upper_principal t +\<sharp> upper_principal u = upper_principal (PDPlus t u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   222
unfolding upper_plus_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   223
by (simp add: upper_pd.basis_fun_principal
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   224
    upper_pd.basis_fun_mono PDPlus_upper_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   225
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   226
lemma approx_upper_unit [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   227
  "approx n\<cdot>{x}\<sharp> = {approx n\<cdot>x}\<sharp>"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   228
apply (induct x rule: compact_basis.principal_induct, simp)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   229
apply (simp add: approx_Rep_compact_basis)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   230
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   231
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   232
lemma approx_upper_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   233
  "approx n\<cdot>(xs +\<sharp> ys) = (approx n\<cdot>xs) +\<sharp> (approx n\<cdot>ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   234
by (induct xs ys rule: upper_pd.principal_induct2, simp, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   235
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   236
lemma upper_plus_assoc: "(xs +\<sharp> ys) +\<sharp> zs = xs +\<sharp> (ys +\<sharp> zs)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   237
apply (induct xs ys arbitrary: zs rule: upper_pd.principal_induct2, simp, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   238
apply (rule_tac x=zs in upper_pd.principal_induct, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   239
apply (simp add: PDPlus_assoc)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   240
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   241
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   242
lemma upper_plus_commute: "xs +\<sharp> ys = ys +\<sharp> xs"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   243
apply (induct xs ys rule: upper_pd.principal_induct2, simp, simp)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   244
apply (simp add: PDPlus_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   245
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   246
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   247
lemma upper_plus_absorb: "xs +\<sharp> xs = xs"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   248
apply (induct xs rule: upper_pd.principal_induct, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   249
apply (simp add: PDPlus_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   250
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   251
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   252
interpretation aci_upper_plus: ab_semigroup_idem_mult ["op +\<sharp>"]
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   253
  by unfold_locales
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   254
    (rule upper_plus_assoc upper_plus_commute upper_plus_absorb)+
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   255
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   256
lemma upper_plus_left_commute: "xs +\<sharp> (ys +\<sharp> zs) = ys +\<sharp> (xs +\<sharp> zs)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   257
by (rule aci_upper_plus.mult_left_commute)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   258
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   259
lemma upper_plus_left_absorb: "xs +\<sharp> (xs +\<sharp> ys) = xs +\<sharp> ys"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   260
by (rule aci_upper_plus.mult_left_idem)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   261
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   262
lemmas upper_plus_aci = aci_upper_plus.mult_ac_idem
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   263
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   264
lemma upper_plus_less1: "xs +\<sharp> ys \<sqsubseteq> xs"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   265
apply (induct xs ys rule: upper_pd.principal_induct2, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   266
apply (simp add: PDPlus_upper_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   267
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   268
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   269
lemma upper_plus_less2: "xs +\<sharp> ys \<sqsubseteq> ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   270
by (subst upper_plus_commute, rule upper_plus_less1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   271
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   272
lemma upper_plus_greatest: "\<lbrakk>xs \<sqsubseteq> ys; xs \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs \<sqsubseteq> ys +\<sharp> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   273
apply (subst upper_plus_absorb [of xs, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   274
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   275
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   276
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   277
lemma upper_less_plus_iff:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   278
  "xs \<sqsubseteq> ys +\<sharp> zs \<longleftrightarrow> xs \<sqsubseteq> ys \<and> xs \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   279
apply safe
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   280
apply (erule trans_less [OF _ upper_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   281
apply (erule trans_less [OF _ upper_plus_less2])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   282
apply (erule (1) upper_plus_greatest)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   283
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   284
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   285
lemma upper_plus_less_unit_iff:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   286
  "xs +\<sharp> ys \<sqsubseteq> {z}\<sharp> \<longleftrightarrow> xs \<sqsubseteq> {z}\<sharp> \<or> ys \<sqsubseteq> {z}\<sharp>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   287
 apply (rule iffI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   288
  apply (subgoal_tac
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   289
    "adm (\<lambda>f. f\<cdot>xs \<sqsubseteq> f\<cdot>{z}\<sharp> \<or> f\<cdot>ys \<sqsubseteq> f\<cdot>{z}\<sharp>)")
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25904
diff changeset
   290
   apply (drule admD, rule chain_approx)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   291
    apply (drule_tac f="approx i" in monofun_cfun_arg)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   292
    apply (cut_tac x="approx i\<cdot>xs" in upper_pd.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   293
    apply (cut_tac x="approx i\<cdot>ys" in upper_pd.compact_imp_principal, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   294
    apply (cut_tac x="approx i\<cdot>z" in compact_basis.compact_imp_principal, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   295
    apply (clarify, simp add: upper_le_PDPlus_PDUnit_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   296
   apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   297
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   298
 apply (erule disjE)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   299
  apply (erule trans_less [OF upper_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   300
 apply (erule trans_less [OF upper_plus_less2])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   301
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   302
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   303
lemma upper_unit_less_iff [simp]: "{x}\<sharp> \<sqsubseteq> {y}\<sharp> \<longleftrightarrow> x \<sqsubseteq> y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   304
 apply (rule iffI)
27309
c74270fd72a8 clean up and rename some profinite lemmas
huffman
parents: 27297
diff changeset
   305
  apply (rule profinite_less_ext)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   306
  apply (drule_tac f="approx i" in monofun_cfun_arg, simp)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   307
  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
   308
  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
   309
  apply clarsimp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   310
 apply (erule monofun_cfun_arg)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   311
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   312
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   313
lemmas upper_pd_less_simps =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   314
  upper_unit_less_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   315
  upper_less_plus_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   316
  upper_plus_less_unit_iff
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   317
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   318
lemma upper_unit_eq_iff [simp]: "{x}\<sharp> = {y}\<sharp> \<longleftrightarrow> x = y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   319
unfolding po_eq_conv by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   320
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   321
lemma upper_unit_strict [simp]: "{\<bottom>}\<sharp> = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   322
unfolding inst_upper_pd_pcpo Rep_compact_bot [symmetric] by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   323
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   324
lemma upper_plus_strict1 [simp]: "\<bottom> +\<sharp> ys = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   325
by (rule UU_I, rule upper_plus_less1)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   326
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   327
lemma upper_plus_strict2 [simp]: "xs +\<sharp> \<bottom> = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   328
by (rule UU_I, rule upper_plus_less2)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   329
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   330
lemma upper_unit_strict_iff [simp]: "{x}\<sharp> = \<bottom> \<longleftrightarrow> x = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   331
unfolding upper_unit_strict [symmetric] by (rule upper_unit_eq_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   332
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   333
lemma upper_plus_strict_iff [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   334
  "xs +\<sharp> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<or> ys = \<bottom>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   335
apply (rule iffI)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   336
apply (erule rev_mp)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   337
apply (rule upper_pd.principal_induct2 [where x=xs and y=ys], simp, simp)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   338
apply (simp add: inst_upper_pd_pcpo upper_pd.principal_eq_iff
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   339
                 upper_le_PDPlus_PDUnit_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   340
apply auto
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 compact_upper_unit_iff [simp]: "compact {x}\<sharp> \<longleftrightarrow> compact x"
27309
c74270fd72a8 clean up and rename some profinite lemmas
huffman
parents: 27297
diff changeset
   344
unfolding profinite_compact_iff by simp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   345
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   346
lemma compact_upper_plus [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   347
  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs +\<sharp> ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   348
by (auto dest!: upper_pd.compact_imp_principal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   349
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   350
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   351
subsection {* Induction rules *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   352
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   353
lemma upper_pd_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   354
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   355
  assumes unit: "\<And>x. P {x}\<sharp>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   356
  assumes insert: "\<And>x ys. \<lbrakk>P {x}\<sharp>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<sharp> +\<sharp> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   357
  shows "P (xs::'a upper_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   358
apply (induct xs rule: upper_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   359
apply (induct_tac a rule: pd_basis_induct1)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   360
apply (simp only: upper_unit_Rep_compact_basis [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   361
apply (rule unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   362
apply (simp only: upper_unit_Rep_compact_basis [symmetric]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   363
                  upper_plus_principal [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   364
apply (erule insert [OF unit])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   365
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   366
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   367
lemma upper_pd_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   368
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   369
  assumes unit: "\<And>x. P {x}\<sharp>"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   370
  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs +\<sharp> ys)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   371
  shows "P (xs::'a upper_pd)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   372
apply (induct xs rule: upper_pd.principal_induct, rule P)
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   373
apply (induct_tac a rule: pd_basis_induct)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   374
apply (simp only: upper_unit_Rep_compact_basis [symmetric] unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   375
apply (simp only: upper_plus_principal [symmetric] plus)
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
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   379
subsection {* Monadic bind *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   380
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   381
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   382
  upper_bind_basis ::
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   383
  "'a pd_basis \<Rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   384
  "upper_bind_basis = fold_pd
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   385
    (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   386
    (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   387
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   388
lemma ACI_upper_bind:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   389
  "ab_semigroup_idem_mult (\<lambda>x y. \<Lambda> f. x\<cdot>f +\<sharp> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   390
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
   391
apply (simp add: upper_plus_assoc)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   392
apply (simp add: upper_plus_commute)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   393
apply (simp add: upper_plus_absorb eta_cfun)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   394
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   395
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   396
lemma upper_bind_basis_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   397
  "upper_bind_basis (PDUnit a) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
    (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   399
  "upper_bind_basis (PDPlus t u) =
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   400
    (\<Lambda> f. upper_bind_basis t\<cdot>f +\<sharp> upper_bind_basis u\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   401
unfolding upper_bind_basis_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   402
apply -
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   403
apply (rule fold_pd_PDUnit [OF ACI_upper_bind])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   404
apply (rule fold_pd_PDPlus [OF ACI_upper_bind])
25904
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 upper_bind_basis_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   408
  "t \<le>\<sharp> u \<Longrightarrow> upper_bind_basis t \<sqsubseteq> upper_bind_basis u"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   409
unfolding expand_cfun_less
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   410
apply (erule upper_le_induct, safe)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   411
apply (simp add: monofun_cfun)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   412
apply (simp add: trans_less [OF upper_plus_less1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   413
apply (simp add: upper_less_plus_iff)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   414
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   415
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   416
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   417
  upper_bind :: "'a upper_pd \<rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   418
  "upper_bind = upper_pd.basis_fun upper_bind_basis"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   419
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   420
lemma upper_bind_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   421
  "upper_bind\<cdot>(upper_principal t) = upper_bind_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   422
unfolding upper_bind_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   423
apply (rule upper_pd.basis_fun_principal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   424
apply (erule upper_bind_basis_mono)
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
lemma upper_bind_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   428
  "upper_bind\<cdot>{x}\<sharp>\<cdot>f = f\<cdot>x"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   429
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   430
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   431
lemma upper_bind_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   432
  "upper_bind\<cdot>(xs +\<sharp> ys)\<cdot>f = upper_bind\<cdot>xs\<cdot>f +\<sharp> upper_bind\<cdot>ys\<cdot>f"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   433
by (induct xs ys rule: upper_pd.principal_induct2, simp, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   434
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   435
lemma upper_bind_strict [simp]: "upper_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   436
unfolding upper_unit_strict [symmetric] by (rule upper_bind_unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   437
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   438
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   439
subsection {* Map and join *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   440
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   441
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   442
  upper_map :: "('a \<rightarrow> 'b) \<rightarrow> 'a upper_pd \<rightarrow> 'b upper_pd" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   443
  "upper_map = (\<Lambda> f xs. upper_bind\<cdot>xs\<cdot>(\<Lambda> x. {f\<cdot>x}\<sharp>))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   444
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   445
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   446
  upper_join :: "'a upper_pd upper_pd \<rightarrow> 'a upper_pd" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   447
  "upper_join = (\<Lambda> xss. upper_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   448
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   449
lemma upper_map_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   450
  "upper_map\<cdot>f\<cdot>{x}\<sharp> = {f\<cdot>x}\<sharp>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   451
unfolding upper_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   452
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   453
lemma upper_map_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   454
  "upper_map\<cdot>f\<cdot>(xs +\<sharp> ys) = upper_map\<cdot>f\<cdot>xs +\<sharp> upper_map\<cdot>f\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   455
unfolding upper_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   456
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   457
lemma upper_join_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   458
  "upper_join\<cdot>{xs}\<sharp> = xs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   459
unfolding upper_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   460
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   461
lemma upper_join_plus [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   462
  "upper_join\<cdot>(xss +\<sharp> yss) = upper_join\<cdot>xss +\<sharp> upper_join\<cdot>yss"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   463
unfolding upper_join_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   464
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   465
lemma upper_map_ident: "upper_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   466
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   467
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   468
lemma upper_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   469
  "upper_map\<cdot>f\<cdot>(upper_map\<cdot>g\<cdot>xs) = upper_map\<cdot>(\<Lambda> x. f\<cdot>(g\<cdot>x))\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   470
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   471
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   472
lemma upper_join_map_unit:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   473
  "upper_join\<cdot>(upper_map\<cdot>upper_unit\<cdot>xs) = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   474
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   475
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   476
lemma upper_join_map_join:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   477
  "upper_join\<cdot>(upper_map\<cdot>upper_join\<cdot>xsss) = upper_join\<cdot>(upper_join\<cdot>xsss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   478
by (induct xsss rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   479
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   480
lemma upper_join_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   481
  "upper_join\<cdot>(upper_map\<cdot>(upper_map\<cdot>f)\<cdot>xss) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   482
   upper_map\<cdot>f\<cdot>(upper_join\<cdot>xss)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   483
by (induct xss rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   484
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   485
lemma upper_map_approx: "upper_map\<cdot>(approx n)\<cdot>xs = approx n\<cdot>xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   486
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   487
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   488
end