src/HOLCF/Porder.thy
author huffman
Wed, 02 Mar 2005 22:30:00 +0100
changeset 15562 8455c9671494
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:
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
     1
(*  Title:      HOLCF/porder.thy
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
     3
    Author:     Franz Regensburger
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     5
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
     6
Conservative extension of theory Porder0 by constant definitions 
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     7
*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     8
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
     9
theory Porder = Porder0:
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    10
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    11
consts  
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    12
        "<|"    ::      "['a set,'a::po] => bool"       (infixl 55)
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    13
        "<<|"   ::      "['a set,'a::po] => bool"       (infixl 55)
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    14
        lub     ::      "'a set => 'a::po"
4721
c8a8482a8124 renamed is_chain to chain, is_tord to tord, replaced chain_finite by chfin
oheimb
parents: 3842
diff changeset
    15
        tord ::      "'a::po set => bool"
c8a8482a8124 renamed is_chain to chain, is_tord to tord, replaced chain_finite by chfin
oheimb
parents: 3842
diff changeset
    16
        chain ::     "(nat=>'a::po) => bool"
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    17
        max_in_chain :: "[nat,nat=>'a::po]=>bool"
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    18
        finite_chain :: "(nat=>'a::po)=>bool"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    19
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    20
syntax
12338
de0f4a63baa5 renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents: 12114
diff changeset
    21
  "@LUB"	:: "('b => 'a) => 'a"	(binder "LUB " 10)
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    22
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    23
translations
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    24
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2640
diff changeset
    25
  "LUB x. t"	== "lub(range(%x. t))"
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    26
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12030
diff changeset
    27
syntax (xsymbols)
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    28
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    29
  "LUB "	:: "[idts, 'a] => 'a"		("(3\<Squnion>_./ _)"[0,10] 10)
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    30
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
    31
defs
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    32
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    33
(* class definitions *)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    34
is_ub_def:       "S  <| x == ! y. y:S --> y<<x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    35
is_lub_def:      "S <<| x == S <| x & (!u. S <| u  --> x << u)"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    36
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    37
(* Arbitrary chains are total orders    *)                  
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    38
tord_def:     "tord S == !x y. x:S & y:S --> (x<<y | y<<x)"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    39
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    40
(* Here we use countable chains and I prefer to code them as functions! *)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    41
chain_def:        "chain F == !i. F i << F (Suc i)"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    42
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    43
(* finite chains, needed for monotony of continouous functions *)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    44
max_in_chain_def: "max_in_chain i C == ! j. i <= j --> C(i) = C(j)" 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    45
finite_chain_def: "finite_chain C == chain(C) & (? i. max_in_chain i C)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    46
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    47
lub_def:          "lub S == (@x. S <<| x)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    48
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    49
(*  Title:      HOLCF/Porder
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    50
    ID:         $Id$
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    51
    Author:     Franz Regensburger
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    52
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    53
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    54
Conservative extension of theory Porder0 by constant definitions 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    55
*)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    56
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    57
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    58
(* lubs are unique                                                          *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    59
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    60
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    61
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    62
lemma unique_lub: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    63
        "[| S <<| x ; S <<| y |] ==> x=y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    64
apply (unfold is_lub_def is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    65
apply (blast intro: antisym_less)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    66
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    67
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    68
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    69
(* chains are monotone functions                                            *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    70
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    71
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    72
lemma chain_mono [rule_format]: "chain F ==> x<y --> F x<<F y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    73
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    74
apply (induct_tac "y")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    75
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    76
prefer 2 apply (blast intro: trans_less)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    77
apply (blast elim!: less_SucE)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    78
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    79
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    80
lemma chain_mono3: "[| chain F; x <= y |] ==> F x << F y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    81
apply (drule le_imp_less_or_eq)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    82
apply (blast intro: chain_mono)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    83
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    84
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    85
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    86
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    87
(* The range of a chain is a totally ordered     <<                         *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    88
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    89
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    90
lemma chain_tord: "chain(F) ==> tord(range(F))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    91
apply (unfold tord_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    92
apply safe
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    93
apply (rule nat_less_cases)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    94
apply (fast intro: chain_mono)+
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    95
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    96
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    97
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    98
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    99
(* technical lemmas about lub and is_lub                                    *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   100
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   101
lemmas lub = lub_def [THEN meta_eq_to_obj_eq, standard]
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   102
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   103
lemma lubI[OF exI]: "EX x. M <<| x ==> M <<| lub(M)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   104
apply (simp add: lub some_eq_ex)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   105
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   106
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   107
lemma thelubI: "M <<| l ==> lub(M) = l"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   108
apply (rule unique_lub)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   109
apply (subst lub)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   110
apply (erule someI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   111
apply assumption
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   112
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   113
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   114
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   115
lemma lub_singleton: "lub{x} = x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   116
apply (simp (no_asm) add: thelubI is_lub_def is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   117
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   118
declare lub_singleton [simp]
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   119
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   120
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   121
(* access to some definition as inference rule                              *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   122
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   123
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   124
lemma is_lubD1: "S <<| x ==> S <| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   125
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   126
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   127
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   128
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   129
lemma is_lub_lub: "[| S <<| x; S <| u |] ==> x << u"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   130
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   131
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   132
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   133
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   134
lemma is_lubI:
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   135
        "[| S <| x; !!u. S <| u ==> x << u |] ==> S <<| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   136
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   137
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   138
done
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   139
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   140
lemma chainE: "chain F ==> F(i) << F(Suc(i))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   141
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   142
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   143
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   144
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   145
lemma chainI: "(!!i. F i << F(Suc i)) ==> chain F"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   146
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   147
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   148
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   149
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   150
lemma chain_shift: "chain Y ==> chain (%i. Y (i + j))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   151
apply (rule chainI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   152
apply clarsimp
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   153
apply (erule chainE)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   154
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   155
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   156
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   157
(* technical lemmas about (least) upper bounds of chains                    *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   158
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   159
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   160
lemma ub_rangeD: "range S <| x  ==> S(i) << x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   161
apply (unfold is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   162
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   163
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   164
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   165
lemma ub_rangeI: "(!!i. S i << x) ==> range S <| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   166
apply (unfold is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   167
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   168
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   169
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   170
lemmas is_ub_lub = is_lubD1 [THEN ub_rangeD, standard]
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   171
(* range(?S1) <<| ?x1 ==> ?S1(?x) << ?x1                                    *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   172
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   173
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   174
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   175
(* results about finite chains                                              *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   176
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   177
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   178
lemma lub_finch1: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   179
        "[| chain C; max_in_chain i C|] ==> range C <<| C i"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   180
apply (unfold max_in_chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   181
apply (rule is_lubI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   182
apply (rule ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   183
apply (rule_tac m = "i" in nat_less_cases)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   184
apply (rule antisym_less_inverse [THEN conjunct2])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   185
apply (erule disjI1 [THEN less_or_eq_imp_le, THEN rev_mp])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   186
apply (erule spec)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   187
apply (rule antisym_less_inverse [THEN conjunct2])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   188
apply (erule disjI2 [THEN less_or_eq_imp_le, THEN rev_mp])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   189
apply (erule spec)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   190
apply (erule chain_mono)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   191
apply assumption
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   192
apply (erule ub_rangeD)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   193
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   194
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   195
lemma lub_finch2: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   196
        "finite_chain(C) ==> range(C) <<| C(@ i. max_in_chain i C)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   197
apply (unfold finite_chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   198
apply (rule lub_finch1)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   199
prefer 2 apply (best intro: someI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   200
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   201
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   202
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   203
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   204
lemma bin_chain: "x<<y ==> chain (%i. if i=0 then x else y)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   205
apply (rule chainI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   206
apply (induct_tac "i")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   207
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   208
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   209
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   210
lemma bin_chainmax: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   211
        "x<<y ==> max_in_chain (Suc 0) (%i. if (i=0) then x else y)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   212
apply (unfold max_in_chain_def le_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   213
apply (rule allI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   214
apply (induct_tac "j")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   215
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   216
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   217
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   218
lemma lub_bin_chain: "x << y ==> range(%i::nat. if (i=0) then x else y) <<| y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   219
apply (rule_tac s = "if (Suc 0) = 0 then x else y" in subst , rule_tac [2] lub_finch1)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   220
apply (erule_tac [2] bin_chain)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   221
apply (erule_tac [2] bin_chainmax)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   222
apply (simp (no_asm))
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   223
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   224
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   225
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   226
(* the maximal element in a chain is its lub                                *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   227
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   228
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   229
lemma lub_chain_maxelem: "[| Y i = c;  ALL i. Y i<<c |] ==> lub(range Y) = c"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   230
apply (blast dest: ub_rangeD intro: thelubI is_lubI ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   231
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   232
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   233
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   234
(* the lub of a constant chain is the constant                              *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   235
(* ------------------------------------------------------------------------ *)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   236
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   237
lemma lub_const: "range(%x. c) <<| c"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   238
apply (blast dest: ub_rangeD intro: is_lubI ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   239
done
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents: 1168
diff changeset
   240
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   241
end 
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
   242
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
   243