src/HOL/HOLCF/Porder.thy
author wenzelm
Tue, 23 Apr 2024 15:57:03 +0200
changeset 80145 0eff7d113549
parent 69597 ff784d5a5bfb
permissions -rw-r--r--
update Windows build host;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42151
4da4fc77664b tuned headers;
wenzelm
parents: 41182
diff changeset
     1
(*  Title:      HOL/HOLCF/Porder.thy
25773
0d585d756745 new section for directed sets
huffman
parents: 25695
diff changeset
     2
    Author:     Franz Regensburger and Brian Huffman
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     3
*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     4
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
     5
section \<open>Partial orders\<close>
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
     6
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
     7
theory Porder
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
     8
  imports Main
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
     9
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    10
61260
e6f03fae14d5 explicit indication of overloaded typedefs;
wenzelm
parents: 60586
diff changeset
    11
declare [[typedef_overloaded]]
e6f03fae14d5 explicit indication of overloaded typedefs;
wenzelm
parents: 60586
diff changeset
    12
e6f03fae14d5 explicit indication of overloaded typedefs;
wenzelm
parents: 60586
diff changeset
    13
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
    14
subsection \<open>Type class for partial orders\<close>
15587
f363e6e080e7 added subsections and text for document generation
huffman
parents: 15577
diff changeset
    15
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    16
class below =
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    17
  fixes below :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    18
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    19
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
    20
notation (ASCII)
40436
adb22dbb5242 (infixl "<<" 55) -> (infix "<<" 50)
huffman
parents: 40433
diff changeset
    21
  below (infix "<<" 50)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    22
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
    23
notation
40436
adb22dbb5242 (infixl "<<" 55) -> (infix "<<" 50)
huffman
parents: 40433
diff changeset
    24
  below (infix "\<sqsubseteq>" 50)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    25
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
    26
abbreviation not_below :: "'a \<Rightarrow> 'a \<Rightarrow> bool"  (infix "\<notsqsubseteq>" 50)
41182
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    27
  where "not_below x y \<equiv> \<not> below x y"
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    28
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
    29
notation (ASCII)
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
    30
  not_below  (infix "~<<" 50)
41182
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    31
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
    32
lemma below_eq_trans: "a \<sqsubseteq> b \<Longrightarrow> b = c \<Longrightarrow> a \<sqsubseteq> c"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    33
  by (rule subst)
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    34
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
    35
lemma eq_below_trans: "a = b \<Longrightarrow> b \<sqsubseteq> c \<Longrightarrow> a \<sqsubseteq> c"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    36
  by (rule ssubst)
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    37
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    38
end
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    39
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    40
class po = below +
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    41
  assumes below_refl [iff]: "x \<sqsubseteq> x"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    42
  assumes below_trans: "x \<sqsubseteq> y \<Longrightarrow> y \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> z"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    43
  assumes below_antisym: "x \<sqsubseteq> y \<Longrightarrow> y \<sqsubseteq> x \<Longrightarrow> x = y"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    44
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    45
40432
61a1519d985f add lemma eq_imp_below
huffman
parents: 40430
diff changeset
    46
lemma eq_imp_below: "x = y \<Longrightarrow> x \<sqsubseteq> y"
61a1519d985f add lemma eq_imp_below
huffman
parents: 40430
diff changeset
    47
  by simp
61a1519d985f add lemma eq_imp_below
huffman
parents: 40430
diff changeset
    48
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    49
lemma box_below: "a \<sqsubseteq> b \<Longrightarrow> c \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> d \<Longrightarrow> c \<sqsubseteq> d"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    50
  by (rule below_trans [OF below_trans])
17810
3bdf516d93d8 cleaned up; renamed "Porder.op <<" to "Porder.<<"
huffman
parents: 17372
diff changeset
    51
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    52
lemma po_eq_conv: "x = y \<longleftrightarrow> x \<sqsubseteq> y \<and> y \<sqsubseteq> x"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    53
  by (fast intro!: below_antisym)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents: 15562
diff changeset
    54
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    55
lemma rev_below_trans: "y \<sqsubseteq> z \<Longrightarrow> x \<sqsubseteq> y \<Longrightarrow> x \<sqsubseteq> z"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    56
  by (rule below_trans)
18647
5f5d37e763c4 add transitivity rules
huffman
parents: 18088
diff changeset
    57
41182
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    58
lemma not_below2not_eq: "x \<notsqsubseteq> y \<Longrightarrow> x \<noteq> y"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    59
  by auto
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    60
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    61
end
18647
5f5d37e763c4 add transitivity rules
huffman
parents: 18088
diff changeset
    62
5f5d37e763c4 add transitivity rules
huffman
parents: 18088
diff changeset
    63
lemmas HOLCF_trans_rules [trans] =
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    64
  below_trans
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    65
  below_antisym
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    66
  below_eq_trans
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
    67
  eq_below_trans
18647
5f5d37e763c4 add transitivity rules
huffman
parents: 18088
diff changeset
    68
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    69
context po
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    70
begin
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    71
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
    72
subsection \<open>Upper bounds\<close>
18071
940c2c0ff33a cleaned up; chain_const and thelub_const are simp rules
huffman
parents: 17810
diff changeset
    73
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
    74
definition is_ub :: "'a set \<Rightarrow> 'a \<Rightarrow> bool" (infix "<|" 55)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
    75
  where "S <| x \<longleftrightarrow> (\<forall>y\<in>S. y \<sqsubseteq> x)"
18071
940c2c0ff33a cleaned up; chain_const and thelub_const are simp rules
huffman
parents: 17810
diff changeset
    76
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    77
lemma is_ubI: "(\<And>x. x \<in> S \<Longrightarrow> x \<sqsubseteq> u) \<Longrightarrow> S <| u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    78
  by (simp add: is_ub_def)
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    79
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    80
lemma is_ubD: "\<lbrakk>S <| u; x \<in> S\<rbrakk> \<Longrightarrow> x \<sqsubseteq> u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    81
  by (simp add: is_ub_def)
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    82
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    83
lemma ub_imageI: "(\<And>x. x \<in> S \<Longrightarrow> f x \<sqsubseteq> u) \<Longrightarrow> (\<lambda>x. f x) ` S <| u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    84
  unfolding is_ub_def by fast
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    85
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    86
lemma ub_imageD: "\<lbrakk>f ` S <| u; x \<in> S\<rbrakk> \<Longrightarrow> f x \<sqsubseteq> u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    87
  unfolding is_ub_def by fast
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    88
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    89
lemma ub_rangeI: "(\<And>i. S i \<sqsubseteq> x) \<Longrightarrow> range S <| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    90
  unfolding is_ub_def by fast
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    91
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    92
lemma ub_rangeD: "range S <| x \<Longrightarrow> S i \<sqsubseteq> x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    93
  unfolding is_ub_def by fast
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
    94
25828
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
    95
lemma is_ub_empty [simp]: "{} <| u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    96
  unfolding is_ub_def by fast
25828
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
    97
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
    98
lemma is_ub_insert [simp]: "(insert x A) <| y = (x \<sqsubseteq> y \<and> A <| y)"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
    99
  unfolding is_ub_def by fast
25828
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
   100
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
   101
lemma is_ub_upward: "\<lbrakk>S <| x; x \<sqsubseteq> y\<rbrakk> \<Longrightarrow> S <| y"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
   102
  unfolding is_ub_def by (fast intro: below_trans)
25828
228c53fdb3b4 add new is_ub lemmas; clean up directed_finite proofs
huffman
parents: 25813
diff changeset
   103
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   104
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   105
subsection \<open>Least upper bounds\<close>
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   106
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   107
definition is_lub :: "'a set \<Rightarrow> 'a \<Rightarrow> bool" (infix "<<|" 55)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   108
  where "S <<| x \<longleftrightarrow> S <| x \<and> (\<forall>u. S <| u \<longrightarrow> x \<sqsubseteq> u)"
18071
940c2c0ff33a cleaned up; chain_const and thelub_const are simp rules
huffman
parents: 17810
diff changeset
   109
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   110
definition lub :: "'a set \<Rightarrow> 'a"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   111
  where "lub S = (THE x. S <<| x)"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   112
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   113
end
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   114
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
   115
syntax (ASCII)
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   116
  "_BLub" :: "[pttrn, 'a set, 'b] \<Rightarrow> 'b" ("(3LUB _:_./ _)" [0,0, 10] 10)
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   117
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
   118
syntax
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   119
  "_BLub" :: "[pttrn, 'a set, 'b] \<Rightarrow> 'b" ("(3\<Squnion>_\<in>_./ _)" [0,0, 10] 10)
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   120
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   121
translations
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   122
  "LUB x:A. t" \<rightleftharpoons> "CONST lub ((\<lambda>x. t) ` A)"
25777
74ee4914bb37 new is_ub lemmas; new lub syntax for set image
huffman
parents: 25773
diff changeset
   123
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   124
context po
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   125
begin
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   126
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   127
abbreviation Lub  (binder "\<Squnion>" 10)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   128
  where "\<Squnion>n. t n \<equiv> lub (range t)"
2394
91d8abf108be adaptions for symbol font
oheimb
parents: 2291
diff changeset
   129
61998
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
   130
notation (ASCII)
b66d2ca1f907 clarified print modes;
wenzelm
parents: 61260
diff changeset
   131
  Lub  (binder "LUB " 10)
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   132
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   133
text \<open>access to some definition as inference rule\<close>
25813
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   134
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   135
lemma is_lubD1: "S <<| x \<Longrightarrow> S <| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   136
  unfolding is_lub_def by fast
25813
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   137
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   138
lemma is_lubD2: "\<lbrakk>S <<| x; S <| u\<rbrakk> \<Longrightarrow> x \<sqsubseteq> u"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   139
  unfolding is_lub_def by fast
25813
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   140
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   141
lemma is_lubI: "\<lbrakk>S <| x; \<And>u. S <| u \<Longrightarrow> x \<sqsubseteq> u\<rbrakk> \<Longrightarrow> S <<| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   142
  unfolding is_lub_def by fast
25813
641b4da8eb9d add lub_maximal lemmas;
huffman
parents: 25780
diff changeset
   143
39969
0b8e19f588a4 new lemmas about lub
huffman
parents: 39968
diff changeset
   144
lemma is_lub_below_iff: "S <<| x \<Longrightarrow> x \<sqsubseteq> u \<longleftrightarrow> S <| u"
0b8e19f588a4 new lemmas about lub
huffman
parents: 39968
diff changeset
   145
  unfolding is_lub_def is_ub_def by (metis below_trans)
0b8e19f588a4 new lemmas about lub
huffman
parents: 39968
diff changeset
   146
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   147
text \<open>lubs are unique\<close>
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   148
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   149
lemma is_lub_unique: "S <<| x \<Longrightarrow> S <<| y \<Longrightarrow> x = y"
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   150
  unfolding is_lub_def is_ub_def by (blast intro: below_antisym)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   151
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 68780
diff changeset
   152
text \<open>technical lemmas about \<^term>\<open>lub\<close> and \<^term>\<open>is_lub\<close>\<close>
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   153
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   154
lemma is_lub_lub: "M <<| x \<Longrightarrow> M <<| lub M"
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   155
  unfolding lub_def by (rule theI [OF _ is_lub_unique])
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   156
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   157
lemma lub_eqI: "M <<| l \<Longrightarrow> lub M = l"
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   158
  by (rule is_lub_unique [OF is_lub_lub])
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   159
68780
54fdc8bc73a3 new simp rule
haftmann
parents: 67312
diff changeset
   160
lemma is_lub_singleton [simp]: "{x} <<| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   161
  by (simp add: is_lub_def)
25780
0fd4c238273b added new lemmas
huffman
parents: 25777
diff changeset
   162
17810
3bdf516d93d8 cleaned up; renamed "Porder.op <<" to "Porder.<<"
huffman
parents: 17372
diff changeset
   163
lemma lub_singleton [simp]: "lub {x} = x"
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   164
  by (rule is_lub_singleton [THEN lub_eqI])
25780
0fd4c238273b added new lemmas
huffman
parents: 25777
diff changeset
   165
0fd4c238273b added new lemmas
huffman
parents: 25777
diff changeset
   166
lemma is_lub_bin: "x \<sqsubseteq> y \<Longrightarrow> {x, y} <<| y"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   167
  by (simp add: is_lub_def)
25780
0fd4c238273b added new lemmas
huffman
parents: 25777
diff changeset
   168
0fd4c238273b added new lemmas
huffman
parents: 25777
diff changeset
   169
lemma lub_bin: "x \<sqsubseteq> y \<Longrightarrow> lub {x, y} = y"
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   170
  by (rule is_lub_bin [THEN lub_eqI])
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   171
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   172
lemma is_lub_maximal: "S <| x \<Longrightarrow> x \<in> S \<Longrightarrow> S <<| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   173
  by (erule is_lubI, erule (1) is_ubD)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   174
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   175
lemma lub_maximal: "S <| x \<Longrightarrow> x \<in> S \<Longrightarrow> lub S = x"
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   176
  by (rule is_lub_maximal [THEN lub_eqI])
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   177
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   178
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   179
subsection \<open>Countable chains\<close>
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   180
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   181
definition chain :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   182
  where \<comment> \<open>Here we use countable chains and I prefer to code them as functions!\<close>
25922
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25897
diff changeset
   183
  "chain Y = (\<forall>i. Y i \<sqsubseteq> Y (Suc i))"
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25897
diff changeset
   184
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25897
diff changeset
   185
lemma chainI: "(\<And>i. Y i \<sqsubseteq> Y (Suc i)) \<Longrightarrow> chain Y"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   186
  unfolding chain_def by fast
25922
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25897
diff changeset
   187
cb04d05e95fb rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents: 25897
diff changeset
   188
lemma chainE: "chain Y \<Longrightarrow> Y i \<sqsubseteq> Y (Suc i)"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   189
  unfolding chain_def by fast
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   190
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   191
text \<open>chains are monotone functions\<close>
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   192
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   193
lemma chain_mono_less: "chain Y \<Longrightarrow> i < j \<Longrightarrow> Y i \<sqsubseteq> Y j"
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
   194
  by (erule less_Suc_induct, erule chainE, erule below_trans)
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   195
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   196
lemma chain_mono: "chain Y \<Longrightarrow> i \<le> j \<Longrightarrow> Y i \<sqsubseteq> Y j"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   197
  by (cases "i = j") (simp_all add: chain_mono_less)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   198
17810
3bdf516d93d8 cleaned up; renamed "Porder.op <<" to "Porder.<<"
huffman
parents: 17372
diff changeset
   199
lemma chain_shift: "chain Y \<Longrightarrow> chain (\<lambda>i. Y (i + j))"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   200
  by (rule chainI, simp, erule chainE)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   201
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   202
text \<open>technical lemmas about (least) upper bounds of chains\<close>
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   203
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   204
lemma is_lub_rangeD1: "range S <<| x \<Longrightarrow> S i \<sqsubseteq> x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   205
  by (rule is_lubD1 [THEN ub_rangeD])
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   206
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   207
lemma is_ub_range_shift: "chain S \<Longrightarrow> range (\<lambda>i. S (i + j)) <| x = range S <| x"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   208
  apply (rule iffI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   209
   apply (rule ub_rangeI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   210
   apply (rule_tac y="S (i + j)" in below_trans)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   211
    apply (erule chain_mono)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   212
    apply (rule le_add1)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   213
   apply (erule ub_rangeD)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   214
  apply (rule ub_rangeI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   215
  apply (erule ub_rangeD)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   216
  done
16318
45b12a01382f added theorems is_ub_range_shift and is_lub_range_shift
huffman
parents: 16092
diff changeset
   217
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   218
lemma is_lub_range_shift: "chain S \<Longrightarrow> range (\<lambda>i. S (i + j)) <<| x = range S <<| x"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   219
  by (simp add: is_lub_def is_ub_range_shift)
16318
45b12a01382f added theorems is_ub_range_shift and is_lub_range_shift
huffman
parents: 16092
diff changeset
   220
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   221
text \<open>the lub of a constant chain is the constant\<close>
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   222
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   223
lemma chain_const [simp]: "chain (\<lambda>i. c)"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   224
  by (simp add: chainI)
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   225
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   226
lemma is_lub_const: "range (\<lambda>x. c) <<| c"
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   227
by (blast dest: ub_rangeD intro: is_lubI ub_rangeI)
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   228
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   229
lemma lub_const [simp]: "(\<Squnion>i. c) = c"
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   230
  by (rule is_lub_const [THEN lub_eqI])
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   231
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   232
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   233
subsection \<open>Finite chains\<close>
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   234
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   235
definition max_in_chain :: "nat \<Rightarrow> (nat \<Rightarrow> 'a) \<Rightarrow> bool"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   236
  where \<comment> \<open>finite chains, needed for monotony of continuous functions\<close>
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   237
  "max_in_chain i C \<longleftrightarrow> (\<forall>j. i \<le> j \<longrightarrow> C i = C j)"
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   238
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   239
definition finite_chain :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   240
  where "finite_chain C = (chain C \<and> (\<exists>i. max_in_chain i C))"
25695
7025a263aa49 rearrange into subsections
huffman
parents: 25131
diff changeset
   241
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   242
text \<open>results about finite chains\<close>
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   243
25878
bfd53f791c10 new lemmas max_in_chainI, max_in_chainD
huffman
parents: 25834
diff changeset
   244
lemma max_in_chainI: "(\<And>j. i \<le> j \<Longrightarrow> Y i = Y j) \<Longrightarrow> max_in_chain i Y"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   245
  unfolding max_in_chain_def by fast
25878
bfd53f791c10 new lemmas max_in_chainI, max_in_chainD
huffman
parents: 25834
diff changeset
   246
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   247
lemma max_in_chainD: "max_in_chain i Y \<Longrightarrow> i \<le> j \<Longrightarrow> Y i = Y j"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   248
  unfolding max_in_chain_def by fast
25878
bfd53f791c10 new lemmas max_in_chainI, max_in_chainD
huffman
parents: 25834
diff changeset
   249
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   250
lemma finite_chainI: "chain C \<Longrightarrow> max_in_chain i C \<Longrightarrow> finite_chain C"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   251
  unfolding finite_chain_def by fast
27317
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   252
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   253
lemma finite_chainE: "\<lbrakk>finite_chain C; \<And>i. \<lbrakk>chain C; max_in_chain i C\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R"
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   254
  unfolding finite_chain_def by fast
27317
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   255
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   256
lemma lub_finch1: "chain C \<Longrightarrow> max_in_chain i C \<Longrightarrow> range C <<| C i"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   257
  apply (rule is_lubI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   258
   apply (rule ub_rangeI, rename_tac j)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   259
   apply (rule_tac x=i and y=j in linorder_le_cases)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   260
    apply (drule (1) max_in_chainD, simp)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   261
   apply (erule (1) chain_mono)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   262
  apply (erule ub_rangeD)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   263
  done
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   264
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   265
lemma lub_finch2: "finite_chain C \<Longrightarrow> range C <<| C (LEAST i. max_in_chain i C)"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   266
  apply (erule finite_chainE)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   267
  apply (erule LeastI2 [where Q="\<lambda>i. range C <<| C i"])
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   268
  apply (erule (1) lub_finch1)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   269
  done
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   270
19621
475140eb82f2 add new finite chain theorems
huffman
parents: 19105
diff changeset
   271
lemma finch_imp_finite_range: "finite_chain Y \<Longrightarrow> finite (range Y)"
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   272
  apply (erule finite_chainE)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   273
  apply (rule_tac B="Y ` {..i}" in finite_subset)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   274
   apply (rule subsetI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   275
   apply (erule rangeE, rename_tac j)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   276
   apply (rule_tac x=i and y=j in linorder_le_cases)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   277
    apply (subgoal_tac "Y j = Y i", simp)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   278
    apply (simp add: max_in_chain_def)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   279
   apply simp
19621
475140eb82f2 add new finite chain theorems
huffman
parents: 19105
diff changeset
   280
  apply simp
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   281
  done
19621
475140eb82f2 add new finite chain theorems
huffman
parents: 19105
diff changeset
   282
27317
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   283
lemma finite_range_has_max:
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   284
  fixes f :: "nat \<Rightarrow> 'a"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   285
    and r :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
27317
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   286
  assumes mono: "\<And>i j. i \<le> j \<Longrightarrow> r (f i) (f j)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   287
  assumes finite_range: "finite (range f)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   288
  shows "\<exists>k. \<forall>i. r (f i) (f k)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   289
proof (intro exI allI)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   290
  fix i :: nat
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   291
  let ?j = "LEAST k. f k = f i"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   292
  let ?k = "Max ((\<lambda>x. LEAST k. f k = x) ` range f)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   293
  have "?j \<le> ?k"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   294
  proof (rule Max_ge)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   295
    show "finite ((\<lambda>x. LEAST k. f k = x) ` range f)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   296
      using finite_range by (rule finite_imageI)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   297
    show "?j \<in> (\<lambda>x. LEAST k. f k = x) ` range f"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   298
      by (intro imageI rangeI)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   299
  qed
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   300
  hence "r (f ?j) (f ?k)"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   301
    by (rule mono)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   302
  also have "f ?j = f i"
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   303
    by (rule LeastI, rule refl)
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   304
  finally show "r (f i) (f ?k)" .
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   305
qed
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   306
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   307
lemma finite_range_imp_finch: "chain Y \<Longrightarrow> finite (range Y) \<Longrightarrow> finite_chain Y"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   308
  apply (subgoal_tac "\<exists>k. \<forall>i. Y i \<sqsubseteq> Y k")
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   309
   apply (erule exE)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   310
   apply (rule finite_chainI, assumption)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   311
   apply (rule max_in_chainI)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   312
   apply (rule below_antisym)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   313
    apply (erule (1) chain_mono)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   314
   apply (erule spec)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   315
  apply (rule finite_range_has_max)
27317
7f4ee574f29c cleaned up some proofs;
huffman
parents: 27292
diff changeset
   316
   apply (erule (1) chain_mono)
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   317
  apply assumption
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   318
  done
19621
475140eb82f2 add new finite chain theorems
huffman
parents: 19105
diff changeset
   319
17810
3bdf516d93d8 cleaned up; renamed "Porder.op <<" to "Porder.<<"
huffman
parents: 17372
diff changeset
   320
lemma bin_chain: "x \<sqsubseteq> y \<Longrightarrow> chain (\<lambda>i. if i=0 then x else y)"
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   321
  by (rule chainI) simp
17810
3bdf516d93d8 cleaned up; renamed "Porder.op <<" to "Porder.<<"
huffman
parents: 17372
diff changeset
   322
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   323
lemma bin_chainmax: "x \<sqsubseteq> y \<Longrightarrow> max_in_chain (Suc 0) (\<lambda>i. if i=0 then x else y)"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   324
  by (simp add: max_in_chain_def)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   325
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   326
lemma is_lub_bin_chain: "x \<sqsubseteq> y \<Longrightarrow> range (\<lambda>i::nat. if i=0 then x else y) <<| y"
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   327
  apply (frule bin_chain)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   328
  apply (drule bin_chainmax)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   329
  apply (drule (1) lub_finch1)
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   330
  apply simp
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   331
  done
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   332
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 61998
diff changeset
   333
text \<open>the maximal element in a chain is its lub\<close>
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   334
67312
0d25e02759b7 misc tuning and modernization;
wenzelm
parents: 62175
diff changeset
   335
lemma lub_chain_maxelem: "Y i = c \<Longrightarrow> \<forall>i. Y i \<sqsubseteq> c \<Longrightarrow> lub (range Y) = c"
40771
1c6f7d4b110e renamed several HOLCF theorems (listed in NEWS)
huffman
parents: 40436
diff changeset
   336
  by (blast dest: ub_rangeD intro: lub_eqI is_lubI ub_rangeI)
15562
8455c9671494 converted to new-style theory
huffman
parents: 14981
diff changeset
   337
18071
940c2c0ff33a cleaned up; chain_const and thelub_const are simp rules
huffman
parents: 17810
diff changeset
   338
end
31071
845a6acd3bf3 localized (complete) partial order classes
haftmann
parents: 29608
diff changeset
   339
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 31071
diff changeset
   340
end