localized monotonicity; tuned syntax
authorhaftmann
Fri Oct 26 21:22:17 2007 +0200 (2007-10-26)
changeset 252069c84ec7217a9
parent 25205 b408ceba4627
child 25207 d58c14280367
localized monotonicity; tuned syntax
src/HOL/Lattices.thy
     1.1 --- a/src/HOL/Lattices.thy	Fri Oct 26 21:22:16 2007 +0200
     1.2 +++ b/src/HOL/Lattices.thy	Fri Oct 26 21:22:17 2007 +0200
     1.3 @@ -11,6 +11,11 @@
     1.4  
     1.5  subsection{* Lattices *}
     1.6  
     1.7 +notation
     1.8 +  less_eq (infix "\<sqsubseteq>" 50)
     1.9 +and
    1.10 +  less    (infix "\<sqsubset>" 50)
    1.11 +
    1.12  class lower_semilattice = order +
    1.13    fixes inf :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 70)
    1.14    assumes inf_le1 [simp]: "x \<sqinter> y \<sqsubseteq> x"
    1.15 @@ -61,11 +66,12 @@
    1.16  lemma le_iff_inf: "(x \<sqsubseteq> y) = (x \<sqinter> y = x)"
    1.17    by (blast intro: antisym dest: eq_iff [THEN iffD1])
    1.18  
    1.19 -end
    1.20 +lemma mono_inf:
    1.21 +  fixes f :: "'a \<Rightarrow> 'b\<Colon>lower_semilattice"
    1.22 +  shows "mono f \<Longrightarrow> f (A \<sqinter> B) \<le> f A \<sqinter> f B"
    1.23 +  by (auto simp add: mono_def intro: Lattices.inf_greatest)
    1.24  
    1.25 -lemma mono_inf: "mono f \<Longrightarrow> f (inf A B) \<le> inf (f A) (f B)"
    1.26 -  by (auto simp add: mono_def)
    1.27 -
    1.28 +end
    1.29  
    1.30  context upper_semilattice
    1.31  begin
    1.32 @@ -93,15 +99,16 @@
    1.33  lemma le_iff_sup: "(x \<sqsubseteq> y) = (x \<squnion> y = y)"
    1.34    by (blast intro: antisym dest: eq_iff [THEN iffD1])
    1.35  
    1.36 -end
    1.37 +lemma mono_sup:
    1.38 +  fixes f :: "'a \<Rightarrow> 'b\<Colon>upper_semilattice"
    1.39 +  shows "mono f \<Longrightarrow> f A \<squnion> f B \<le> f (A \<squnion> B)"
    1.40 +  by (auto simp add: mono_def intro: Lattices.sup_least)
    1.41  
    1.42 -lemma mono_sup: "mono f \<Longrightarrow> sup (f A) (f B) \<le> f (sup A B)"
    1.43 -  by (auto simp add: mono_def)
    1.44 +end
    1.45  
    1.46  
    1.47  subsubsection{* Equational laws *}
    1.48  
    1.49 -
    1.50  context lower_semilattice
    1.51  begin
    1.52  
    1.53 @@ -393,12 +400,12 @@
    1.54  definition
    1.55    top :: 'a
    1.56  where
    1.57 -  "top = Inf {}"
    1.58 +  "top = \<Sqinter>{}"
    1.59  
    1.60  definition
    1.61    bot :: 'a
    1.62  where
    1.63 -  "bot = Sup {}"
    1.64 +  "bot = \<Squnion>{}"
    1.65  
    1.66  lemma top_greatest [simp]: "x \<le> top"
    1.67    by (unfold top_def, rule Inf_greatest, simp)
    1.68 @@ -409,12 +416,12 @@
    1.69  definition
    1.70    SUPR :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a"
    1.71  where
    1.72 -  "SUPR A f == Sup (f ` A)"
    1.73 +  "SUPR A f == \<Squnion> (f ` A)"
    1.74  
    1.75  definition
    1.76    INFI :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a"
    1.77  where
    1.78 -  "INFI A f == Inf (f ` A)"
    1.79 +  "INFI A f == \<Sqinter> (f ` A)"
    1.80  
    1.81  end
    1.82  
    1.83 @@ -473,17 +480,17 @@
    1.84  subsection {* Bool as lattice *}
    1.85  
    1.86  instance bool :: distrib_lattice
    1.87 -  inf_bool_eq: "inf P Q \<equiv> P \<and> Q"
    1.88 -  sup_bool_eq: "sup P Q \<equiv> P \<or> Q"
    1.89 +  inf_bool_eq: "P \<sqinter> Q \<equiv> P \<and> Q"
    1.90 +  sup_bool_eq: "P \<squnion> Q \<equiv> P \<or> Q"
    1.91    by intro_classes (auto simp add: inf_bool_eq sup_bool_eq le_bool_def)
    1.92  
    1.93  instance bool :: complete_lattice
    1.94 -  Inf_bool_def: "Inf A \<equiv> \<forall>x\<in>A. x"
    1.95 -  Sup_bool_def: "Sup A \<equiv> \<exists>x\<in>A. x"
    1.96 +  Inf_bool_def: "\<Sqinter>A \<equiv> \<forall>x\<in>A. x"
    1.97 +  Sup_bool_def: "\<Squnion>A \<equiv> \<exists>x\<in>A. x"
    1.98    by intro_classes (auto simp add: Inf_bool_def Sup_bool_def le_bool_def)
    1.99  
   1.100  lemma Inf_empty_bool [simp]:
   1.101 -  "Inf {}"
   1.102 +  "\<Sqinter>{}"
   1.103    unfolding Inf_bool_def by auto
   1.104  
   1.105  lemma not_Sup_empty_bool [simp]:
   1.106 @@ -500,8 +507,8 @@
   1.107  subsection {* Set as lattice *}
   1.108  
   1.109  instance set :: (type) distrib_lattice
   1.110 -  inf_set_eq: "inf A B \<equiv> A \<inter> B"
   1.111 -  sup_set_eq: "sup A B \<equiv> A \<union> B"
   1.112 +  inf_set_eq: "A \<sqinter> B \<equiv> A \<inter> B"
   1.113 +  sup_set_eq: "A \<squnion> B \<equiv> A \<union> B"
   1.114    by intro_classes (auto simp add: inf_set_eq sup_set_eq)
   1.115  
   1.116  lemmas [code func del] = inf_set_eq sup_set_eq
   1.117 @@ -517,8 +524,8 @@
   1.118    done
   1.119  
   1.120  instance set :: (type) complete_lattice
   1.121 -  Inf_set_def: "Inf S \<equiv> \<Inter>S"
   1.122 -  Sup_set_def: "Sup S \<equiv> \<Union>S"
   1.123 +  Inf_set_def: "\<Sqinter>S \<equiv> \<Inter>S"
   1.124 +  Sup_set_def: "\<Squnion>S \<equiv> \<Union>S"
   1.125    by intro_classes (auto simp add: Inf_set_def Sup_set_def)
   1.126  
   1.127  lemmas [code func del] = Inf_set_def Sup_set_def
   1.128 @@ -533,8 +540,8 @@
   1.129  subsection {* Fun as lattice *}
   1.130  
   1.131  instance "fun" :: (type, lattice) lattice
   1.132 -  inf_fun_eq: "inf f g \<equiv> (\<lambda>x. inf (f x) (g x))"
   1.133 -  sup_fun_eq: "sup f g \<equiv> (\<lambda>x. sup (f x) (g x))"
   1.134 +  inf_fun_eq: "f \<sqinter> g \<equiv> (\<lambda>x. f x \<sqinter> g x)"
   1.135 +  sup_fun_eq: "f \<squnion> g \<equiv> (\<lambda>x. f x \<squnion> g x)"
   1.136  apply intro_classes
   1.137  unfolding inf_fun_eq sup_fun_eq
   1.138  apply (auto intro: le_funI)
   1.139 @@ -550,8 +557,8 @@
   1.140    by default (auto simp add: inf_fun_eq sup_fun_eq sup_inf_distrib1)
   1.141  
   1.142  instance "fun" :: (type, complete_lattice) complete_lattice
   1.143 -  Inf_fun_def: "Inf A \<equiv> (\<lambda>x. Inf {y. \<exists>f\<in>A. y = f x})"
   1.144 -  Sup_fun_def: "Sup A \<equiv> (\<lambda>x. Sup {y. \<exists>f\<in>A. y = f x})"
   1.145 +  Inf_fun_def: "\<Sqinter>A \<equiv> (\<lambda>x. \<Sqinter>{y. \<exists>f\<in>A. y = f x})"
   1.146 +  Sup_fun_def: "\<Squnion>A \<equiv> (\<lambda>x. \<Squnion>{y. \<exists>f\<in>A. y = f x})"
   1.147    by intro_classes
   1.148      (auto simp add: Inf_fun_def Sup_fun_def le_fun_def
   1.149        intro: Inf_lower Sup_upper Inf_greatest Sup_least)
   1.150 @@ -559,11 +566,11 @@
   1.151  lemmas [code func del] = Inf_fun_def Sup_fun_def
   1.152  
   1.153  lemma Inf_empty_fun:
   1.154 -  "Inf {} = (\<lambda>_. Inf {})"
   1.155 +  "\<Sqinter>{} = (\<lambda>_. \<Sqinter>{})"
   1.156    by rule (auto simp add: Inf_fun_def)
   1.157  
   1.158  lemma Sup_empty_fun:
   1.159 -  "Sup {} = (\<lambda>_. Sup {})"
   1.160 +  "\<Squnion>{} = (\<lambda>_. \<Squnion>{})"
   1.161    by rule (auto simp add: Sup_fun_def)
   1.162  
   1.163  lemma top_fun_eq: "top = (\<lambda>x. top)"
   1.164 @@ -579,15 +586,16 @@
   1.165  lemmas sup_aci = sup_ACI
   1.166  
   1.167  no_notation
   1.168 -  inf (infixl "\<sqinter>" 70)
   1.169 -
   1.170 -no_notation
   1.171 -  sup (infixl "\<squnion>" 65)
   1.172 -
   1.173 -no_notation
   1.174 -  Inf ("\<Sqinter>_" [900] 900)
   1.175 -
   1.176 -no_notation
   1.177 -  Sup ("\<Squnion>_" [900] 900)
   1.178 +  less_eq (infix "\<sqsubseteq>" 50)
   1.179 +and
   1.180 +  less    (infix "\<sqsubset>" 50)
   1.181 +and
   1.182 +  inf     (infixl "\<sqinter>" 70)
   1.183 +and
   1.184 +  sup     (infixl "\<squnion>" 65)
   1.185 +and
   1.186 +  Inf     ("\<Sqinter>_" [900] 900)
   1.187 +and
   1.188 +  Sup     ("\<Squnion>_" [900] 900)
   1.189  
   1.190  end