src/HOL/HOLCF/UpperPD.thy
author haftmann
Thu, 19 Jun 2025 17:15:40 +0200
changeset 82734 89347c0cc6a3
parent 81620 2cb49d09f059
permissions -rw-r--r--
treat map_filter similar to list_all, list_ex, list_ex1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42151
4da4fc77664b tuned headers;
wenzelm
parents: 41479
diff changeset
     1
(*  Title:      HOL/HOLCF/UpperPD.thy
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     3
*)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     4
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
     5
section \<open>Upper powerdomain\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     6
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
theory UpperPD
41284
6d66975b711f renamed CompactBasis.thy to Compact_Basis.thy
huffman
parents: 41111
diff changeset
     8
imports Compact_Basis
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     9
begin
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    10
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
    11
subsection \<open>Basis preorder\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    12
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    13
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
    14
  upper_le :: "'a::bifinite pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> bool" (infix \<open>\<le>\<sharp>\<close> 50) where
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    15
  "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
    16
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    17
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
    18
unfolding upper_le_def by fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    19
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    20
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
    21
unfolding upper_le_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    22
apply (rule ballI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    23
apply (drule (1) bspec, erule bexE)
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 (erule rev_bexI)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    26
apply (erule (1) below_trans)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    27
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    28
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29990
diff changeset
    29
interpretation upper_le: preorder upper_le
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    30
by (rule preorder.intro, rule upper_le_refl, rule upper_le_trans)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
lemma upper_le_minimal [simp]: "PDUnit compact_bot \<le>\<sharp> t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
unfolding upper_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    34
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    35
lemma PDUnit_upper_mono: "x \<sqsubseteq> y \<Longrightarrow> PDUnit x \<le>\<sharp> PDUnit y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    36
unfolding upper_le_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    37
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
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
    39
unfolding upper_le_def Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    40
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
    41
lemma PDPlus_upper_le: "PDPlus t u \<le>\<sharp> t"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    42
unfolding upper_le_def Rep_PDPlus by fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    43
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    44
lemma upper_le_PDUnit_PDUnit_iff [simp]:
40436
adb22dbb5242 (infixl "<<" 55) -> (infix "<<" 50)
huffman
parents: 40327
diff changeset
    45
  "(PDUnit a \<le>\<sharp> PDUnit b) = (a \<sqsubseteq> b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    46
unfolding upper_le_def Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    47
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
lemma upper_le_PDPlus_PDUnit_iff:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    49
  "(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
    50
unfolding upper_le_def Rep_PDPlus Rep_PDUnit by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    51
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    52
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
    53
unfolding upper_le_def Rep_PDPlus by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    55
lemma upper_le_induct [induct set: upper_le]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    56
  assumes le: "t \<le>\<sharp> u"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    57
  assumes 1: "\<And>a b. a \<sqsubseteq> b \<Longrightarrow> P (PDUnit a) (PDUnit b)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    58
  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
    59
  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
    60
  shows "P t u"
81620
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    61
  using le
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    62
proof (induct u arbitrary: t rule: pd_basis_induct)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    63
  case (PDUnit a)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    64
  then show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    65
  proof (induct t rule: pd_basis_induct)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    66
    case PDUnit
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    67
    then show ?case by (simp add: 1)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    68
  next
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    69
    case (PDPlus t u)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    70
    from PDPlus(3) consider (t) "t \<le>\<sharp> PDUnit a" | (u) "u \<le>\<sharp> PDUnit a"
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    71
      by (auto simp: upper_le_PDPlus_PDUnit_iff)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    72
    then show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    73
    proof cases
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    74
      case t
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    75
      then have "P t (PDUnit a)" by (rule PDPlus(1))
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    76
      then show ?thesis by (rule 2)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    77
    next
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    78
      case u
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    79
      then have "P u (PDUnit a)" by (rule PDPlus(2))
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    80
      then have "P (PDPlus u t) (PDUnit a)" by (rule 2)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    81
      then show ?thesis by (simp only: PDPlus_commute)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    82
    qed
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    83
  qed
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    84
next
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    85
  case (PDPlus t t' u)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    86
  then show ?case by (simp add: upper_le_PDPlus_iff 3)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
    87
qed
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    88
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    89
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
    90
subsection \<open>Type definition\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    91
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
    92
typedef 'a::bifinite upper_pd  (\<open>(\<open>notation=\<open>postfix upper_pd\<close>\<close>'(_')\<sharp>)\<close>) =
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    93
  "{S::'a pd_basis set. upper_le.ideal S}"
40888
28cd51cff70c reformulate lemma preorder.ex_ideal, and use it for typedefs
huffman
parents: 40774
diff changeset
    94
by (rule upper_le.ex_ideal)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    95
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
    96
instantiation upper_pd :: (bifinite) below
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    97
begin
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    98
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
    99
definition
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   100
  "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
   101
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   102
instance ..
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   103
end
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   104
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   105
instance upper_pd :: (bifinite) po
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   106
using type_definition_upper_pd below_upper_pd_def
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   107
by (rule upper_le.typedef_ideal_po)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   108
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   109
instance upper_pd :: (bifinite) cpo
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   110
using type_definition_upper_pd below_upper_pd_def
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   111
by (rule upper_le.typedef_ideal_cpo)
27373
5794a0e3e26c remove cset theory; define ideal completions using typedef instead of cpodef
huffman
parents: 27310
diff changeset
   112
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   113
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   114
  upper_principal :: "'a::bifinite 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
   115
  "upper_principal t = Abs_upper_pd {u. u \<le>\<sharp> t}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   116
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 29990
diff changeset
   117
interpretation upper_pd:
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   118
  ideal_completion upper_le upper_principal Rep_upper_pd
39984
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   119
using type_definition_upper_pd below_upper_pd_def
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   120
using upper_principal_def pd_basis_countable
0300d5170622 add lemma typedef_ideal_completion
huffman
parents: 39974
diff changeset
   121
by (rule upper_le.typedef_ideal_completion)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   122
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   123
text \<open>Upper powerdomain is pointed\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   124
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   125
lemma upper_pd_minimal: "upper_principal (PDUnit compact_bot) \<sqsubseteq> ys"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   126
by (induct ys rule: upper_pd.principal_induct, simp, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   127
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   128
instance upper_pd :: (bifinite) pcpo
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   129
by intro_classes (fast intro: upper_pd_minimal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   130
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   131
lemma inst_upper_pd_pcpo: "\<bottom> = upper_principal (PDUnit compact_bot)"
41430
1aa23e9f2c87 change some lemma names containing 'UU' to 'bottom'
huffman
parents: 41402
diff changeset
   132
by (rule upper_pd_minimal [THEN bottomI, symmetric])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   133
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   135
subsection \<open>Monadic unit and plus\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   136
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   137
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   138
  upper_unit :: "'a::bifinite \<rightarrow> 'a upper_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   139
  "upper_unit = compact_basis.extension (\<lambda>a. upper_principal (PDUnit a))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   140
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   141
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   142
  upper_plus :: "'a::bifinite upper_pd \<rightarrow> 'a upper_pd \<rightarrow> 'a upper_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   143
  "upper_plus = upper_pd.extension (\<lambda>t. upper_pd.extension (\<lambda>u.
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   144
      upper_principal (PDPlus t u)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   145
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   146
abbreviation
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   147
  upper_add :: "'a::bifinite upper_pd \<Rightarrow> 'a upper_pd \<Rightarrow> 'a upper_pd"
80914
d97fdabd9e2b standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents: 80786
diff changeset
   148
    (infixl \<open>\<union>\<sharp>\<close> 65) where
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   149
  "xs \<union>\<sharp> ys == upper_plus\<cdot>xs\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   150
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   151
syntax
81089
8042869c2072 clarified syntax: prefer nonterminal "args", use outer block (with indent);
wenzelm
parents: 80914
diff changeset
   152
  "_upper_pd" :: "args \<Rightarrow> logic"  (\<open>(\<open>indent=1 notation=\<open>mixfix upper_pd enumeration\<close>\<close>{_}\<sharp>)\<close>)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   153
translations
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   154
  "{x,xs}\<sharp>" == "{x}\<sharp> \<union>\<sharp> {xs}\<sharp>"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   155
  "{x}\<sharp>" == "CONST upper_unit\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   156
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   157
lemma upper_unit_Rep_compact_basis [simp]:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   158
  "{Rep_compact_basis a}\<sharp> = upper_principal (PDUnit a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   159
unfolding upper_unit_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   160
by (simp add: compact_basis.extension_principal PDUnit_upper_mono)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   161
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   162
lemma upper_plus_principal [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   163
  "upper_principal t \<union>\<sharp> upper_principal u = upper_principal (PDPlus t u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   164
unfolding upper_plus_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   165
by (simp add: upper_pd.extension_principal
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   166
    upper_pd.extension_mono PDPlus_upper_mono)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   167
37770
cddb3106adb8 avoid explicit mandatory prefix markers when prefixes are mandatory implicitly
haftmann
parents: 36635
diff changeset
   168
interpretation upper_add: semilattice upper_add proof
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   169
  fix xs ys zs :: "'a upper_pd"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   170
  show "(xs \<union>\<sharp> ys) \<union>\<sharp> zs = xs \<union>\<sharp> (ys \<union>\<sharp> zs)"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   171
    apply (induct xs rule: upper_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   172
    apply (induct ys rule: upper_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   173
    apply (induct zs rule: upper_pd.principal_induct, simp)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   174
    apply (simp add: PDPlus_assoc)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   175
    done
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   176
  show "xs \<union>\<sharp> ys = ys \<union>\<sharp> xs"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   177
    apply (induct xs rule: upper_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   178
    apply (induct ys rule: upper_pd.principal_induct, simp)
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   179
    apply (simp add: PDPlus_commute)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   180
    done
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   181
  show "xs \<union>\<sharp> xs = xs"
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   182
    apply (induct xs rule: upper_pd.principal_induct, simp)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   183
    apply (simp add: PDPlus_absorb)
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   184
    done
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   185
qed
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   186
34973
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   187
lemmas upper_plus_assoc = upper_add.assoc
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   188
lemmas upper_plus_commute = upper_add.commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   189
lemmas upper_plus_absorb = upper_add.idem
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   190
lemmas upper_plus_left_commute = upper_add.left_commute
ae634fad947e dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents: 33808
diff changeset
   191
lemmas upper_plus_left_absorb = upper_add.left_idem
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   192
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   193
text \<open>Useful for \<open>simp add: upper_plus_ac\<close>\<close>
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   194
lemmas upper_plus_ac =
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   195
  upper_plus_assoc upper_plus_commute upper_plus_left_commute
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   196
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   197
text \<open>Useful for \<open>simp only: upper_plus_aci\<close>\<close>
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   198
lemmas upper_plus_aci =
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   199
  upper_plus_ac upper_plus_absorb upper_plus_left_absorb
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   200
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   201
lemma upper_plus_below1: "xs \<union>\<sharp> ys \<sqsubseteq> xs"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   202
apply (induct xs rule: upper_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   203
apply (induct ys rule: upper_pd.principal_induct, simp)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   204
apply (simp add: PDPlus_upper_le)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   205
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   206
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   207
lemma upper_plus_below2: "xs \<union>\<sharp> ys \<sqsubseteq> ys"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   208
by (subst upper_plus_commute, rule upper_plus_below1)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   209
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   210
lemma upper_plus_greatest: "\<lbrakk>xs \<sqsubseteq> ys; xs \<sqsubseteq> zs\<rbrakk> \<Longrightarrow> xs \<sqsubseteq> ys \<union>\<sharp> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   211
apply (subst upper_plus_absorb [of xs, symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   212
apply (erule (1) monofun_cfun [OF monofun_cfun_arg])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   213
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   214
40734
a292fc5157f8 declare more simp rules for powerdomains
huffman
parents: 40589
diff changeset
   215
lemma upper_below_plus_iff [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   216
  "xs \<sqsubseteq> ys \<union>\<sharp> zs \<longleftrightarrow> xs \<sqsubseteq> ys \<and> xs \<sqsubseteq> zs"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   217
apply safe
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   218
apply (erule below_trans [OF _ upper_plus_below1])
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   219
apply (erule below_trans [OF _ upper_plus_below2])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   220
apply (erule (1) upper_plus_greatest)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   221
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   222
40734
a292fc5157f8 declare more simp rules for powerdomains
huffman
parents: 40589
diff changeset
   223
lemma upper_plus_below_unit_iff [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   224
  "xs \<union>\<sharp> ys \<sqsubseteq> {z}\<sharp> \<longleftrightarrow> xs \<sqsubseteq> {z}\<sharp> \<or> ys \<sqsubseteq> {z}\<sharp>"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   225
apply (induct xs rule: upper_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   226
apply (induct ys rule: upper_pd.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   227
apply (induct z rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   228
apply (simp add: upper_le_PDPlus_PDUnit_iff)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   229
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   230
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   231
lemma upper_unit_below_iff [simp]: "{x}\<sharp> \<sqsubseteq> {y}\<sharp> \<longleftrightarrow> x \<sqsubseteq> y"
39970
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   232
apply (induct x rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   233
apply (induct y rule: compact_basis.principal_induct, simp)
9023b897e67a simplify proofs of powerdomain inequalities
Brian Huffman <brianh@cs.pdx.edu>
parents: 37770
diff changeset
   234
apply simp
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   235
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   236
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   237
lemmas upper_pd_below_simps =
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   238
  upper_unit_below_iff
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   239
  upper_below_plus_iff
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   240
  upper_plus_below_unit_iff
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   241
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   242
lemma upper_unit_eq_iff [simp]: "{x}\<sharp> = {y}\<sharp> \<longleftrightarrow> x = y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   243
unfolding po_eq_conv by simp
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   244
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   245
lemma upper_unit_strict [simp]: "{\<bottom>}\<sharp> = \<bottom>"
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   246
using upper_unit_Rep_compact_basis [of compact_bot]
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   247
by (simp add: inst_upper_pd_pcpo)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   248
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   249
lemma upper_plus_strict1 [simp]: "\<bottom> \<union>\<sharp> ys = \<bottom>"
41430
1aa23e9f2c87 change some lemma names containing 'UU' to 'bottom'
huffman
parents: 41402
diff changeset
   250
by (rule bottomI, rule upper_plus_below1)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   251
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   252
lemma upper_plus_strict2 [simp]: "xs \<union>\<sharp> \<bottom> = \<bottom>"
41430
1aa23e9f2c87 change some lemma names containing 'UU' to 'bottom'
huffman
parents: 41402
diff changeset
   253
by (rule bottomI, rule upper_plus_below2)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   254
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40002
diff changeset
   255
lemma upper_unit_bottom_iff [simp]: "{x}\<sharp> = \<bottom> \<longleftrightarrow> x = \<bottom>"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   256
unfolding upper_unit_strict [symmetric] by (rule upper_unit_eq_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   257
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40002
diff changeset
   258
lemma upper_plus_bottom_iff [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   259
  "xs \<union>\<sharp> ys = \<bottom> \<longleftrightarrow> xs = \<bottom> \<or> ys = \<bottom>"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   260
apply (induct xs rule: upper_pd.principal_induct, simp)
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   261
apply (induct ys rule: upper_pd.principal_induct, simp)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   262
apply (simp add: inst_upper_pd_pcpo upper_pd.principal_eq_iff
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   263
                 upper_le_PDPlus_PDUnit_iff)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   264
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   265
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   266
lemma compact_upper_unit: "compact x \<Longrightarrow> compact {x}\<sharp>"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   267
by (auto dest!: compact_basis.compact_imp_principal)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   268
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   269
lemma compact_upper_unit_iff [simp]: "compact {x}\<sharp> \<longleftrightarrow> compact x"
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   270
apply (safe elim!: compact_upper_unit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   271
apply (simp only: compact_def upper_unit_below_iff [symmetric])
40327
1dfdbd66093a renamed {Rep,Abs}_CFun to {Rep,Abs}_cfun
huffman
parents: 40321
diff changeset
   272
apply (erule adm_subst [OF cont_Rep_cfun2])
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   273
done
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   274
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   275
lemma compact_upper_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   276
  "\<lbrakk>compact xs; compact ys\<rbrakk> \<Longrightarrow> compact (xs \<union>\<sharp> ys)"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   277
by (auto dest!: upper_pd.compact_imp_principal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   278
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   279
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   280
subsection \<open>Induction rules\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   281
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   282
lemma upper_pd_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   283
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   284
  assumes unit: "\<And>x. P {x}\<sharp>"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   285
  assumes insert: "\<And>x ys. \<lbrakk>P {x}\<sharp>; P ys\<rbrakk> \<Longrightarrow> P ({x}\<sharp> \<union>\<sharp> ys)"
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   286
  shows "P (xs::'a::bifinite upper_pd)"
81620
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   287
proof (induct xs rule: upper_pd.principal_induct)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   288
  have *: "P {Rep_compact_basis a}\<sharp>" for a
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   289
    by (rule unit)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   290
  show "P (upper_principal a)" for a
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   291
  proof (induct a rule: pd_basis_induct1)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   292
    case (PDUnit a)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   293
    with * show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   294
      by (simp only: upper_unit_Rep_compact_basis [symmetric])
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   295
  next
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   296
    case (PDPlus a t)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   297
    with * have "P ({Rep_compact_basis a}\<sharp> \<union>\<sharp> upper_principal t)"
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   298
      by (rule insert)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   299
    then show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   300
      by (simp only: upper_unit_Rep_compact_basis [symmetric]
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   301
          upper_plus_principal [symmetric])
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   302
  qed
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   303
qed (rule P)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   304
81620
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   305
lemma upper_pd_induct [case_names adm upper_unit upper_plus, induct type: upper_pd]:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   306
  assumes P: "adm P"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   307
  assumes unit: "\<And>x. P {x}\<sharp>"
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   308
  assumes plus: "\<And>xs ys. \<lbrakk>P xs; P ys\<rbrakk> \<Longrightarrow> P (xs \<union>\<sharp> ys)"
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   309
  shows "P (xs::'a::bifinite upper_pd)"
81620
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   310
proof (induct xs rule: upper_pd.principal_induct)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   311
  show "P (upper_principal a)" for a
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   312
  proof (induct a rule: pd_basis_induct)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   313
    case PDUnit
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   314
    then show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   315
      by (simp only: upper_unit_Rep_compact_basis [symmetric] unit)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   316
  next
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   317
    case PDPlus
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   318
    then show ?case
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   319
      by (simp only: upper_plus_principal [symmetric] plus)
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   320
  qed
2cb49d09f059 clarified induct rules: proper case_names;
wenzelm
parents: 81583
diff changeset
   321
qed (rule P)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   322
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   323
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   324
subsection \<open>Monadic bind\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   325
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   326
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   327
  upper_bind_basis ::
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   328
  "'a::bifinite pd_basis \<Rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b::bifinite upper_pd" where
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   329
  "upper_bind_basis = fold_pd
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   330
    (\<lambda>a. \<Lambda> f. f\<cdot>(Rep_compact_basis a))
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   331
    (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<sharp> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   332
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   333
lemma ACI_upper_bind:
51489
f738e6dbd844 fundamental revision of big operators on sets
haftmann
parents: 49834
diff changeset
   334
  "semilattice (\<lambda>x y. \<Lambda> f. x\<cdot>f \<union>\<sharp> y\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   335
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
   336
apply (simp add: upper_plus_assoc)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   337
apply (simp add: upper_plus_commute)
29990
b11793ea15a3 avoid using ab_semigroup_idem_mult locale for powerdomains
huffman
parents: 29672
diff changeset
   338
apply (simp add: eta_cfun)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   339
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   340
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   341
lemma upper_bind_basis_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   342
  "upper_bind_basis (PDUnit a) =
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   343
    (\<Lambda> f. f\<cdot>(Rep_compact_basis a))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   344
  "upper_bind_basis (PDPlus t u) =
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   345
    (\<Lambda> f. upper_bind_basis t\<cdot>f \<union>\<sharp> upper_bind_basis u\<cdot>f)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   346
unfolding upper_bind_basis_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   347
apply -
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   348
apply (rule fold_pd_PDUnit [OF ACI_upper_bind])
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   349
apply (rule fold_pd_PDPlus [OF ACI_upper_bind])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   350
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   351
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   352
lemma upper_bind_basis_mono:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   353
  "t \<le>\<sharp> u \<Longrightarrow> upper_bind_basis t \<sqsubseteq> upper_bind_basis u"
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 39989
diff changeset
   354
unfolding cfun_below_iff
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   355
apply (erule upper_le_induct, safe)
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   356
apply (simp add: monofun_cfun)
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 30729
diff changeset
   357
apply (simp add: below_trans [OF upper_plus_below1])
40734
a292fc5157f8 declare more simp rules for powerdomains
huffman
parents: 40589
diff changeset
   358
apply simp
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   359
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   360
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   361
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   362
  upper_bind :: "'a::bifinite upper_pd \<rightarrow> ('a \<rightarrow> 'b upper_pd) \<rightarrow> 'b::bifinite upper_pd" where
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   363
  "upper_bind = upper_pd.extension upper_bind_basis"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   364
41036
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   365
syntax
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   366
  "_upper_bind" :: "[logic, logic, logic] \<Rightarrow> logic"
81095
49c04500c5f9 more inner syntax markup: HOLCF;
wenzelm
parents: 81091
diff changeset
   367
    (\<open>(\<open>indent=3 notation=\<open>binder upper_bind\<close>\<close>\<Union>\<sharp>_\<in>_./ _)\<close> [0, 0, 10] 10)
80768
c7723cc15de8 more markup for syntax consts;
wenzelm
parents: 67682
diff changeset
   368
41036
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   369
translations
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   370
  "\<Union>\<sharp>x\<in>xs. e" == "CONST upper_bind\<cdot>xs\<cdot>(\<Lambda> x. e)"
4acbacd6c5bc add set-union-like syntax for powerdomain bind operators
huffman
parents: 40888
diff changeset
   371
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   372
lemma upper_bind_principal [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   373
  "upper_bind\<cdot>(upper_principal t) = upper_bind_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   374
unfolding upper_bind_def
41394
51c866d1b53b rename function ideal_completion.basis_fun to ideal_completion.extension
huffman
parents: 41289
diff changeset
   375
apply (rule upper_pd.extension_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   376
apply (erule upper_bind_basis_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   377
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   378
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   379
lemma upper_bind_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   380
  "upper_bind\<cdot>{x}\<sharp>\<cdot>f = f\<cdot>x"
27289
c49d427867aa move lemmas into locales;
huffman
parents: 27267
diff changeset
   381
by (induct x rule: compact_basis.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   382
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   383
lemma upper_bind_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   384
  "upper_bind\<cdot>(xs \<union>\<sharp> ys)\<cdot>f = upper_bind\<cdot>xs\<cdot>f \<union>\<sharp> upper_bind\<cdot>ys\<cdot>f"
41402
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   385
by (induct xs rule: upper_pd.principal_induct, simp,
b647212cee03 remove lemma ideal_completion.principal_induct2, use principal_induct twice instead
huffman
parents: 41399
diff changeset
   386
    induct ys rule: upper_pd.principal_induct, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   387
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   388
lemma upper_bind_strict [simp]: "upper_bind\<cdot>\<bottom>\<cdot>f = f\<cdot>\<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   389
unfolding upper_unit_strict [symmetric] by (rule upper_bind_unit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   390
40589
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   391
lemma upper_bind_bind:
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   392
  "upper_bind\<cdot>(upper_bind\<cdot>xs\<cdot>f)\<cdot>g = upper_bind\<cdot>xs\<cdot>(\<Lambda> x. upper_bind\<cdot>(f\<cdot>x)\<cdot>g)"
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   393
by (induct xs, simp_all)
0e77e45d2ffc add bind_bind rules for powerdomains
huffman
parents: 40577
diff changeset
   394
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   395
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   396
subsection \<open>Map\<close>
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   397
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   399
  upper_map :: "('a::bifinite \<rightarrow> 'b::bifinite) \<rightarrow> 'a upper_pd \<rightarrow> 'b upper_pd" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   400
  "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
   401
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   402
lemma upper_map_unit [simp]:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   403
  "upper_map\<cdot>f\<cdot>{x}\<sharp> = {f\<cdot>x}\<sharp>"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   404
unfolding upper_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   405
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   406
lemma upper_map_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   407
  "upper_map\<cdot>f\<cdot>(xs \<union>\<sharp> ys) = upper_map\<cdot>f\<cdot>xs \<union>\<sharp> upper_map\<cdot>f\<cdot>ys"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   408
unfolding upper_map_def by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   409
40577
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   410
lemma upper_map_bottom [simp]: "upper_map\<cdot>f\<cdot>\<bottom> = {f\<cdot>\<bottom>}\<sharp>"
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   411
unfolding upper_map_def by simp
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   412
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   413
lemma upper_map_ident: "upper_map\<cdot>(\<Lambda> x. x)\<cdot>xs = xs"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   414
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   415
33808
31169fdc5ae7 add map_ID lemmas
huffman
parents: 33585
diff changeset
   416
lemma upper_map_ID: "upper_map\<cdot>ID = ID"
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 39989
diff changeset
   417
by (simp add: cfun_eq_iff ID_def upper_map_ident)
33808
31169fdc5ae7 add map_ID lemmas
huffman
parents: 33585
diff changeset
   418
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   419
lemma upper_map_map:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   420
  "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
   421
by (induct xs rule: upper_pd_induct, simp_all)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   422
41110
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   423
lemma upper_bind_map:
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   424
  "upper_bind\<cdot>(upper_map\<cdot>f\<cdot>xs)\<cdot>g = upper_bind\<cdot>xs\<cdot>(\<Lambda> x. g\<cdot>(f\<cdot>x))"
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   425
by (simp add: upper_map_def upper_bind_bind)
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   426
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   427
lemma upper_map_bind:
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   428
  "upper_map\<cdot>f\<cdot>(upper_bind\<cdot>xs\<cdot>g) = upper_bind\<cdot>xs\<cdot>(\<Lambda> x. upper_map\<cdot>f\<cdot>(g\<cdot>x))"
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   429
by (simp add: upper_map_def upper_bind_bind)
32099ee71a2f new powerdomain lemmas
huffman
parents: 41036
diff changeset
   430
33585
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   431
lemma ep_pair_upper_map: "ep_pair e p \<Longrightarrow> ep_pair (upper_map\<cdot>e) (upper_map\<cdot>p)"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 58880
diff changeset
   432
apply standard
33585
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   433
apply (induct_tac x rule: upper_pd_induct, simp_all add: ep_pair.e_inverse)
35901
12f09bf2c77f fix LaTeX overfull hbox warnings in HOLCF document
huffman
parents: 34973
diff changeset
   434
apply (induct_tac y rule: upper_pd_induct)
40734
a292fc5157f8 declare more simp rules for powerdomains
huffman
parents: 40589
diff changeset
   435
apply (simp_all add: ep_pair.e_p_below monofun_cfun del: upper_below_plus_iff)
33585
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   436
done
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   437
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   438
lemma deflation_upper_map: "deflation d \<Longrightarrow> deflation (upper_map\<cdot>d)"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 58880
diff changeset
   439
apply standard
33585
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   440
apply (induct_tac x rule: upper_pd_induct, simp_all add: deflation.idem)
35901
12f09bf2c77f fix LaTeX overfull hbox warnings in HOLCF document
huffman
parents: 34973
diff changeset
   441
apply (induct_tac x rule: upper_pd_induct)
40734
a292fc5157f8 declare more simp rules for powerdomains
huffman
parents: 40589
diff changeset
   442
apply (simp_all add: deflation.below monofun_cfun del: upper_below_plus_iff)
33585
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   443
done
8d39394fe5cf ep_pair and deflation lemmas for powerdomain map functions
huffman
parents: 31076
diff changeset
   444
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   445
(* FIXME: long proof! *)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   446
lemma finite_deflation_upper_map:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   447
  assumes "finite_deflation d" shows "finite_deflation (upper_map\<cdot>d)"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   448
proof (rule finite_deflation_intro)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   449
  interpret d: finite_deflation d by fact
67682
00c436488398 tuned proofs -- prefer explicit names for facts from 'interpret';
wenzelm
parents: 62175
diff changeset
   450
  from d.deflation_axioms show "deflation (upper_map\<cdot>d)"
00c436488398 tuned proofs -- prefer explicit names for facts from 'interpret';
wenzelm
parents: 62175
diff changeset
   451
    by (rule deflation_upper_map)
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   452
  have "finite (range (\<lambda>x. d\<cdot>x))" by (rule d.finite_range)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   453
  hence "finite (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   454
    by (rule finite_vimageI, simp add: inj_on_def Rep_compact_basis_inject)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   455
  hence "finite (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x)))" by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   456
  hence "finite (Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   457
    by (rule finite_vimageI, simp add: inj_on_def Rep_pd_basis_inject)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   458
  hence *: "finite (upper_principal ` Rep_pd_basis -` (Pow (Rep_compact_basis -` range (\<lambda>x. d\<cdot>x))))" by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   459
  hence "finite (range (\<lambda>xs. upper_map\<cdot>d\<cdot>xs))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   460
    apply (rule rev_finite_subset)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   461
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   462
    apply (induct_tac xs rule: upper_pd.principal_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   463
    apply (simp add: adm_mem_finite *)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   464
    apply (rename_tac t, induct_tac t rule: pd_basis_induct)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   465
    apply (simp only: upper_unit_Rep_compact_basis [symmetric] upper_map_unit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   466
    apply simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   467
    apply (subgoal_tac "\<exists>b. d\<cdot>(Rep_compact_basis a) = Rep_compact_basis b")
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   468
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   469
    apply (rule imageI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   470
    apply (rule vimageI2)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   471
    apply (simp add: Rep_PDUnit)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   472
    apply (rule range_eqI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   473
    apply (erule sym)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   474
    apply (rule exI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   475
    apply (rule Abs_compact_basis_inverse [symmetric])
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   476
    apply (simp add: d.compact)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   477
    apply (simp only: upper_plus_principal [symmetric] upper_map_plus)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   478
    apply clarsimp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   479
    apply (rule imageI)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   480
    apply (rule vimageI2)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   481
    apply (simp add: Rep_PDPlus)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   482
    done
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   483
  thus "finite {xs. upper_map\<cdot>d\<cdot>xs = xs}"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   484
    by (rule finite_range_imp_finite_fixes)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   485
qed
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   486
81577
a712bf5ccab0 tuned whitespace;
wenzelm
parents: 81095
diff changeset
   487
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   488
subsection \<open>Upper powerdomain is bifinite\<close>
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   489
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   490
lemma approx_chain_upper_map:
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   491
  assumes "approx_chain a"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   492
  shows "approx_chain (\<lambda>i. upper_map\<cdot>(a i))"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   493
  using assms unfolding approx_chain_def
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   494
  by (simp add: lub_APP upper_map_ID finite_deflation_upper_map)
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   495
41288
a19edebad961 powerdomain theories require class 'bifinite' instead of 'domain'
huffman
parents: 41287
diff changeset
   496
instance upper_pd :: (bifinite) bifinite
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   497
proof
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   498
  show "\<exists>(a::nat \<Rightarrow> 'a upper_pd \<rightarrow> 'a upper_pd). approx_chain a"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   499
    using bifinite [where 'a='a]
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   500
    by (fast intro!: approx_chain_upper_map)
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   501
qed
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41284
diff changeset
   502
81577
a712bf5ccab0 tuned whitespace;
wenzelm
parents: 81095
diff changeset
   503
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   504
subsection \<open>Join\<close>
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   505
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   506
definition
81583
b6df83045178 clarified default_sort: "cpo" for bootstrap, "domain" for main HOLCF;
wenzelm
parents: 81577
diff changeset
   507
  upper_join :: "'a::bifinite upper_pd upper_pd \<rightarrow> 'a upper_pd" where
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   508
  "upper_join = (\<Lambda> xss. upper_bind\<cdot>xss\<cdot>(\<Lambda> xs. xs))"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   509
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   510
lemma upper_join_unit [simp]:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   511
  "upper_join\<cdot>{xs}\<sharp> = xs"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   512
unfolding upper_join_def by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   513
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   514
lemma upper_join_plus [simp]:
41399
ad093e4638e2 changed syntax of powerdomain binary union operators
huffman
parents: 41394
diff changeset
   515
  "upper_join\<cdot>(xss \<union>\<sharp> yss) = upper_join\<cdot>xss \<union>\<sharp> upper_join\<cdot>yss"
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   516
unfolding upper_join_def by simp
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   517
40577
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   518
lemma upper_join_bottom [simp]: "upper_join\<cdot>\<bottom> = \<bottom>"
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   519
unfolding upper_join_def by simp
5c6225a1c2c0 add lemmas about powerdomains
huffman
parents: 40576
diff changeset
   520
39974
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   521
lemma upper_join_map_unit:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   522
  "upper_join\<cdot>(upper_map\<cdot>upper_unit\<cdot>xs) = xs"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   523
by (induct xs rule: upper_pd_induct, simp_all)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   524
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   525
lemma upper_join_map_join:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   526
  "upper_join\<cdot>(upper_map\<cdot>upper_join\<cdot>xsss) = upper_join\<cdot>(upper_join\<cdot>xsss)"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   527
by (induct xsss rule: upper_pd_induct, simp_all)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   528
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   529
lemma upper_join_map_map:
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   530
  "upper_join\<cdot>(upper_map\<cdot>(upper_map\<cdot>f)\<cdot>xss) =
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   531
   upper_map\<cdot>f\<cdot>(upper_join\<cdot>xss)"
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   532
by (induct xss rule: upper_pd_induct, simp_all)
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   533
b525988432e9 major reorganization/simplification of HOLCF type classes:
huffman
parents: 39970
diff changeset
   534
end