src/HOLCF/CompactBasis.thy
author wenzelm
Thu, 19 Jun 2008 20:48:01 +0200
changeset 27277 7b7ce2d7fafe
parent 27268 1d8c6703c7b1
child 27288 274b80691259
permissions -rw-r--r--
export read_typ/cert_typ -- version with regular context operations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/CompactBasis.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 {* Compact bases of domains *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     7
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     8
theory CompactBasis
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
     9
imports Bifinite SetPcpo
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 {* Ideals over a preorder *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    13
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    14
locale preorder =
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    15
  fixes r :: "'a::type \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<preceq>" 50)
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    16
  assumes r_refl: "x \<preceq> x"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    17
  assumes r_trans: "\<lbrakk>x \<preceq> y; y \<preceq> z\<rbrakk> \<Longrightarrow> x \<preceq> z"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    18
begin
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    19
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    20
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    21
  ideal :: "'a set \<Rightarrow> bool" where
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    22
  "ideal A = ((\<exists>x. x \<in> A) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z) \<and>
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    23
    (\<forall>x y. x \<preceq> y \<longrightarrow> y \<in> A \<longrightarrow> x \<in> A))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    24
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    25
lemma idealI:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    26
  assumes "\<exists>x. x \<in> A"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    27
  assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    28
  assumes "\<And>x y. \<lbrakk>x \<preceq> y; y \<in> A\<rbrakk> \<Longrightarrow> x \<in> A"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    29
  shows "ideal A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    30
unfolding ideal_def using prems by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    31
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    32
lemma idealD1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    33
  "ideal A \<Longrightarrow> \<exists>x. x \<in> A"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    34
unfolding ideal_def by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    35
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    36
lemma idealD2:
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    37
  "\<lbrakk>ideal A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    38
unfolding ideal_def by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    39
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    40
lemma idealD3:
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    41
  "\<lbrakk>ideal A; x \<preceq> y; y \<in> A\<rbrakk> \<Longrightarrow> x \<in> A"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    42
unfolding ideal_def by fast
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    43
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    44
lemma ideal_directed_finite:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    45
  assumes A: "ideal A"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    46
  shows "\<lbrakk>finite U; U \<subseteq> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. \<forall>x\<in>U. x \<preceq> z"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    47
apply (induct U set: finite)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    48
apply (simp add: idealD1 [OF A])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    49
apply (simp, clarify, rename_tac y)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    50
apply (drule (1) idealD2 [OF A])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    51
apply (clarify, erule_tac x=z in rev_bexI)
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    52
apply (fast intro: r_trans)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    53
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    54
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    55
lemma ideal_principal: "ideal {x. x \<preceq> z}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    56
apply (rule idealI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    57
apply (rule_tac x=z in exI)
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    58
apply (fast intro: r_refl)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    59
apply (rule_tac x=z in bexI, fast)
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    60
apply (fast intro: r_refl)
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    61
apply (fast intro: r_trans)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    62
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    63
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    64
lemma ex_ideal: "\<exists>A. ideal A"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    65
by (rule exI, rule ideal_principal)
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    66
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    67
lemma directed_image_ideal:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    68
  assumes A: "ideal A"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    69
  assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    70
  shows "directed (f ` A)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    71
apply (rule directedI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    72
apply (cut_tac idealD1 [OF A], fast)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    73
apply (clarify, rename_tac a b)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    74
apply (drule (1) idealD2 [OF A])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    75
apply (clarify, rename_tac c)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    76
apply (rule_tac x="f c" in rev_bexI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    77
apply (erule imageI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    78
apply (simp add: f)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    79
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    80
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    81
lemma adm_ideal: "adm (\<lambda>A. ideal A)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    82
unfolding ideal_def by (intro adm_lemmas adm_set_lemmas)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    83
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    84
lemma lub_image_principal:
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    85
  assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    86
  shows "(\<Squnion>x\<in>{x. x \<preceq> y}. f x) = f y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    87
apply (rule thelubI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    88
apply (rule is_lub_maximal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    89
apply (rule ub_imageI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    90
apply (simp add: f)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    91
apply (rule imageI)
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    92
apply (simp add: r_refl)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    93
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
    94
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    95
end
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
    96
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    97
interpretation sq_le: preorder ["sq_le :: 'a::po \<Rightarrow> 'a \<Rightarrow> bool"]
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    98
apply unfold_locales
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
    99
apply (rule refl_less)
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   100
apply (erule (1) trans_less)
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   101
done
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   102
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   103
subsection {* Defining functions in terms of basis elements *}
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   104
26034
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   105
lemma finite_directed_contains_lub:
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   106
  "\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. S <<| u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   107
apply (drule (1) directed_finiteD, rule subset_refl)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   108
apply (erule bexE)
26034
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   109
apply (rule rev_bexI, assumption)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   110
apply (erule (1) is_lub_maximal)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   111
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   112
26034
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   113
lemma lub_finite_directed_in_self:
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   114
  "\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> lub S \<in> S"
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   115
apply (drule (1) finite_directed_contains_lub, clarify)
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   116
apply (drule thelubI, simp)
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   117
done
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   118
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   119
lemma finite_directed_has_lub: "\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> \<exists>u. S <<| u"
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   120
by (drule (1) finite_directed_contains_lub, fast)
97d00128072b cleaned up
huffman
parents: 25925
diff changeset
   121
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   122
lemma is_ub_thelub0: "\<lbrakk>\<exists>u. S <<| u; x \<in> S\<rbrakk> \<Longrightarrow> x \<sqsubseteq> lub S"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   123
apply (erule exE, drule lubI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   124
apply (drule is_lubD1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   125
apply (erule (1) is_ubD)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   126
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   127
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   128
lemma is_lub_thelub0: "\<lbrakk>\<exists>u. S <<| u; S <| x\<rbrakk> \<Longrightarrow> lub S \<sqsubseteq> x"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   129
by (erule exE, drule lubI, erule is_lub_lub)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   130
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   131
locale basis_take = preorder +
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   132
  fixes take :: "nat \<Rightarrow> 'a::type \<Rightarrow> 'a"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   133
  assumes take_less: "take n a \<preceq> a"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   134
  assumes take_take: "take n (take n a) = take n a"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   135
  assumes take_mono: "a \<preceq> b \<Longrightarrow> take n a \<preceq> take n b"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   136
  assumes take_chain: "take n a \<preceq> take (Suc n) a"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   137
  assumes finite_range_take: "finite (range (take n))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   138
  assumes take_covers: "\<exists>n. take n a = a"
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   139
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   140
locale ideal_completion = basis_take +
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   141
  fixes principal :: "'a::type \<Rightarrow> 'b::cpo"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   142
  fixes rep :: "'b::cpo \<Rightarrow> 'a::type set"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   143
  assumes ideal_rep: "\<And>x. preorder.ideal r (rep x)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   144
  assumes cont_rep: "cont rep"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   145
  assumes rep_principal: "\<And>a. rep (principal a) = {b. b \<preceq> a}"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   146
  assumes subset_repD: "\<And>x y. rep x \<subseteq> rep y \<Longrightarrow> x \<sqsubseteq> y"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   147
begin
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   148
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   149
lemma finite_take_rep: "finite (take n ` rep x)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   150
by (rule finite_subset [OF image_mono [OF subset_UNIV] finite_range_take])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   151
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   152
lemma basis_fun_lemma0:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   153
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   154
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   155
  shows "\<exists>u. f ` take i ` rep x <<| u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   156
apply (rule finite_directed_has_lub)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   157
apply (rule finite_imageI)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   158
apply (rule finite_take_rep)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   159
apply (subst image_image)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   160
apply (rule directed_image_ideal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   161
apply (rule ideal_rep)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   162
apply (rule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   163
apply (erule take_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   164
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   165
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   166
lemma basis_fun_lemma1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   167
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   168
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   169
  shows "chain (\<lambda>i. lub (f ` take i ` rep x))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   170
 apply (rule chainI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   171
 apply (rule is_lub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   172
  apply (rule basis_fun_lemma0, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   173
 apply (rule is_ubI, clarsimp, rename_tac a)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   174
 apply (rule sq_le.trans_less [OF f_mono [OF take_chain]])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   175
 apply (rule is_ub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   176
  apply (rule basis_fun_lemma0, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   177
 apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   178
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   179
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   180
lemma basis_fun_lemma2:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   181
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   182
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   183
  shows "f ` rep x <<| (\<Squnion>i. lub (f ` take i ` rep x))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   184
 apply (rule is_lubI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   185
 apply (rule ub_imageI, rename_tac a)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   186
  apply (cut_tac a=a in take_covers, erule exE, rename_tac i)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   187
  apply (erule subst)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   188
  apply (rule rev_trans_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   189
   apply (rule_tac x=i in is_ub_thelub)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   190
   apply (rule basis_fun_lemma1, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   191
  apply (rule is_ub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   192
   apply (rule basis_fun_lemma0, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   193
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   194
 apply (rule is_lub_thelub [OF _ ub_rangeI])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   195
  apply (rule basis_fun_lemma1, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   196
 apply (rule is_lub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   197
  apply (rule basis_fun_lemma0, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   198
 apply (rule is_ubI, clarsimp, rename_tac a)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   199
 apply (rule sq_le.trans_less [OF f_mono [OF take_less]])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   200
 apply (erule (1) ub_imageD)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   201
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   202
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   203
lemma basis_fun_lemma:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   204
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   205
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   206
  shows "\<exists>u. f ` rep x <<| u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   207
by (rule exI, rule basis_fun_lemma2, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   208
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   209
lemma rep_mono: "x \<sqsubseteq> y \<Longrightarrow> rep x \<subseteq> rep y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   210
apply (drule cont_rep [THEN cont2mono, THEN monofunE])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   211
apply (simp add: set_cpo_simps)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   212
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   213
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   214
lemma rep_contlub:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   215
  "chain Y \<Longrightarrow> rep (\<Squnion>i. Y i) = (\<Union>i. rep (Y i))"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   216
by (simp add: cont2contlubE [OF cont_rep] set_cpo_simps)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   217
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   218
lemma less_def: "x \<sqsubseteq> y \<longleftrightarrow> rep x \<subseteq> rep y"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   219
by (rule iffI [OF rep_mono subset_repD])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   220
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   221
lemma rep_eq: "rep x = {a. principal a \<sqsubseteq> x}"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   222
unfolding less_def rep_principal
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   223
apply safe
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   224
apply (erule (1) idealD3 [OF ideal_rep])
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   225
apply (erule subsetD, simp add: r_refl)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   226
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   227
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   228
lemma mem_rep_iff_principal_less: "a \<in> rep x \<longleftrightarrow> principal a \<sqsubseteq> x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   229
by (simp add: rep_eq)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   230
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   231
lemma principal_less_iff_mem_rep: "principal a \<sqsubseteq> x \<longleftrightarrow> a \<in> rep x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   232
by (simp add: rep_eq)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   233
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   234
lemma principal_less_iff: "principal a \<sqsubseteq> principal b \<longleftrightarrow> a \<preceq> b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   235
by (simp add: principal_less_iff_mem_rep rep_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   236
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   237
lemma principal_eq_iff: "principal a = principal b \<longleftrightarrow> a \<preceq> b \<and> b \<preceq> a"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   238
unfolding po_eq_conv [where 'a='b] principal_less_iff ..
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   239
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   240
lemma repD: "a \<in> rep x \<Longrightarrow> principal a \<sqsubseteq> x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   241
by (simp add: rep_eq)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   242
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   243
lemma principal_mono: "a \<preceq> b \<Longrightarrow> principal a \<sqsubseteq> principal b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   244
by (simp add: principal_less_iff)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   245
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   246
lemma lessI: "(\<And>a. principal a \<sqsubseteq> x \<Longrightarrow> principal a \<sqsubseteq> u) \<Longrightarrow> x \<sqsubseteq> u"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   247
unfolding principal_less_iff_mem_rep
26806
40b411ec05aa Adapted to encoding of sets as predicates
berghofe
parents: 26454
diff changeset
   248
by (simp add: less_def subset_eq)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   249
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   250
lemma lub_principal_rep: "principal ` rep x <<| x"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   251
apply (rule is_lubI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   252
apply (rule ub_imageI)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   253
apply (erule repD)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   254
apply (subst less_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   255
apply (rule subsetI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   256
apply (drule (1) ub_imageD)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   257
apply (simp add: rep_eq)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   258
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   259
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   260
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   261
  basis_fun :: "('a::type \<Rightarrow> 'c::cpo) \<Rightarrow> 'b \<rightarrow> 'c" where
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   262
  "basis_fun = (\<lambda>f. (\<Lambda> x. lub (f ` rep x)))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   263
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   264
lemma basis_fun_beta:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   265
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   266
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   267
  shows "basis_fun f\<cdot>x = lub (f ` rep x)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   268
unfolding basis_fun_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   269
proof (rule beta_cfun)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   270
  have lub: "\<And>x. \<exists>u. f ` rep x <<| u"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   271
    using f_mono by (rule basis_fun_lemma)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   272
  show cont: "cont (\<lambda>x. lub (f ` rep x))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   273
    apply (rule contI2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   274
     apply (rule monofunI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   275
     apply (rule is_lub_thelub0 [OF lub ub_imageI])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   276
     apply (rule is_ub_thelub0 [OF lub imageI])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   277
     apply (erule (1) subsetD [OF rep_mono])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   278
    apply (rule is_lub_thelub0 [OF lub ub_imageI])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   279
    apply (simp add: rep_contlub, clarify)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   280
    apply (erule rev_trans_less [OF is_ub_thelub])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   281
    apply (erule is_ub_thelub0 [OF lub imageI])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   282
    done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   283
qed
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   284
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   285
lemma basis_fun_principal:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   286
  fixes f :: "'a::type \<Rightarrow> 'c::cpo"
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   287
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   288
  shows "basis_fun f\<cdot>(principal a) = f a"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   289
apply (subst basis_fun_beta, erule f_mono)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   290
apply (subst rep_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   291
apply (rule lub_image_principal, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   292
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   293
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   294
lemma basis_fun_mono:
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   295
  assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   296
  assumes g_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> g a \<sqsubseteq> g b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   297
  assumes less: "\<And>a. f a \<sqsubseteq> g a"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   298
  shows "basis_fun f \<sqsubseteq> basis_fun g"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   299
 apply (rule less_cfun_ext)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   300
 apply (simp only: basis_fun_beta f_mono g_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   301
 apply (rule is_lub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   302
  apply (rule basis_fun_lemma, erule f_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   303
 apply (rule ub_imageI, rename_tac a)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   304
 apply (rule sq_le.trans_less [OF less])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   305
 apply (rule is_ub_thelub0)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   306
  apply (rule basis_fun_lemma, erule g_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   307
 apply (erule imageI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   308
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   309
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   310
lemma compact_principal: "compact (principal a)"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   311
by (rule compactI2, simp add: principal_less_iff_mem_rep rep_contlub)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   312
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   313
definition
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   314
  completion_approx :: "nat \<Rightarrow> 'b \<rightarrow> 'b" where
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   315
  "completion_approx = (\<lambda>i. basis_fun (\<lambda>a. principal (take i a)))"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   316
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   317
lemma completion_approx_beta:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   318
  "completion_approx i\<cdot>x = (\<Squnion>a\<in>rep x. principal (take i a))"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   319
unfolding completion_approx_def
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   320
by (simp add: basis_fun_beta principal_mono take_mono)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   321
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   322
lemma completion_approx_principal:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   323
  "completion_approx i\<cdot>(principal a) = principal (take i a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   324
unfolding completion_approx_def
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   325
by (simp add: basis_fun_principal principal_mono take_mono)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   326
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   327
lemma chain_completion_approx: "chain completion_approx"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   328
unfolding completion_approx_def
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   329
apply (rule chainI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   330
apply (rule basis_fun_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   331
apply (erule principal_mono [OF take_mono])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   332
apply (erule principal_mono [OF take_mono])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   333
apply (rule principal_mono [OF take_chain])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   334
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   335
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   336
lemma lub_completion_approx: "(\<Squnion>i. completion_approx i\<cdot>x) = x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   337
unfolding completion_approx_beta
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   338
 apply (subst image_image [where f=principal, symmetric])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   339
 apply (rule unique_lub [OF _ lub_principal_rep])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   340
 apply (rule basis_fun_lemma2, erule principal_mono)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   341
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   342
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   343
lemma completion_approx_eq_principal:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   344
  "\<exists>a\<in>rep x. completion_approx i\<cdot>x = principal (take i a)"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   345
unfolding completion_approx_beta
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   346
 apply (subst image_image [where f=principal, symmetric])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   347
 apply (subgoal_tac "finite (principal ` take i ` rep x)")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   348
  apply (subgoal_tac "directed (principal ` take i ` rep x)")
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   349
   apply (drule (1) lub_finite_directed_in_self, fast)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   350
  apply (subst image_image)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   351
  apply (rule directed_image_ideal)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   352
   apply (rule ideal_rep)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   353
  apply (erule principal_mono [OF take_mono])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   354
 apply (rule finite_imageI)
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   355
 apply (rule finite_take_rep)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   356
done
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   357
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   358
lemma completion_approx_idem:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   359
  "completion_approx i\<cdot>(completion_approx i\<cdot>x) = completion_approx i\<cdot>x"
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   360
using completion_approx_eq_principal [where i=i and x=x]
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   361
by (auto simp add: completion_approx_principal take_take)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   362
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   363
lemma finite_fixes_completion_approx:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   364
  "finite {x. completion_approx i\<cdot>x = x}" (is "finite ?S")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   365
apply (subgoal_tac "?S \<subseteq> principal ` range (take i)")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   366
apply (erule finite_subset)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   367
apply (rule finite_imageI)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   368
apply (rule finite_range_take)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   369
apply (clarify, erule subst)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   370
apply (cut_tac x=x and i=i in completion_approx_eq_principal)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   371
apply fast
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   372
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   373
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   374
lemma principal_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   375
  assumes adm: "adm P"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   376
  assumes P: "\<And>a. P (principal a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   377
  shows "P x"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   378
 apply (subgoal_tac "P (\<Squnion>i. completion_approx i\<cdot>x)")
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   379
 apply (simp add: lub_completion_approx)
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25922
diff changeset
   380
 apply (rule admD [OF adm])
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   381
  apply (simp add: chain_completion_approx)
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   382
 apply (cut_tac x=x and i=i in completion_approx_eq_principal)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   383
 apply (clarify, simp add: P)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   384
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   385
27267
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   386
lemma compact_imp_principal: "compact x \<Longrightarrow> \<exists>a. x = principal a"
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   387
apply (drule adm_compact_neq [OF _ cont_id])
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   388
apply (drule admD2 [where Y="\<lambda>n. completion_approx n\<cdot>x"])
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   389
apply (simp add: chain_completion_approx)
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   390
apply (simp add: lub_completion_approx)
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   391
apply (erule exE, erule ssubst)
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   392
apply (cut_tac i=i and x=x in completion_approx_eq_principal)
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   393
apply (clarify, erule exI)
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   394
done
5ebfb7f25ebb add lemma compact_imp_principal to locale ideal_completion
huffman
parents: 26927
diff changeset
   395
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   396
end
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   397
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   398
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   399
subsection {* Compact bases of bifinite domains *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   400
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   401
defaultsort profinite
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   402
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   403
typedef (open) 'a compact_basis = "{x::'a::profinite. compact x}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   404
by (fast intro: compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   405
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   406
lemma compact_Rep_compact_basis [simp]: "compact (Rep_compact_basis a)"
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   407
by (rule Rep_compact_basis [unfolded mem_Collect_eq])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   408
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   409
lemma Rep_Abs_compact_basis_approx [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   410
  "Rep_compact_basis (Abs_compact_basis (approx n\<cdot>x)) = approx n\<cdot>x"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   411
by (rule Abs_compact_basis_inverse, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   412
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   413
lemma compact_imp_Rep_compact_basis:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   414
  "compact x \<Longrightarrow> \<exists>y. x = Rep_compact_basis y"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   415
by (rule exI, rule Abs_compact_basis_inverse [symmetric], simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   416
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   417
instantiation compact_basis :: (profinite) sq_ord
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   418
begin
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   419
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   420
definition
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   421
  compact_le_def:
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   422
    "(op \<sqsubseteq>) \<equiv> (\<lambda>x y. Rep_compact_basis x \<sqsubseteq> Rep_compact_basis y)"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   423
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   424
instance ..
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   425
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   426
end
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   427
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   428
instance compact_basis :: (profinite) po
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   429
by (rule typedef_po
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   430
    [OF type_definition_compact_basis compact_le_def])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   431
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   432
text {* minimal compact element *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   433
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   434
definition
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   435
  compact_bot :: "'a::bifinite compact_basis" where
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   436
  "compact_bot = Abs_compact_basis \<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   437
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   438
lemma Rep_compact_bot: "Rep_compact_basis compact_bot = \<bottom>"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   439
unfolding compact_bot_def by (simp add: Abs_compact_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   440
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   441
lemma compact_minimal [simp]: "compact_bot \<sqsubseteq> a"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   442
unfolding compact_le_def Rep_compact_bot by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   443
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   444
text {* compacts *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   445
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   446
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   447
  compacts :: "'a \<Rightarrow> 'a compact_basis set" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   448
  "compacts = (\<lambda>x. {a. Rep_compact_basis a \<sqsubseteq> x})"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   449
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   450
lemma ideal_compacts: "sq_le.ideal (compacts w)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   451
unfolding compacts_def
27268
1d8c6703c7b1 replace preorder class with locale
huffman
parents: 27267
diff changeset
   452
 apply (rule sq_le.idealI)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   453
   apply (rule_tac x="Abs_compact_basis (approx 0\<cdot>w)" in exI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   454
   apply (simp add: approx_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   455
  apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   456
  apply (cut_tac a=x in compact_Rep_compact_basis)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   457
  apply (cut_tac a=y in compact_Rep_compact_basis)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   458
  apply (drule bifinite_compact_eq_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   459
  apply (drule bifinite_compact_eq_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   460
  apply (clarify, rename_tac i j)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   461
  apply (rule_tac x="Abs_compact_basis (approx (max i j)\<cdot>w)" in exI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   462
  apply (simp add: approx_less compact_le_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   463
  apply (erule subst, erule subst)
25922
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25904
diff changeset
   464
  apply (simp add: monofun_cfun chain_mono [OF chain_approx])
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   465
 apply (simp add: compact_le_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   466
 apply (erule (1) trans_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   467
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   468
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   469
lemma compacts_Rep_compact_basis:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   470
  "compacts (Rep_compact_basis b) = {a. a \<sqsubseteq> b}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   471
unfolding compacts_def compact_le_def ..
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   472
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   473
lemma cont_compacts: "cont compacts"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   474
unfolding compacts_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   475
apply (rule contI2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   476
apply (rule monofunI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   477
apply (simp add: set_cpo_simps)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   478
apply (fast intro: trans_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   479
apply (simp add: set_cpo_simps)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   480
apply clarify
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   481
apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   482
apply (erule (1) compactD2 [OF compact_Rep_compact_basis])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   483
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   484
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   485
lemma compacts_lessD: "compacts x \<subseteq> compacts y \<Longrightarrow> x \<sqsubseteq> y"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   486
apply (subgoal_tac "(\<Squnion>i. approx i\<cdot>x) \<sqsubseteq> y", simp)
25925
3dc4acca4388 change lemma admD to rule_format
huffman
parents: 25922
diff changeset
   487
apply (rule admD, simp, simp)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   488
apply (drule_tac c="Abs_compact_basis (approx i\<cdot>x)" in subsetD)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   489
apply (simp add: compacts_def Abs_compact_basis_inverse approx_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   490
apply (simp add: compacts_def Abs_compact_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   491
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   492
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   493
lemma compacts_mono: "x \<sqsubseteq> y \<Longrightarrow> compacts x \<subseteq> compacts y"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   494
unfolding compacts_def by (fast intro: trans_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   495
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   496
lemma less_compact_basis_iff: "(x \<sqsubseteq> y) = (compacts x \<subseteq> compacts y)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   497
by (rule iffI [OF compacts_mono compacts_lessD])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   498
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   499
lemma compact_basis_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   500
  "\<lbrakk>adm P; \<And>a. P (Rep_compact_basis a)\<rbrakk> \<Longrightarrow> P x"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   501
apply (erule approx_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   502
apply (drule_tac x="Abs_compact_basis (approx n\<cdot>x)" in meta_spec)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   503
apply (simp add: Abs_compact_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   504
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   505
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   506
text {* approximation on compact bases *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   507
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   508
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   509
  compact_approx :: "nat \<Rightarrow> 'a compact_basis \<Rightarrow> 'a compact_basis" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   510
  "compact_approx = (\<lambda>n a. Abs_compact_basis (approx n\<cdot>(Rep_compact_basis a)))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   511
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   512
lemma Rep_compact_approx:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   513
  "Rep_compact_basis (compact_approx n a) = approx n\<cdot>(Rep_compact_basis a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   514
unfolding compact_approx_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   515
by (simp add: Abs_compact_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   516
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   517
lemmas approx_Rep_compact_basis = Rep_compact_approx [symmetric]
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   518
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   519
lemma compact_approx_le: "compact_approx n a \<sqsubseteq> a"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   520
unfolding compact_le_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   521
by (simp add: Rep_compact_approx approx_less)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   522
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   523
lemma compact_approx_mono1:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   524
  "i \<le> j \<Longrightarrow> compact_approx i a \<sqsubseteq> compact_approx j a"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   525
unfolding compact_le_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   526
apply (simp add: Rep_compact_approx)
25922
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25904
diff changeset
   527
apply (rule chain_mono, simp, assumption)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   528
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   529
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   530
lemma compact_approx_mono:
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   531
  "a \<sqsubseteq> b \<Longrightarrow> compact_approx n a \<sqsubseteq> compact_approx n b"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   532
unfolding compact_le_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   533
apply (simp add: Rep_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   534
apply (erule monofun_cfun_arg)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   535
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   536
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   537
lemma ex_compact_approx_eq: "\<exists>n. compact_approx n a = a"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   538
apply (simp add: Rep_compact_basis_inject [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   539
apply (simp add: Rep_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   540
apply (rule bifinite_compact_eq_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   541
apply (rule compact_Rep_compact_basis)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   542
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   543
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   544
lemma compact_approx_idem:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   545
  "compact_approx n (compact_approx n a) = compact_approx n a"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   546
apply (rule Rep_compact_basis_inject [THEN iffD1])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   547
apply (simp add: Rep_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   548
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   549
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   550
lemma finite_fixes_compact_approx: "finite {a. compact_approx n a = a}"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   551
apply (subgoal_tac "finite (Rep_compact_basis ` {a. compact_approx n a = a})")
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   552
apply (erule finite_imageD)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   553
apply (rule inj_onI, simp add: Rep_compact_basis_inject)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   554
apply (rule finite_subset [OF _ finite_fixes_approx [where i=n]])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   555
apply (rule subsetI, clarify, rename_tac a)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   556
apply (simp add: Rep_compact_basis_inject [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   557
apply (simp add: Rep_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   558
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   559
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   560
lemma finite_range_compact_approx: "finite (range (compact_approx n))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   561
apply (cut_tac n=n in finite_fixes_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   562
apply (simp add: idem_fixes_eq_range compact_approx_idem)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   563
apply (simp add: image_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   564
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   565
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   566
interpretation compact_basis:
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   567
  ideal_completion [sq_le compact_approx Rep_compact_basis compacts]
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   568
proof (unfold_locales)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   569
  fix n :: nat and a b :: "'a compact_basis" and x :: "'a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   570
  show "compact_approx n a \<sqsubseteq> a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   571
    by (rule compact_approx_le)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   572
  show "compact_approx n (compact_approx n a) = compact_approx n a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   573
    by (rule compact_approx_idem)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   574
  show "compact_approx n a \<sqsubseteq> compact_approx (Suc n) a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   575
    by (rule compact_approx_mono1, simp)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   576
  show "finite (range (compact_approx n))"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   577
    by (rule finite_range_compact_approx)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   578
  show "\<exists>n\<Colon>nat. compact_approx n a = a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   579
    by (rule ex_compact_approx_eq)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   580
  show "preorder.ideal sq_le (compacts x)"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   581
    by (rule ideal_compacts)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   582
  show "cont compacts"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   583
    by (rule cont_compacts)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   584
  show "compacts (Rep_compact_basis a) = {b. b \<sqsubseteq> a}"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   585
    by (rule compacts_Rep_compact_basis)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   586
next
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   587
  fix n :: nat and a b :: "'a compact_basis"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   588
  assume "a \<sqsubseteq> b"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   589
  thus "compact_approx n a \<sqsubseteq> compact_approx n b"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   590
    by (rule compact_approx_mono)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   591
next
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   592
  fix x y :: "'a"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   593
  assume "compacts x \<subseteq> compacts y" thus "x \<sqsubseteq> y"
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   594
    by (rule compacts_lessD)
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   595
qed
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   596
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   597
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   598
subsection {* A compact basis for powerdomains *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   599
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   600
typedef 'a pd_basis =
26407
562a1d615336 rename class bifinite_cpo to profinite; generalize powerdomains from bifinite to profinite
huffman
parents: 26041
diff changeset
   601
  "{S::'a::profinite compact_basis set. finite S \<and> S \<noteq> {}}"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   602
by (rule_tac x="{arbitrary}" in exI, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   603
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   604
lemma finite_Rep_pd_basis [simp]: "finite (Rep_pd_basis u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   605
by (insert Rep_pd_basis [of u, unfolded pd_basis_def]) simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   606
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   607
lemma Rep_pd_basis_nonempty [simp]: "Rep_pd_basis u \<noteq> {}"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   608
by (insert Rep_pd_basis [of u, unfolded pd_basis_def]) simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   609
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   610
text {* unit and plus *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   611
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   612
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   613
  PDUnit :: "'a compact_basis \<Rightarrow> 'a pd_basis" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   614
  "PDUnit = (\<lambda>x. Abs_pd_basis {x})"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   615
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   616
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   617
  PDPlus :: "'a pd_basis \<Rightarrow> 'a pd_basis \<Rightarrow> 'a pd_basis" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   618
  "PDPlus t u = Abs_pd_basis (Rep_pd_basis t \<union> Rep_pd_basis u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   619
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   620
lemma Rep_PDUnit:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   621
  "Rep_pd_basis (PDUnit x) = {x}"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   622
unfolding PDUnit_def by (rule Abs_pd_basis_inverse) (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   623
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   624
lemma Rep_PDPlus:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   625
  "Rep_pd_basis (PDPlus u v) = Rep_pd_basis u \<union> Rep_pd_basis v"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   626
unfolding PDPlus_def by (rule Abs_pd_basis_inverse) (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   627
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   628
lemma PDUnit_inject [simp]: "(PDUnit a = PDUnit b) = (a = b)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   629
unfolding Rep_pd_basis_inject [symmetric] Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   630
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   631
lemma PDPlus_assoc: "PDPlus (PDPlus t u) v = PDPlus t (PDPlus u v)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   632
unfolding Rep_pd_basis_inject [symmetric] Rep_PDPlus by (rule Un_assoc)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   633
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   634
lemma PDPlus_commute: "PDPlus t u = PDPlus u t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   635
unfolding Rep_pd_basis_inject [symmetric] Rep_PDPlus by (rule Un_commute)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   636
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   637
lemma PDPlus_absorb: "PDPlus t t = t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   638
unfolding Rep_pd_basis_inject [symmetric] Rep_PDPlus by (rule Un_absorb)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   639
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   640
lemma pd_basis_induct1:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   641
  assumes PDUnit: "\<And>a. P (PDUnit a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   642
  assumes PDPlus: "\<And>a t. P t \<Longrightarrow> P (PDPlus (PDUnit a) t)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   643
  shows "P x"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   644
apply (induct x, unfold pd_basis_def, clarify)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   645
apply (erule (1) finite_ne_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   646
apply (cut_tac a=x in PDUnit)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   647
apply (simp add: PDUnit_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   648
apply (drule_tac a=x in PDPlus)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   649
apply (simp add: PDUnit_def PDPlus_def Abs_pd_basis_inverse [unfolded pd_basis_def])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   650
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   651
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   652
lemma pd_basis_induct:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   653
  assumes PDUnit: "\<And>a. P (PDUnit a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   654
  assumes PDPlus: "\<And>t u. \<lbrakk>P t; P u\<rbrakk> \<Longrightarrow> P (PDPlus t u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   655
  shows "P x"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   656
apply (induct x rule: pd_basis_induct1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   657
apply (rule PDUnit, erule PDPlus [OF PDUnit])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   658
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   659
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   660
text {* fold-pd *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   661
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   662
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   663
  fold_pd ::
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   664
    "('a compact_basis \<Rightarrow> 'b::type) \<Rightarrow> ('b \<Rightarrow> 'b \<Rightarrow> 'b) \<Rightarrow> 'a pd_basis \<Rightarrow> 'b"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   665
  where "fold_pd g f t = fold1 f (g ` Rep_pd_basis t)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   666
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   667
lemma fold_pd_PDUnit:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   668
  includes ab_semigroup_idem_mult f
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   669
  shows "fold_pd g f (PDUnit x) = g x"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   670
unfolding fold_pd_def Rep_PDUnit by simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   671
26927
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   672
lemma fold_pd_PDPlus:
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   673
  includes ab_semigroup_idem_mult f
8684b5240f11 rename locales;
huffman
parents: 26806
diff changeset
   674
  shows "fold_pd g f (PDPlus t u) = f (fold_pd g f t) (fold_pd g f u)"
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   675
unfolding fold_pd_def Rep_PDPlus by (simp add: image_Un fold1_Un2)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   676
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   677
text {* approx-pd *}
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   678
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   679
definition
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   680
  approx_pd :: "nat \<Rightarrow> 'a pd_basis \<Rightarrow> 'a pd_basis" where
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   681
  "approx_pd n = (\<lambda>t. Abs_pd_basis (compact_approx n ` Rep_pd_basis t))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   682
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   683
lemma Rep_approx_pd:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   684
  "Rep_pd_basis (approx_pd n t) = compact_approx n ` Rep_pd_basis t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   685
unfolding approx_pd_def
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   686
apply (rule Abs_pd_basis_inverse)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   687
apply (simp add: pd_basis_def)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   688
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   689
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   690
lemma approx_pd_simps [simp]:
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   691
  "approx_pd n (PDUnit a) = PDUnit (compact_approx n a)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   692
  "approx_pd n (PDPlus t u) = PDPlus (approx_pd n t) (approx_pd n u)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   693
apply (simp_all add: Rep_pd_basis_inject [symmetric])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   694
apply (simp_all add: Rep_approx_pd Rep_PDUnit Rep_PDPlus image_Un)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   695
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   696
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   697
lemma approx_pd_idem: "approx_pd n (approx_pd n t) = approx_pd n t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   698
apply (induct t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   699
apply (simp add: compact_approx_idem)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   700
apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   701
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   702
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   703
lemma range_image_f: "range (image f) = Pow (range f)"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   704
apply (safe, fast)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   705
apply (rule_tac x="f -` x" in range_eqI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   706
apply (simp, fast)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   707
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   708
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   709
lemma finite_range_approx_pd: "finite (range (approx_pd n))"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   710
apply (subgoal_tac "finite (Rep_pd_basis ` range (approx_pd n))")
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   711
apply (erule finite_imageD)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   712
apply (rule inj_onI, simp add: Rep_pd_basis_inject)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   713
apply (subst image_image)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   714
apply (subst Rep_approx_pd)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   715
apply (simp only: range_composition)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   716
apply (rule finite_subset [OF image_mono [OF subset_UNIV]])
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   717
apply (simp add: range_image_f)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   718
apply (rule finite_range_compact_approx)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   719
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   720
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   721
lemma ex_approx_pd_eq: "\<exists>n. approx_pd n t = t"
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   722
apply (subgoal_tac "\<exists>n. \<forall>m\<ge>n. approx_pd m t = t", fast)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   723
apply (induct t rule: pd_basis_induct)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   724
apply (cut_tac a=a in ex_compact_approx_eq)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   725
apply (clarify, rule_tac x=n in exI)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   726
apply (clarify, simp)
26420
57a626f64875 make preorder locale into a superclass of class po
huffman
parents: 26407
diff changeset
   727
apply (rule antisym_less)
25904
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   728
apply (rule compact_approx_le)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   729
apply (drule_tac a=a in compact_approx_mono1)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   730
apply simp
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   731
apply (clarify, rename_tac i j)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   732
apply (rule_tac x="max i j" in exI, simp)
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   733
done
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   734
8161f137b0e9 new theory of powerdomains
huffman
parents:
diff changeset
   735
end