src/HOLCF/Up.thy
author wenzelm
Wed, 02 Nov 2005 14:47:00 +0100
changeset 18063 c4bffc47c11b
parent 17838 3032e90c4975
child 18078 20e5a6440790
permissions -rw-r--r--
Isar.loop;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
     1
(*  Title:      HOLCF/Up.thy
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     2
    ID:         $Id$
16070
4a83dd540b88 removed LICENCE note -- everything is subject to Isabelle licence as
wenzelm
parents: 15599
diff changeset
     3
    Author:     Franz Regensburger and Brian Huffman
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     4
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     5
Lifting.
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     6
*)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     7
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     8
header {* The type of lifted values *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     9
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    10
theory Up
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    11
imports Cfun Sum_Type Datatype
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    13
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    14
defaultsort cpo
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    15
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    16
subsection {* Definition of new type for lifting *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    17
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    18
datatype 'a u = Ibottom | Iup 'a
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    19
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    20
consts
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    21
  Ifup :: "('a \<rightarrow> 'b::pcpo) \<Rightarrow> 'a u \<Rightarrow> 'b"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    22
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    23
primrec
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    24
  "Ifup f Ibottom = \<bottom>"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    25
  "Ifup f (Iup x) = f\<cdot>x"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    26
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    27
subsection {* Ordering on type @{typ "'a u"} *}
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    28
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    29
instance u :: (sq_ord) sq_ord ..
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    30
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    31
defs (overloaded)
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    32
  less_up_def:
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    33
    "(op \<sqsubseteq>) \<equiv> (\<lambda>x y. case x of Ibottom \<Rightarrow> True | Iup a \<Rightarrow>
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    34
      (case y of Ibottom \<Rightarrow> False | Iup b \<Rightarrow> a \<sqsubseteq> b))"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    35
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    36
lemma minimal_up [iff]: "Ibottom \<sqsubseteq> z"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    37
by (simp add: less_up_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    38
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    39
lemma not_Iup_less [iff]: "\<not> Iup x \<sqsubseteq> Ibottom"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    40
by (simp add: less_up_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    41
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    42
lemma Iup_less [iff]: "(Iup x \<sqsubseteq> Iup y) = (x \<sqsubseteq> y)"
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    43
by (simp add: less_up_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    44
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    45
subsection {* Type @{typ "'a u"} is a partial order *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    46
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    47
lemma refl_less_up: "(x::'a u) \<sqsubseteq> x"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    48
by (simp add: less_up_def split: u.split)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    49
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    50
lemma antisym_less_up: "\<lbrakk>(x::'a u) \<sqsubseteq> y; y \<sqsubseteq> x\<rbrakk> \<Longrightarrow> x = y"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    51
apply (simp add: less_up_def split: u.split_asm)
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    52
apply (erule (1) antisym_less)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    53
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    54
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    55
lemma trans_less_up: "\<lbrakk>(x::'a u) \<sqsubseteq> y; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq> z"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    56
apply (simp add: less_up_def split: u.split_asm)
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    57
apply (erule (1) trans_less)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    58
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    59
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    60
instance u :: (cpo) po
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    61
by intro_classes
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    62
  (assumption | rule refl_less_up antisym_less_up trans_less_up)+
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    63
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    64
subsection {* Type @{typ "'a u"} is a cpo *}
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    65
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    66
lemma is_lub_Iup:
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    67
  "range S <<| x \<Longrightarrow> range (\<lambda>i. Iup (S i)) <<| Iup x"
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    68
apply (rule is_lubI)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    69
apply (rule ub_rangeI)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    70
apply (subst Iup_less)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    71
apply (erule is_ub_lub)
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    72
apply (case_tac u)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    73
apply (drule ub_rangeD)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    74
apply simp
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    75
apply simp
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    76
apply (erule is_lub_lub)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    77
apply (rule ub_rangeI)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    78
apply (drule_tac i=i in ub_rangeD)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    79
apply simp
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    80
done
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    81
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    82
text {* Now some lemmas about chains of @{typ "'a u"} elements *}
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    83
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    84
lemma up_lemma1: "z \<noteq> Ibottom \<Longrightarrow> Iup (THE a. Iup a = z) = z"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    85
by (case_tac z, simp_all)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    86
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    87
lemma up_lemma2:
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    88
  "\<lbrakk>chain Y; Y j \<noteq> Ibottom\<rbrakk> \<Longrightarrow> Y (i + j) \<noteq> Ibottom"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    89
apply (erule contrapos_nn)
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    90
apply (drule_tac x="j" and y="i + j" in chain_mono3)
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    91
apply (rule le_add2)
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    92
apply (case_tac "Y j")
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    93
apply assumption
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    94
apply simp
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    95
done
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
    96
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    97
lemma up_lemma3:
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
    98
  "\<lbrakk>chain Y; Y j \<noteq> Ibottom\<rbrakk> \<Longrightarrow> Iup (THE a. Iup a = Y (i + j)) = Y (i + j)"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
    99
by (rule up_lemma1 [OF up_lemma2])
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   100
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   101
lemma up_lemma4:
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   102
  "\<lbrakk>chain Y; Y j \<noteq> Ibottom\<rbrakk> \<Longrightarrow> chain (\<lambda>i. THE a. Iup a = Y (i + j))"
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   103
apply (rule chainI)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   104
apply (rule Iup_less [THEN iffD1])
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   105
apply (subst up_lemma3, assumption+)+
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   106
apply (simp add: chainE)
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   107
done
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   108
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   109
lemma up_lemma5:
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   110
  "\<lbrakk>chain Y; Y j \<noteq> Ibottom\<rbrakk> \<Longrightarrow>
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   111
    (\<lambda>i. Y (i + j)) = (\<lambda>i. Iup (THE a. Iup a = Y (i + j)))"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   112
by (rule ext, rule up_lemma3 [symmetric])
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   113
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   114
lemma up_lemma6:
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   115
  "\<lbrakk>chain Y; Y j \<noteq> Ibottom\<rbrakk>  
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   116
      \<Longrightarrow> range Y <<| Iup (\<Squnion>i. THE a. Iup a = Y(i + j))"
16933
91ded127f5f7 fixed var index in tactic;
wenzelm
parents: 16753
diff changeset
   117
apply (rule_tac j1 = j in is_lub_range_shift [THEN iffD1])
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   118
apply assumption
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   119
apply (subst up_lemma5, assumption+)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   120
apply (rule is_lub_Iup)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   121
apply (rule thelubE [OF _ refl])
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   122
apply (erule (1) up_lemma4)
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   123
done
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   124
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   125
lemma up_chain_lemma:
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   126
  "chain Y \<Longrightarrow>
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   127
   (\<exists>A. chain A \<and> lub (range Y) = Iup (lub (range A)) \<and>
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   128
   (\<exists>j. \<forall>i. Y (i + j) = Iup (A i))) \<or> (Y = (\<lambda>i. Ibottom))"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   129
apply (rule disjCI)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   130
apply (simp add: expand_fun_eq)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   131
apply (erule exE, rename_tac j)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   132
apply (rule_tac x="\<lambda>i. THE a. Iup a = Y (i + j)" in exI)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   133
apply (simp add: up_lemma4)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   134
apply (simp add: up_lemma6 [THEN thelubI])
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   135
apply (rule_tac x=j in exI)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   136
apply (simp add: up_lemma3)
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   137
done
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   138
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   139
lemma cpo_up: "chain (Y::nat \<Rightarrow> 'a u) \<Longrightarrow> \<exists>x. range Y <<| x"
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   140
apply (frule up_chain_lemma, safe)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   141
apply (rule_tac x="Iup (lub (range A))" in exI)
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   142
apply (erule_tac j="j" in is_lub_range_shift [THEN iffD1, standard])
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   143
apply (simp add: is_lub_Iup thelubE)
17585
f12d7ac88eb4 cleaned up
huffman
parents: 16933
diff changeset
   144
apply (rule exI, rule lub_const)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   145
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   146
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   147
instance u :: (cpo) cpo
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   148
by intro_classes (rule cpo_up)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   149
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   150
subsection {* Type @{typ "'a u"} is pointed *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   151
17585
f12d7ac88eb4 cleaned up
huffman
parents: 16933
diff changeset
   152
lemma least_up: "\<exists>x::'a u. \<forall>y. x \<sqsubseteq> y"
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   153
apply (rule_tac x = "Ibottom" in exI)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   154
apply (rule minimal_up [THEN allI])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   155
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   156
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   157
instance u :: (cpo) pcpo
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   158
by intro_classes (rule least_up)
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   159
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   160
text {* for compatibility with old HOLCF-Version *}
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   161
lemma inst_up_pcpo: "\<bottom> = Ibottom"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   162
by (rule minimal_up [THEN UU_I, symmetric])
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   163
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   164
subsection {* Continuity of @{term Iup} and @{term Ifup} *}
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   165
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   166
text {* continuity for @{term Iup} *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   167
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   168
lemma cont_Iup: "cont Iup"
16215
7ff978ca1920 changed to use new contlubI, etc.
huffman
parents: 16070
diff changeset
   169
apply (rule contI)
15599
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   170
apply (rule is_lub_Iup)
10cedbd5289e instance u :: (cpo) pcpo -- argument type no longer needs to be pointed
huffman
parents: 15593
diff changeset
   171
apply (erule thelubE [OF _ refl])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   172
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   173
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   174
text {* continuity for @{term Ifup} *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   175
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   176
lemma cont_Ifup1: "cont (\<lambda>f. Ifup f x)"
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   177
by (induct x, simp_all)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   178
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   179
lemma monofun_Ifup2: "monofun (\<lambda>x. Ifup f x)"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   180
apply (rule monofunI)
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   181
apply (case_tac x, simp)
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   182
apply (case_tac y, simp)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   183
apply (simp add: monofun_cfun_arg)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   184
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   185
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   186
lemma cont_Ifup2: "cont (\<lambda>x. Ifup f x)"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   187
apply (rule contI)
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   188
apply (frule up_chain_lemma, safe)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   189
apply (rule_tac j="j" in is_lub_range_shift [THEN iffD1, standard])
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   190
apply (erule monofun_Ifup2 [THEN ch2ch_monofun])
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   191
apply (simp add: cont_cfun_arg)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   192
apply (simp add: thelub_const lub_const)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   193
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   194
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   195
subsection {* Continuous versions of constants *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   196
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   197
constdefs  
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   198
  up  :: "'a \<rightarrow> 'a u"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   199
  "up \<equiv> \<Lambda> x. Iup x"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   200
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   201
  fup :: "('a \<rightarrow> 'b::pcpo) \<rightarrow> 'a u \<rightarrow> 'b"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   202
  "fup \<equiv> \<Lambda> f p. Ifup f p"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   203
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   204
translations
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   205
  "case l of up\<cdot>x \<Rightarrow> t" == "fup\<cdot>(LAM x. t)\<cdot>l"
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   206
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   207
text {* continuous versions of lemmas for @{typ "('a)u"} *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   208
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   209
lemma Exh_Up: "z = \<bottom> \<or> (\<exists>x. z = up\<cdot>x)"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   210
apply (induct z)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   211
apply (simp add: inst_up_pcpo)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   212
apply (simp add: up_def cont_Iup)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   213
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   214
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   215
lemma up_eq [simp]: "(up\<cdot>x = up\<cdot>y) = (x = y)"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   216
by (simp add: up_def cont_Iup)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   217
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   218
lemma up_inject: "up\<cdot>x = up\<cdot>y \<Longrightarrow> x = y"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   219
by simp
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   220
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   221
lemma up_defined [simp]: "up\<cdot>x \<noteq> \<bottom>"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   222
by (simp add: up_def cont_Iup inst_up_pcpo)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   223
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   224
lemma not_up_less_UU [simp]: "\<not> up\<cdot>x \<sqsubseteq> \<bottom>"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   225
by (simp add: eq_UU_iff [symmetric])
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   226
16326
50a613925c4e make up_eq and up_less into simp rules
huffman
parents: 16319
diff changeset
   227
lemma up_less [simp]: "(up\<cdot>x \<sqsubseteq> up\<cdot>y) = (x \<sqsubseteq> y)"
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   228
by (simp add: up_def cont_Iup)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   229
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   230
lemma upE: "\<lbrakk>p = \<bottom> \<Longrightarrow> Q; \<And>x. p = up\<cdot>x \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   231
apply (case_tac p)
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   232
apply (simp add: inst_up_pcpo)
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   233
apply (simp add: up_def cont_Iup)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   234
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   235
17838
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   236
lemma up_chain_cases:
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   237
  "chain Y \<Longrightarrow>
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   238
  (\<exists>A. chain A \<and> (\<Squnion>i. Y i) = up\<cdot>(\<Squnion>i. A i) \<and>
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   239
  (\<exists>j. \<forall>i. Y (i + j) = up\<cdot>(A i))) \<or> Y = (\<lambda>i. \<bottom>)"
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   240
by (simp add: inst_up_pcpo up_def cont_Iup up_chain_lemma)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   241
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   242
lemma compact_up [simp]: "compact x \<Longrightarrow> compact (up\<cdot>x)"
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   243
apply (unfold compact_def)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   244
apply (rule admI)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   245
apply (drule up_chain_cases)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   246
apply (elim disjE exE conjE)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   247
apply simp
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   248
apply (erule (1) admD)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   249
apply (rule allI, drule_tac x="i + j" in spec)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   250
apply simp
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   251
apply (simp add: thelub_const)
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   252
done
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   253
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   254
text {* properties of fup *}
3032e90c4975 added compactness theorems
huffman
parents: 17585
diff changeset
   255
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   256
lemma fup1 [simp]: "fup\<cdot>f\<cdot>\<bottom> = \<bottom>"
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   257
by (simp add: fup_def cont_Ifup1 cont_Ifup2 inst_up_pcpo)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   258
16319
1ff2965cc2e7 major cleanup: rewrote cpo proofs, removed obsolete lemmas, renamed some lemmas
huffman
parents: 16215
diff changeset
   259
lemma fup2 [simp]: "fup\<cdot>f\<cdot>(up\<cdot>x) = f\<cdot>x"
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   260
by (simp add: up_def fup_def cont_Iup cont_Ifup1 cont_Ifup2)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   261
16553
aa36d41e4263 add csplit3, ssplit3, fup3 as simp rules
huffman
parents: 16326
diff changeset
   262
lemma fup3 [simp]: "fup\<cdot>up\<cdot>x = x"
16753
fb6801c926d2 define 'a u with datatype package;
huffman
parents: 16553
diff changeset
   263
by (rule_tac p=x in upE, simp_all)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   264
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   265
end