src/HOLCF/Pcpo.thy
author huffman
Sat, 04 Jun 2005 00:22:08 +0200
changeset 16221 879400e029bf
parent 16203 b3268fe39838
child 16626 d28314d2dce3
permissions -rw-r--r--
New theory with lemmas for the fixrec package
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
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     4
16070
4a83dd540b88 removed LICENCE note -- everything is subject to Isabelle licence as
wenzelm
parents: 15930
diff changeset
     5
Introduction of the classes cpo and pcpo.
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
     6
*)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15563
diff changeset
     7
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15563
diff changeset
     8
header {* Classes cpo and pcpo *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15563
diff changeset
     9
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    10
theory Pcpo
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    11
imports Porder
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
begin
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    13
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    14
subsection {* Complete partial orders *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    15
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    16
text {* The class cpo of chain complete partial orders *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    17
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2394
diff changeset
    18
axclass cpo < po
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    19
        -- {* class axiom: *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    20
  cpo:   "chain S ==> ? x. range S <<| x" 
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    21
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    22
text {* in cpo's everthing equal to THE lub has lub properties for every chain *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    23
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    24
lemma thelubE: "[| chain(S); lub(range(S)) = (l::'a::cpo) |] ==> range(S) <<| l"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    25
by (blast dest: cpo intro: lubI)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    26
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    27
text {* Properties of the lub *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    28
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    29
lemma is_ub_thelub: "chain (S::nat => 'a::cpo) ==> S(x) << lub(range(S))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    30
by (blast dest: cpo intro: lubI [THEN is_ub_lub])
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    31
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    32
lemma is_lub_thelub: "[| chain (S::nat => 'a::cpo); range(S) <| x |] ==> lub(range S) << x"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    33
by (blast dest: cpo intro: lubI [THEN is_lub_lub])
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    34
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    35
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
    36
apply (erule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    37
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    38
apply (subgoal_tac "? j. X i = Y j")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    39
apply  clarsimp
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    40
apply  (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    41
apply auto
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    42
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    43
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    44
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
    45
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    46
apply (rule lub_range_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    47
apply    fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    48
apply   assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    49
apply (erule chain_shift)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    50
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    51
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    52
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    53
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    54
apply (rule_tac [2] is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    55
apply (erule_tac [2] chain_shift)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    56
apply (erule chain_mono3)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    57
apply (rule le_add1)
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
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
    61
apply (rule iffI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    62
apply (fast intro!: thelubI lub_finch1)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    63
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    64
apply (safe intro!: antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    65
apply (fast elim!: chain_mono3)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    66
apply (drule sym)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    67
apply (force elim!: is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    68
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    69
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    70
text {* the @{text "<<"} relation between two chains is preserved by their lubs *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    71
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    72
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
    73
      ==> lub(range(C1)) << lub(range(C2))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    74
apply (erule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    75
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    76
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    77
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    78
apply (erule is_ub_thelub)
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
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    81
text {* the = relation between two chains is preserved by their lubs *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    82
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    83
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
    84
      ==> lub(range(C1))=lub(range(C2))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    85
by (simp only: expand_fun_eq [symmetric])
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    86
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    87
text {* more results about mono and = of lubs of chains *}
3326
930c9bed5a09 Moved the classes flat chfin from Fix to Pcpo.
slotosch
parents: 2640
diff changeset
    88
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    89
lemma lub_mono2: "[|EX j. ALL i. j<i --> X(i::nat)=Y(i);chain(X::nat=>'a::cpo);chain(Y)|] 
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    90
      ==> lub(range(X))<<lub(range(Y))"
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    91
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    92
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    93
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    94
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    95
apply (case_tac "j<i")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    96
apply (rule_tac s = "Y (i) " and t = "X (i) " in subst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    97
apply (rule sym)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    98
apply fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
    99
apply (rule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   100
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   101
apply (rule_tac y = "X (Suc (j))" in trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   102
apply (rule chain_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   103
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   104
apply (rule not_less_eq [THEN subst])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   105
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   106
apply (rule_tac s = "Y (Suc (j))" and t = "X (Suc (j))" in subst)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   107
apply (simp)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   108
apply (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   109
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   110
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   111
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
   112
      ==> lub(range(X))=lub(range(Y))"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   113
by (blast intro: antisym_less lub_mono2 sym)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   114
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   115
lemma lub_mono3: "[|chain(Y::nat=>'a::cpo);chain(X); 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   116
 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
   117
apply (rule is_lub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   118
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   119
apply (rule ub_rangeI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   120
apply (erule allE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   121
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   122
apply (rule trans_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   123
apply (rule_tac [2] is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   124
prefer 2 apply (assumption)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   125
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   126
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   127
16203
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   128
lemma ch2ch_lub:
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   129
  fixes Y :: "nat \<Rightarrow> nat \<Rightarrow> 'a::cpo"
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   130
  assumes 1: "\<And>j. chain (\<lambda>i. Y i j)"
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   131
  assumes 2: "\<And>i. chain (\<lambda>j. Y i j)"
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   132
  shows "chain (\<lambda>i. \<Squnion>j. Y i j)"
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   133
apply (rule chainI)
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   134
apply (rule lub_mono [rule_format, OF 2 2])
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   135
apply (rule chainE [OF 1])
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   136
done
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   137
16201
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   138
lemma diag_lub:
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   139
  fixes Y :: "nat \<Rightarrow> nat \<Rightarrow> 'a::cpo"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   140
  assumes 1: "\<And>j. chain (\<lambda>i. Y i j)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   141
  assumes 2: "\<And>i. chain (\<lambda>j. Y i j)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   142
  shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>i. Y i i)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   143
proof (rule antisym_less)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   144
  have 3: "chain (\<lambda>i. Y i i)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   145
    apply (rule chainI)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   146
    apply (rule trans_less)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   147
    apply (rule chainE [OF 1])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   148
    apply (rule chainE [OF 2])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   149
    done
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   150
  have 4: "chain (\<lambda>i. \<Squnion>j. Y i j)"
16203
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   151
    by (rule ch2ch_lub [OF 1 2])
16201
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   152
  show "(\<Squnion>i. \<Squnion>j. Y i j) \<sqsubseteq> (\<Squnion>i. Y i i)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   153
    apply (rule is_lub_thelub [OF 4])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   154
    apply (rule ub_rangeI)
16203
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   155
    apply (rule lub_mono3 [rule_format, OF 2 3])
16201
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   156
    apply (rule exI)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   157
    apply (rule trans_less)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   158
    apply (rule chain_mono3 [OF 1 le_maxI1])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   159
    apply (rule chain_mono3 [OF 2 le_maxI2])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   160
    done
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   161
  show "(\<Squnion>i. Y i i) \<sqsubseteq> (\<Squnion>i. \<Squnion>j. Y i j)"
16203
b3268fe39838 added theorem ch2ch_lub
huffman
parents: 16201
diff changeset
   162
    apply (rule lub_mono [rule_format, OF 3 4])
16201
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   163
    apply (rule is_ub_thelub [OF 2])
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   164
    done
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   165
qed
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   166
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   167
lemma ex_lub:
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   168
  fixes Y :: "nat \<Rightarrow> nat \<Rightarrow> 'a::cpo"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   169
  assumes 1: "\<And>j. chain (\<lambda>i. Y i j)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   170
  assumes 2: "\<And>i. chain (\<lambda>j. Y i j)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   171
  shows "(\<Squnion>i. \<Squnion>j. Y i j) = (\<Squnion>j. \<Squnion>i. Y i j)"
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   172
by (simp add: diag_lub 1 2)
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   173
7bb51c8196cb added theorems diag_lub and ex_lub
huffman
parents: 16070
diff changeset
   174
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   175
subsection {* Pointed cpos *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   176
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   177
text {* The class pcpo of pointed cpos *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   178
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   179
axclass pcpo < cpo
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   180
  least:         "? x.!y. x<<y"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   181
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   182
consts
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   183
  UU            :: "'a::pcpo"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   184
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   185
syntax (xsymbols)
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   186
  UU            :: "'a::pcpo"                           ("\<bottom>")
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   187
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   188
defs
15930
145651bc64a8 Replaced all unnecessary uses of SOME with THE or LEAST
huffman
parents: 15640
diff changeset
   189
  UU_def:        "UU == THE x. ALL y. x<<y"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   190
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   191
text {* derive the old rule minimal *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   192
 
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   193
lemma UU_least: "ALL z. UU << z"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   194
apply (unfold UU_def)
15930
145651bc64a8 Replaced all unnecessary uses of SOME with THE or LEAST
huffman
parents: 15640
diff changeset
   195
apply (rule theI')
145651bc64a8 Replaced all unnecessary uses of SOME with THE or LEAST
huffman
parents: 15640
diff changeset
   196
apply (rule ex_ex1I)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   197
apply (rule least)
15930
145651bc64a8 Replaced all unnecessary uses of SOME with THE or LEAST
huffman
parents: 15640
diff changeset
   198
apply (blast intro: antisym_less)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   199
done
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   200
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   201
lemmas minimal = UU_least [THEN spec, standard]
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   202
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   203
declare minimal [iff]
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   204
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   205
text {* useful lemmas about @{term UU} *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   206
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   207
lemma eq_UU_iff: "(x=UU)=(x<<UU)"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   208
apply (rule iffI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   209
apply (erule ssubst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   210
apply (rule refl_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   211
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   212
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   213
apply (rule minimal)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   214
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   215
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   216
lemma UU_I: "x << UU ==> x = UU"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   217
by (subst eq_UU_iff)
15563
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"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   220
by auto
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   221
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   222
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
   223
apply (rule allI)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   224
apply (rule antisym_less)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   225
apply (rule_tac [2] minimal)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   226
apply (erule subst)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   227
apply (erule is_ub_thelub)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   228
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   229
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   230
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
   231
apply (rule lub_chain_maxelem)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   232
apply (erule spec)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   233
apply simp
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   234
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   235
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   236
lemma chain_UU_I_inverse2: "~lub(range(Y::(nat=>'a::pcpo)))=UU ==> EX i.~ Y(i)=UU"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   237
by (blast intro: chain_UU_I_inverse)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   238
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   239
lemma notUU_I: "[| x<<y; ~x=UU |] ==> ~y=UU"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   240
by (blast intro: UU_I)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   241
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   242
lemma chain_mono2: 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   243
 "[|EX j. ~Y(j)=UU;chain(Y::nat=>'a::pcpo)|] ==> EX j. ALL i. j<i-->~Y(i)=UU"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   244
by (blast dest: notUU_I chain_mono)
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   245
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   246
subsection {* Chain-finite and flat cpos *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   247
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   248
text {* further useful classes for HOLCF domains *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   249
15640
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   250
axclass chfin < po
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   251
  chfin: 	"!Y. chain Y-->(? n. max_in_chain n Y)"
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   252
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   253
axclass flat < pcpo
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   254
  ax_flat:	 	"! x y. x << y --> (x = UU) | (x=y)"
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   255
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   256
text {* some properties for chfin and flat *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   257
15640
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   258
text {* chfin types are cpo *}
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   259
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   260
lemma chfin_imp_cpo:
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   261
  "chain (S::nat=>'a::chfin) ==> EX x. range S <<| x"
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   262
apply (frule chfin [rule_format])
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   263
apply (blast intro: lub_finch1)
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   264
done
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   265
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   266
instance chfin < cpo
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   267
by intro_classes (rule chfin_imp_cpo)
2d1d6ea579a1 chfin now a subclass of po, proved instance chfin < cpo
huffman
parents: 15588
diff changeset
   268
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   269
text {* flat types are chfin *}
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   270
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   271
lemma flat_imp_chfin: 
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   272
     "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
   273
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   274
apply clarify
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   275
apply (case_tac "ALL i. Y (i) =UU")
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   276
apply simp
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   277
apply simp
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   278
apply (erule exE)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   279
apply (rule_tac x = "i" in exI)
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   280
apply clarify
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   281
apply (erule le_imp_less_or_eq [THEN disjE])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   282
apply safe
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   283
apply (blast dest: chain_mono ax_flat [rule_format])
15563
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
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   286
instance flat < chfin
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   287
by intro_classes (rule flat_imp_chfin)
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   288
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   289
text {* flat subclass of chfin @{text "-->"} @{text adm_flat} not needed *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   290
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   291
lemma flat_eq: "(a::'a::flat) ~= UU ==> a << b = (a = b)"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   292
by (safe dest!: ax_flat [rule_format])
15563
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 chfin2finch: "chain (Y::nat=>'a::chfin) ==> finite_chain Y"
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   295
by (simp add: chfin finite_chain_def)
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   296
15588
14e3228f18cc arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   297
text {* lemmata for improved admissibility introdution rule *}
15563
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   298
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   299
lemma infinite_chain_adm_lemma:
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   300
"[|chain Y; ALL i. P (Y i);  
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   301
   (!!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
   302
  |] ==> P (lub (range Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   303
apply (case_tac "finite_chain Y")
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   304
prefer 2 apply fast
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   305
apply (unfold finite_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   306
apply safe
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   307
apply (erule lub_finch1 [THEN thelubI, THEN ssubst])
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   308
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   309
apply (erule spec)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   310
done
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   311
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   312
lemma increasing_chain_adm_lemma:
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   313
"[|chain Y;  ALL i. P (Y i);  
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   314
   (!!Y. [| chain Y; ALL i. P (Y i);   
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   315
            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
   316
  ==> P (lub (range Y))) |] ==> P (lub (range Y))"
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   317
apply (erule infinite_chain_adm_lemma)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   318
apply assumption
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   319
apply (erule thin_rl)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   320
apply (unfold finite_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   321
apply (unfold max_in_chain_def)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   322
apply (fast dest: le_imp_less_or_eq elim: chain_mono)
9e125b675253 converted to new-style theory
huffman
parents: 14981
diff changeset
   323
done
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15563
diff changeset
   324
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   325
end