src/HOL/Library/Glbs.thy
author wenzelm
Tue, 03 Sep 2013 01:12:40 +0200
changeset 53374 a14d2a854c02
parent 51342 763c6872bd10
permissions -rw-r--r--
tuned proofs -- clarified flow of facts wrt. calculation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30661
54858c8ad226 tuned header
haftmann
parents: 30267
diff changeset
     1
(* Author: Amine Chaieb, University of Cambridge *)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     2
30661
54858c8ad226 tuned header
haftmann
parents: 30267
diff changeset
     3
header {* Definitions of Lower Bounds and Greatest Lower Bounds, analogous to Lubs *}
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     4
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     5
theory Glbs
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     6
imports Lubs
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     7
begin
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
     8
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
     9
definition greatestP :: "('a \<Rightarrow> bool) \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    10
  where "greatestP P x = (P x \<and> Collect P *<=  x)"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    11
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    12
definition isLb :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    13
  where "isLb R S x = (x <=* S \<and> x: R)"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    14
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    15
definition isGlb :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a::ord \<Rightarrow> bool"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    16
  where "isGlb R S x = greatestP (isLb R S) x"
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    17
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    18
definition lbs :: "'a set \<Rightarrow> 'a::ord set \<Rightarrow> 'a set"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    19
  where "lbs R S = Collect (isLb R S)"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    20
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    21
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    22
subsection {* Rules about the Operators @{term greatestP}, @{term isLb}
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    23
  and @{term isGlb} *}
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    24
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    25
lemma leastPD1: "greatestP P x \<Longrightarrow> P x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    26
  by (simp add: greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    27
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    28
lemma greatestPD2: "greatestP P x \<Longrightarrow> Collect P *<= x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    29
  by (simp add: greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    30
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    31
lemma greatestPD3: "greatestP P x \<Longrightarrow> y: Collect P \<Longrightarrow> x \<ge> y"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    32
  by (blast dest!: greatestPD2 setleD)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    33
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    34
lemma isGlbD1: "isGlb R S x \<Longrightarrow> x <=* S"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    35
  by (simp add: isGlb_def isLb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    36
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    37
lemma isGlbD1a: "isGlb R S x \<Longrightarrow> x: R"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    38
  by (simp add: isGlb_def isLb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    39
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    40
lemma isGlb_isLb: "isGlb R S x \<Longrightarrow> isLb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    41
  unfolding isLb_def by (blast dest: isGlbD1 isGlbD1a)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    42
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    43
lemma isGlbD2: "isGlb R S x \<Longrightarrow> y : S \<Longrightarrow> y \<ge> x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    44
  by (blast dest!: isGlbD1 setgeD)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    45
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    46
lemma isGlbD3: "isGlb R S x \<Longrightarrow> greatestP (isLb R S) x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    47
  by (simp add: isGlb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    48
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    49
lemma isGlbI1: "greatestP (isLb R S) x \<Longrightarrow> isGlb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    50
  by (simp add: isGlb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    51
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    52
lemma isGlbI2: "isLb R S x \<Longrightarrow> Collect (isLb R S) *<= x \<Longrightarrow> isGlb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    53
  by (simp add: isGlb_def greatestP_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    54
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    55
lemma isLbD: "isLb R S x \<Longrightarrow> y : S \<Longrightarrow> y \<ge> x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    56
  by (simp add: isLb_def setge_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    57
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    58
lemma isLbD2: "isLb R S x \<Longrightarrow> x <=* S "
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    59
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    60
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    61
lemma isLbD2a: "isLb R S x \<Longrightarrow> x: R"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    62
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    63
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    64
lemma isLbI: "x <=* S \<Longrightarrow> x: R \<Longrightarrow> isLb R S x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    65
  by (simp add: isLb_def)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    66
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    67
lemma isGlb_le_isLb: "isGlb R S x \<Longrightarrow> isLb R S y \<Longrightarrow> x \<ge> y"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    68
  unfolding isGlb_def by (blast intro!: greatestPD3)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    69
46509
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    70
lemma isGlb_ubs: "isGlb R S x \<Longrightarrow> lbs R S *<= x"
c4b2ec379fdd more symbols;
wenzelm
parents: 30661
diff changeset
    71
  unfolding lbs_def isGlb_def by (rule greatestPD2)
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    72
51342
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    73
lemma isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::'a::linorder)"
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    74
  apply (frule isGlb_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    75
  apply (frule_tac x = y in isGlb_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    76
  apply (blast intro!: order_antisym dest!: isGlb_le_isLb)
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    77
  done
763c6872bd10 generalized isGlb_unique
hoelzl
parents: 46509
diff changeset
    78
29838
a562ca0c408d A theory of greatest lower bounds
chaieb
parents:
diff changeset
    79
end