src/HOLCF/Pcpo.thy
author huffman
Wed, 02 Mar 2005 22:57:08 +0100
changeset 15563 9e125b675253
parent 14981 e73f8140af78
child 15576 efb95d0d01f7
permissions -rw-r--r--
converted to new-style theory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     1
(*  Title:      HOLCF/Pcpo.thy
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     2
    ID:         $Id$
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     3
    Author:     Franz Regensburger
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     5
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     6
introduction of the classes cpo and pcpo 
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     7
*)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
     8
theory Pcpo = Porder:
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     9
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    10
(* The class cpo of chain complete partial orders *)
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    11
(* ********************************************** *)
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    12
axclass cpo < po
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    13
        (* class axiom: *)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    14
  cpo:   "chain S ==> ? x. range S <<| x" 
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    15
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    16
(* The class pcpo of pointed cpos *)
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    17
(* ****************************** *)
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    18
axclass pcpo < cpo
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    19
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    20
  least:         "? x.!y. x<<y"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    21
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    22
consts
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    23
  UU            :: "'a::pcpo"        
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    24
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12030
diff changeset
    25
syntax (xsymbols)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    26
  UU            :: "'a::pcpo"                           ("\<bottom>")
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    27
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    28
defs
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    29
  UU_def:        "UU == @x.!y. x<<y"       
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    30
3326
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    31
(* further useful classes for HOLCF domains *)
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    32
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    33
axclass chfin<cpo
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    34
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    35
chfin: 	"!Y. chain Y-->(? n. max_in_chain n Y)"
3326
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    36
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    37
axclass flat<pcpo
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    38
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    39
ax_flat:	 	"! x y. x << y --> (x = UU) | (x=y)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    40
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    41
(*  Title:      HOLCF/Pcpo.ML
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    42
    ID:         $Id$
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    43
    Author:     Franz Regensburger
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    44
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    45
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    46
introduction of the classes cpo and pcpo 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    47
*)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    48
 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    49
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    50
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    51
(* derive the old rule minimal                                              *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    52
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    53
 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    54
lemma UU_least: "ALL z. UU << z"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    55
apply (unfold UU_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    56
apply (rule some_eq_ex [THEN iffD2])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    57
apply (rule least)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    58
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    59
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    60
lemmas minimal = UU_least [THEN spec, standard]
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    61
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    62
declare minimal [iff]
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    63
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    64
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    65
(* in cpo's everthing equal to THE lub has lub properties for every chain  *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    66
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    67
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    68
lemma thelubE: "[| chain(S); lub(range(S)) = (l::'a::cpo) |] ==> range(S) <<| l "
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    69
apply (blast dest: cpo intro: lubI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    70
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    71
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    72
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    73
(* Properties of the lub                                                    *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    74
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    75
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    76
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    77
lemma is_ub_thelub: "chain (S::nat => 'a::cpo) ==> S(x) << lub(range(S))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    78
apply (blast dest: cpo intro: lubI [THEN is_ub_lub])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    79
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    80
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    81
lemma is_lub_thelub: "[| chain (S::nat => 'a::cpo); range(S) <| x |] ==> lub(range S) << x"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    82
apply (blast dest: cpo intro: lubI [THEN is_lub_lub])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    83
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    84
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    85
lemma lub_range_mono: "[| range X <= range Y;  chain Y; chain (X::nat=>'a::cpo) |] ==> lub(range X) << lub(range Y)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    86
apply (erule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    87
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    88
apply (subgoal_tac "? j. X i = Y j")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    89
apply  clarsimp
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    90
apply  (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    91
apply auto
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    92
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    93
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    94
lemma lub_range_shift: "chain (Y::nat=>'a::cpo) ==> lub(range (%i. Y(i + j))) = lub(range Y)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    95
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    96
apply (rule lub_range_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    97
apply    fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    98
apply   assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    99
apply (erule chain_shift)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   100
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   101
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   102
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   103
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   104
apply (rule_tac [2] is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   105
apply (erule_tac [2] chain_shift)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   106
apply (erule chain_mono3)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   107
apply (rule le_add1)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   108
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   109
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   110
lemma maxinch_is_thelub: "chain Y ==> max_in_chain i Y = (lub(range(Y)) = ((Y i)::'a::cpo))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   111
apply (rule iffI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   112
apply (fast intro!: thelubI lub_finch1)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   113
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   114
apply (safe intro!: antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   115
apply (fast elim!: chain_mono3)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   116
apply (drule sym)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   117
apply (force elim!: is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   118
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   119
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   120
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   121
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   122
(* the << relation between two chains is preserved by their lubs            *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   123
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   124
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   125
lemma lub_mono: "[|chain(C1::(nat=>'a::cpo));chain(C2); ALL k. C1(k) << C2(k)|] 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   126
      ==> lub(range(C1)) << lub(range(C2))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   127
apply (erule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   128
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   129
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   130
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   131
apply (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   132
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   133
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   134
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   135
(* the = relation between two chains is preserved by their lubs            *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   136
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   137
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   138
lemma lub_equal: "[| chain(C1::(nat=>'a::cpo));chain(C2);ALL k. C1(k)=C2(k)|] 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   139
      ==> lub(range(C1))=lub(range(C2))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   140
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   141
apply (rule lub_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   142
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   143
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   144
apply (intro strip)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   145
apply (rule antisym_less_inverse [THEN conjunct1])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   146
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   147
apply (rule lub_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   148
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   149
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   150
apply (intro strip)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   151
apply (rule antisym_less_inverse [THEN conjunct2])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   152
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   153
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   154
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   155
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   156
(* more results about mono and = of lubs of chains                          *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   157
(* ------------------------------------------------------------------------ *)
3326
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
   158
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   159
lemma lub_mono2: "[|EX j. ALL i. j<i --> X(i::nat)=Y(i);chain(X::nat=>'a::cpo);chain(Y)|] 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   160
  ==> lub(range(X))<<lub(range(Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   161
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   162
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   163
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   164
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   165
(* apply (intro strip) *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   166
apply (case_tac "j<i")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   167
apply (rule_tac s = "Y (i) " and t = "X (i) " in subst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   168
apply (rule sym)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   169
apply fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   170
apply (rule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   171
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   172
apply (rule_tac y = "X (Suc (j))" in trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   173
apply (rule chain_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   174
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   175
apply (rule not_less_eq [THEN subst])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   176
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   177
apply (rule_tac s = "Y (Suc (j))" and t = "X (Suc (j))" in subst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   178
apply (simp (no_asm_simp))
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   179
apply (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   180
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   181
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   182
lemma lub_equal2: "[|EX j. ALL i. j<i --> X(i)=Y(i); chain(X::nat=>'a::cpo); chain(Y)|] 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   183
      ==> lub(range(X))=lub(range(Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   184
apply (blast intro: antisym_less lub_mono2 sym)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   185
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   186
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   187
lemma lub_mono3: "[|chain(Y::nat=>'a::cpo);chain(X); 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   188
 ALL i. EX j. Y(i)<< X(j)|]==> lub(range(Y))<<lub(range(X))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   189
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   190
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   191
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   192
(* apply (intro strip) *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   193
apply (erule allE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   194
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   195
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   196
apply (rule_tac [2] is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   197
prefer 2 apply (assumption)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   198
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   199
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   200
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   201
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   202
(* usefull lemmas about UU                                                  *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   203
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   204
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   205
lemma eq_UU_iff: "(x=UU)=(x<<UU)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   206
apply (rule iffI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   207
apply (erule ssubst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   208
apply (rule refl_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   209
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   210
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   211
apply (rule minimal)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   212
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   213
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   214
lemma UU_I: "x << UU ==> x = UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   215
apply (subst eq_UU_iff)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   216
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   217
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   218
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   219
lemma not_less2not_eq: "~(x::'a::po)<<y ==> ~x=y"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   220
apply auto
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   221
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   222
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   223
lemma chain_UU_I: "[|chain(Y);lub(range(Y))=UU|] ==> ALL i. Y(i)=UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   224
apply (rule allI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   225
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   226
apply (rule_tac [2] minimal)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   227
apply (erule subst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   228
apply (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   229
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   230
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   231
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   232
lemma chain_UU_I_inverse: "ALL i. Y(i::nat)=UU ==> lub(range(Y::(nat=>'a::pcpo)))=UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   233
apply (rule lub_chain_maxelem)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   234
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   235
apply (rule allI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   236
apply (rule antisym_less_inverse [THEN conjunct1])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   237
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   238
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   239
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   240
lemma chain_UU_I_inverse2: "~lub(range(Y::(nat=>'a::pcpo)))=UU ==> EX i.~ Y(i)=UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   241
apply (blast intro: chain_UU_I_inverse)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   242
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   243
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   244
lemma notUU_I: "[| x<<y; ~x=UU |] ==> ~y=UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   245
apply (blast intro: UU_I)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   246
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   247
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   248
lemma chain_mono2: 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   249
 "[|EX j. ~Y(j)=UU;chain(Y::nat=>'a::pcpo)|] ==> EX j. ALL i. j<i-->~Y(i)=UU"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   250
apply (blast dest: notUU_I chain_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   251
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   252
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   253
(**************************************)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   254
(* some properties for chfin and flat *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   255
(**************************************)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   256
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   257
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   258
(* flat types are chfin                                              *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   259
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   260
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   261
(*Used only in an "instance" declaration (Fun1.thy)*)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   262
lemma flat_imp_chfin: 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   263
     "ALL Y::nat=>'a::flat. chain Y --> (EX n. max_in_chain n Y)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   264
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   265
apply clarify
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   266
apply (case_tac "ALL i. Y (i) =UU")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   267
apply (rule_tac x = "0" in exI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   268
apply (simp (no_asm_simp))
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   269
apply simp
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   270
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   271
apply (rule_tac x = "i" in exI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   272
apply (intro strip)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   273
apply (erule le_imp_less_or_eq [THEN disjE])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   274
apply safe
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   275
apply (blast dest: chain_mono ax_flat [THEN spec, THEN spec, THEN mp])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   276
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   277
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   278
(* flat subclass of chfin --> adm_flat not needed *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   279
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   280
lemma flat_eq: "(a::'a::flat) ~= UU ==> a << b = (a = b)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   281
apply (safe intro!: refl_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   282
apply (drule ax_flat [THEN spec, THEN spec, THEN mp])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   283
apply (fast intro!: refl_less ax_flat [THEN spec, THEN spec, THEN mp])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   284
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   285
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   286
lemma chfin2finch: "chain (Y::nat=>'a::chfin) ==> finite_chain Y"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   287
apply (force simp add: chfin finite_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   288
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   289
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   290
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   291
(* lemmata for improved admissibility introdution rule                      *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   292
(* ------------------------------------------------------------------------ *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   293
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   294
lemma infinite_chain_adm_lemma:
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   295
"[|chain Y; ALL i. P (Y i);  
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   296
   (!!Y. [| chain Y; ALL i. P (Y i); ~ finite_chain Y |] ==> P (lub(range Y))) 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   297
  |] ==> P (lub (range Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   298
(* apply (cut_tac prems) *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   299
apply (case_tac "finite_chain Y")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   300
prefer 2 apply fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   301
apply (unfold finite_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   302
apply safe
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   303
apply (erule lub_finch1 [THEN thelubI, THEN ssubst])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   304
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   305
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   306
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   307
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   308
lemma increasing_chain_adm_lemma:
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   309
"[|chain Y;  ALL i. P (Y i);  
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   310
   (!!Y. [| chain Y; ALL i. P (Y i);   
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   311
            ALL i. EX j. i < j & Y i ~= Y j & Y i << Y j|] 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   312
  ==> P (lub (range Y))) |] ==> P (lub (range Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   313
(* apply (cut_tac prems) *)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   314
apply (erule infinite_chain_adm_lemma)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   315
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   316
apply (erule thin_rl)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   317
apply (unfold finite_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   318
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   319
apply (fast dest: le_imp_less_or_eq elim: chain_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   320
done
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   321
end