src/HOLCF/Porder.thy
author huffman
Thu, 10 Mar 2005 20:22:45 +0100
changeset 15600 a59f07556a8d
parent 15587 f363e6e080e7
child 15930 145651bc64a8
permissions -rw-r--r--
fixed filename in header
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15600
a59f07556a8d fixed filename in header
huffman
parents: 15587
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
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
     6
Definition of class porder (partial order).
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
     7
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
     8
*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     9
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    10
header {* Partial orders *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    11
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
theory Porder
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    13
imports Main
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    14
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    15
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    16
subsection {* Type class for partial orders *}
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    17
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    18
	-- {* introduce a (syntactic) class for the constant @{text "<<"} *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    19
axclass sq_ord < type
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    20
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    21
	-- {* characteristic constant @{text "<<"} for po *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    22
consts
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    23
  "<<"          :: "['a,'a::sq_ord] => bool"        (infixl 55)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    24
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    25
syntax (xsymbols)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    26
  "op <<"       :: "['a,'a::sq_ord] => bool"        (infixl "\<sqsubseteq>" 55)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    27
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    28
axclass po < sq_ord
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    29
        -- {* class axioms: *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    30
refl_less [iff]: "x << x"        
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    31
antisym_less:    "[|x << y; y << x |] ==> x = y"    
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    32
trans_less:      "[|x << y; y << z |] ==> x << z"
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    33
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    34
text {* minimal fixes least element *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    35
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    36
lemma minimal2UU[OF allI] : "!x::'a::po. uu<<x ==> uu=(@u.!y. u<<y)"
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    37
apply (blast intro: someI2 antisym_less)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    38
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    39
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    40
text {* the reverse law of anti-symmetry of @{term "op <<"} *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    41
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    42
lemma antisym_less_inverse: "(x::'a::po)=y ==> x << y & y << x"
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    43
apply blast
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    44
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    45
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    46
lemma box_less: "[| (a::'a::po) << b; c << a; b << d|] ==> c << d"
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    47
apply (erule trans_less)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    48
apply (erule trans_less)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    49
apply assumption
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    50
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    51
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    52
lemma po_eq_conv: "((x::'a::po)=y) = (x << y & y << x)"
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    53
apply (fast elim!: antisym_less_inverse intro!: antisym_less)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    54
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    55
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    56
subsection {* Chains and least upper bounds *}
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    57
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    58
consts  
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    59
        "<|"    ::      "['a set,'a::po] => bool"       (infixl 55)
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    60
        "<<|"   ::      "['a set,'a::po] => bool"       (infixl 55)
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    61
        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
    62
        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
    63
        chain ::     "(nat=>'a::po) => bool"
1479
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    64
        max_in_chain :: "[nat,nat=>'a::po]=>bool"
21eb5e156d91 expanded tabs
clasohm
parents: 1274
diff changeset
    65
        finite_chain :: "(nat=>'a::po)=>bool"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    66
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    67
syntax
12338
de0f4a63baa5 renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents: 12114
diff changeset
    68
  "@LUB"	:: "('b => 'a) => 'a"	(binder "LUB " 10)
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    69
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    70
translations
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2640
diff changeset
    71
  "LUB x. t"	== "lub(range(%x. t))"
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    72
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12030
diff changeset
    73
syntax (xsymbols)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    74
  "LUB "	:: "[idts, 'a] => 'a"		("(3\<Squnion>_./ _)"[0,10] 10)
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
    75
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
    76
defs
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    77
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    78
-- {* class definitions *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    79
is_ub_def:       "S  <| x == ! y. y:S --> y<<x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    80
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
    81
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    82
-- {* Arbitrary chains are total orders *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    83
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
    84
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    85
-- {* 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
    86
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
    87
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    88
-- {* finite chains, needed for monotony of continouous functions *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    89
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
    90
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
    91
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    92
lub_def:          "lub S == (@x. S <<| x)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    93
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    94
text {* lubs are unique *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    95
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    96
lemma unique_lub: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    97
        "[| S <<| x ; S <<| y |] ==> x=y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    98
apply (unfold is_lub_def is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
    99
apply (blast intro: antisym_less)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   100
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   101
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   102
text {* chains are monotone functions *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   103
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   104
lemma chain_mono [rule_format]: "chain F ==> x<y --> F x<<F y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   105
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   106
apply (induct_tac "y")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   107
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   108
prefer 2 apply (blast intro: trans_less)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   109
apply (blast elim!: less_SucE)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   110
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   111
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   112
lemma chain_mono3: "[| chain F; x <= y |] ==> F x << F y"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   113
apply (drule le_imp_less_or_eq)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   114
apply (blast intro: chain_mono)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   115
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   116
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   117
text {* The range of a chain is a totally ordered *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   118
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   119
lemma chain_tord: "chain(F) ==> tord(range(F))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   120
apply (unfold tord_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   121
apply safe
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   122
apply (rule nat_less_cases)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   123
apply (fast intro: chain_mono)+
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   124
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   125
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   126
text {* technical lemmas about @{term lub} and @{term is_lub} *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   127
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   128
lemmas lub = lub_def [THEN meta_eq_to_obj_eq, standard]
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   129
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   130
lemma lubI[OF exI]: "EX x. M <<| x ==> M <<| lub(M)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   131
apply (simp add: lub some_eq_ex)
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 thelubI: "M <<| l ==> lub(M) = l"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   135
apply (rule unique_lub)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   136
apply (subst lub)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   137
apply (erule someI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   138
apply assumption
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   139
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   140
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   141
lemma lub_singleton [simp]: "lub{x} = x"
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   142
apply (simp (no_asm) add: thelubI is_lub_def is_ub_def)
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
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   145
text {* access to some definition as inference rule *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   146
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   147
lemma is_lubD1: "S <<| x ==> S <| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   148
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   149
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   150
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   151
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   152
lemma is_lub_lub: "[| S <<| x; S <| u |] ==> x << u"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   153
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   154
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   155
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   156
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   157
lemma is_lubI:
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   158
        "[| S <| x; !!u. S <| u ==> x << u |] ==> S <<| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   159
apply (unfold is_lub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   160
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   161
done
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   162
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   163
lemma chainE: "chain F ==> F(i) << F(Suc(i))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   164
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   165
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   166
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   167
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   168
lemma chainI: "(!!i. F i << F(Suc i)) ==> chain F"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   169
apply (unfold chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   170
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   171
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   172
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   173
lemma chain_shift: "chain Y ==> chain (%i. Y (i + j))"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   174
apply (rule chainI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   175
apply clarsimp
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   176
apply (erule chainE)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   177
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   178
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   179
text {* technical lemmas about (least) upper bounds of chains *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   180
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   181
lemma ub_rangeD: "range S <| x  ==> S(i) << x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   182
apply (unfold is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   183
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   184
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   185
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   186
lemma ub_rangeI: "(!!i. S i << x) ==> range S <| x"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   187
apply (unfold is_ub_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   188
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   189
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   190
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   191
lemmas is_ub_lub = is_lubD1 [THEN ub_rangeD, standard]
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
   192
  -- {* @{thm is_ub_lub} *} (* range(?S1) <<| ?x1 ==> ?S1(?x) << ?x1 *)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   193
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   194
text {* results about finite chains *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   195
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   196
lemma lub_finch1: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   197
        "[| chain C; max_in_chain i C|] ==> range C <<| C i"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   198
apply (unfold max_in_chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   199
apply (rule is_lubI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   200
apply (rule ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   201
apply (rule_tac m = "i" in nat_less_cases)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   202
apply (rule antisym_less_inverse [THEN conjunct2])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   203
apply (erule disjI1 [THEN less_or_eq_imp_le, THEN rev_mp])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   204
apply (erule spec)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   205
apply (rule antisym_less_inverse [THEN conjunct2])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   206
apply (erule disjI2 [THEN less_or_eq_imp_le, THEN rev_mp])
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   207
apply (erule spec)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   208
apply (erule chain_mono)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   209
apply assumption
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   210
apply (erule ub_rangeD)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   211
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   212
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   213
lemma lub_finch2: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   214
        "finite_chain(C) ==> range(C) <<| C(@ i. max_in_chain i C)"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   215
apply (unfold finite_chain_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   216
apply (rule lub_finch1)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   217
prefer 2 apply (best intro: someI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   218
apply blast
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   219
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   220
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   221
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
   222
apply (rule chainI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   223
apply (induct_tac "i")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   224
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   225
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   226
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   227
lemma bin_chainmax: 
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   228
        "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
   229
apply (unfold max_in_chain_def le_def)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   230
apply (rule allI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   231
apply (induct_tac "j")
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   232
apply auto
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   233
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   234
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   235
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
   236
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
   237
apply (erule_tac [2] bin_chain)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   238
apply (erule_tac [2] bin_chainmax)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   239
apply (simp (no_asm))
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   240
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   241
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   242
text {* the maximal element in a chain is its lub *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   243
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   244
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
   245
apply (blast dest: ub_rangeD intro: thelubI is_lubI ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   246
done
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   247
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
   248
text {* the lub of a constant chain is the constant *}
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   249
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   250
lemma lub_const: "range(%x. c) <<| c"
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   251
apply (blast dest: ub_rangeD intro: is_lubI ub_rangeI)
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   252
done
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents: 1168
diff changeset
   253
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   254
end 
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
   255
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 297
diff changeset
   256