author haftmann Sun, 19 Feb 2012 15:30:35 +0100 changeset 46553 50a7e97fe653 parent 46552 5d33a3269029 child 46554 87d4e4958476
distributed lattice properties of predicates to places of instantiation
 src/HOL/Complete_Lattices.thy file | annotate | diff | comparison | revisions src/HOL/Lattices.thy file | annotate | diff | comparison | revisions src/HOL/Orderings.thy file | annotate | diff | comparison | revisions src/HOL/Predicate.thy file | annotate | diff | comparison | revisions
```--- a/src/HOL/Complete_Lattices.thy	Mon Feb 20 15:17:03 2012 +0100
+++ b/src/HOL/Complete_Lattices.thy	Sun Feb 19 15:30:35 2012 +0100
@@ -536,7 +536,7 @@
end

-subsection {* @{typ bool} and @{typ "_ \<Rightarrow> _"} as complete lattice *}
+subsection {* @{typ bool} as complete lattice *}

instantiation bool :: complete_lattice
begin
@@ -573,6 +573,9 @@
instance bool :: complete_boolean_algebra proof
qed (auto intro: bool_induct)

+
+subsection {* @{typ "_ \<Rightarrow> _"} as complete lattice *}
+
instantiation "fun" :: (type, complete_lattice) complete_lattice
begin

@@ -608,6 +611,54 @@

instance "fun" :: (type, complete_boolean_algebra) complete_boolean_algebra ..

+
+subsection {* Unary and binary predicates as complete lattice *}
+
+lemma INF1_iff: "(\<Sqinter>x\<in>A. B x) b = (\<forall>x\<in>A. B x b)"
+
+lemma INF2_iff: "(\<Sqinter>x\<in>A. B x) b c = (\<forall>x\<in>A. B x b c)"
+
+lemma INF1_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> B x b) \<Longrightarrow> (\<Sqinter>x\<in>A. B x) b"
+  by (auto simp add: INF_apply)
+
+lemma INF2_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> B x b c) \<Longrightarrow> (\<Sqinter>x\<in>A. B x) b c"
+  by (auto simp add: INF_apply)
+
+lemma INF1_D [elim]: "(\<Sqinter>x\<in>A. B x) b \<Longrightarrow> a \<in> A \<Longrightarrow> B a b"
+  by (auto simp add: INF_apply)
+
+lemma INF2_D [elim]: "(\<Sqinter>x\<in>A. B x) b c \<Longrightarrow> a \<in> A \<Longrightarrow> B a b c"
+  by (auto simp add: INF_apply)
+
+lemma INF1_E [elim]: "(\<Sqinter>x\<in>A. B x) b \<Longrightarrow> (B a b \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
+  by (auto simp add: INF_apply)
+
+lemma INF2_E [elim]: "(\<Sqinter>x\<in>A. B x) b c \<Longrightarrow> (B a b c \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
+  by (auto simp add: INF_apply)
+
+lemma SUP1_iff: "(\<Squnion>x\<in>A. B x) b = (\<exists>x\<in>A. B x b)"
+
+lemma SUP2_iff: "(\<Squnion>x\<in>A. B x) b c = (\<exists>x\<in>A. B x b c)"
+
+lemma SUP1_I [intro]: "a \<in> A \<Longrightarrow> B a b \<Longrightarrow> (\<Squnion>x\<in>A. B x) b"
+  by (auto simp add: SUP_apply)
+
+lemma SUP2_I [intro]: "a \<in> A \<Longrightarrow> B a b c \<Longrightarrow> (\<Squnion>x\<in>A. B x) b c"
+  by (auto simp add: SUP_apply)
+
+lemma SUP1_E [elim!]: "(\<Squnion>x\<in>A. B x) b \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> B x b \<Longrightarrow> R) \<Longrightarrow> R"
+  by (auto simp add: SUP_apply)
+
+lemma SUP2_E [elim!]: "(\<Squnion>x\<in>A. B x) b c \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> B x b c \<Longrightarrow> R) \<Longrightarrow> R"
+  by (auto simp add: SUP_apply)
+
+
+subsection {* @{typ "_ set"} as complete lattice *}
+
instantiation "set" :: (type) complete_lattice
begin

@@ -627,7 +678,7 @@
qed (auto simp add: INF_def SUP_def Inf_set_def Sup_set_def image_def)

-subsection {* Inter *}
+subsubsection {* Inter *}

abbreviation Inter :: "'a set set \<Rightarrow> 'a set" where
"Inter S \<equiv> \<Sqinter>S"
@@ -699,7 +750,7 @@
by (fact Inf_superset_mono)

-subsection {* Intersections of families *}
+subsubsection {* Intersections of families *}

abbreviation INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
"INTER \<equiv> INFI"
@@ -810,7 +861,7 @@
by blast

-subsection {* Union *}
+subsubsection {* Union *}

abbreviation Union :: "'a set set \<Rightarrow> 'a set" where
"Union S \<equiv> \<Squnion>S"
@@ -879,7 +930,7 @@
by (fact Sup_subset_mono)

-subsection {* Unions of families *}
+subsubsection {* Unions of families *}

abbreviation UNION :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
"UNION \<equiv> SUPR"
@@ -1042,7 +1093,7 @@
by blast

-subsection {* Distributive laws *}
+subsubsection {* Distributive laws *}

lemma Int_Union: "A \<inter> \<Union>B = (\<Union>C\<in>B. A \<inter> C)"
by (fact inf_Sup)
@@ -1084,7 +1135,7 @@
by (fact Sup_inf_eq_bot_iff)

-subsection {* Complement *}
+subsubsection {* Complement *}

lemma Compl_INT [simp]: "- (\<Inter>x\<in>A. B x) = (\<Union>x\<in>A. -B x)"
by (fact uminus_INF)
@@ -1093,7 +1144,7 @@
by (fact uminus_SUP)

-subsection {* Miniscoping and maxiscoping *}
+subsubsection {* Miniscoping and maxiscoping *}

text {* \medskip Miniscoping: pushing in quantifiers and big Unions
and Intersections. *}```
```--- a/src/HOL/Lattices.thy	Mon Feb 20 15:17:03 2012 +0100
+++ b/src/HOL/Lattices.thy	Sun Feb 19 15:30:35 2012 +0100
@@ -701,6 +701,63 @@
instance "fun" :: (type, boolean_algebra) boolean_algebra proof
qed (rule ext, simp_all add: inf_apply sup_apply bot_apply top_apply uminus_apply minus_apply inf_compl_bot sup_compl_top diff_eq)+

+
+subsection {* Unary and binary predicates as lattice *}
+
+lemma inf1I [intro!]: "A x \<Longrightarrow> B x \<Longrightarrow> (A \<sqinter> B) x"
+
+lemma inf2I [intro!]: "A x y \<Longrightarrow> B x y \<Longrightarrow> (A \<sqinter> B) x y"
+
+lemma inf1E [elim!]: "(A \<sqinter> B) x \<Longrightarrow> (A x \<Longrightarrow> B x \<Longrightarrow> P) \<Longrightarrow> P"
+
+lemma inf2E [elim!]: "(A \<sqinter> B) x y \<Longrightarrow> (A x y \<Longrightarrow> B x y \<Longrightarrow> P) \<Longrightarrow> P"
+
+lemma inf1D1: "(A \<sqinter> B) x \<Longrightarrow> A x"
+
+lemma inf2D1: "(A \<sqinter> B) x y \<Longrightarrow> A x y"
+
+lemma inf1D2: "(A \<sqinter> B) x \<Longrightarrow> B x"
+
+lemma inf2D2: "(A \<sqinter> B) x y \<Longrightarrow> B x y"
+
+lemma sup1I1 [intro?]: "A x \<Longrightarrow> (A \<squnion> B) x"
+
+lemma sup2I1 [intro?]: "A x y \<Longrightarrow> (A \<squnion> B) x y"
+
+lemma sup1I2 [intro?]: "B x \<Longrightarrow> (A \<squnion> B) x"
+
+lemma sup2I2 [intro?]: "B x y \<Longrightarrow> (A \<squnion> B) x y"
+
+lemma sup1E [elim!]: "(A \<squnion> B) x \<Longrightarrow> (A x \<Longrightarrow> P) \<Longrightarrow> (B x \<Longrightarrow> P) \<Longrightarrow> P"
+  by (simp add: sup_fun_def) iprover
+
+lemma sup2E [elim!]: "(A \<squnion> B) x y \<Longrightarrow> (A x y \<Longrightarrow> P) \<Longrightarrow> (B x y \<Longrightarrow> P) \<Longrightarrow> P"
+  by (simp add: sup_fun_def) iprover
+
+text {*
+  \medskip Classical introduction rule: no commitment to @{text A} vs
+  @{text B}.
+*}
+
+lemma sup1CI [intro!]: "(\<not> B x \<Longrightarrow> A x) \<Longrightarrow> (A \<squnion> B) x"
+  by (auto simp add: sup_fun_def)
+
+lemma sup2CI [intro!]: "(\<not> B x y \<Longrightarrow> A x y) \<Longrightarrow> (A \<squnion> B) x y"
+  by (auto simp add: sup_fun_def)
+
+
no_notation
less_eq  (infix "\<sqsubseteq>" 50) and
less (infix "\<sqsubset>" 50) and
@@ -710,3 +767,4 @@
bot ("\<bottom>")

end
+```
```--- a/src/HOL/Orderings.thy	Mon Feb 20 15:17:03 2012 +0100
+++ b/src/HOL/Orderings.thy	Sun Feb 19 15:30:35 2012 +0100
@@ -1111,10 +1111,6 @@

end

-no_notation
-  bot ("\<bottom>") and
-  top ("\<top>")
-

subsection {* Dense orders *}

@@ -1239,10 +1235,10 @@
[simp]: "(P\<Colon>bool) < Q \<longleftrightarrow> \<not> P \<and> Q"

definition
-  [simp]: "bot \<longleftrightarrow> False"
+  [simp]: "\<bottom> \<longleftrightarrow> False"

definition
-  [simp]: "top \<longleftrightarrow> True"
+  [simp]: "\<top> \<longleftrightarrow> True"

instance proof
qed auto
@@ -1261,10 +1257,10 @@
lemma le_boolD: "P \<le> Q \<Longrightarrow> P \<longrightarrow> Q"
by simp

-lemma bot_boolE: "bot \<Longrightarrow> P"
+lemma bot_boolE: "\<bottom> \<Longrightarrow> P"
by simp

-lemma top_boolI: top
+lemma top_boolI: \<top>
by simp

lemma [code]:
@@ -1301,10 +1297,10 @@
begin

definition
-  "bot = (\<lambda>x. bot)"
+  "\<bottom> = (\<lambda>x. \<bottom>)"

lemma bot_apply:
-  "bot x = bot"
+  "\<bottom> x = \<bottom>"

instance proof
@@ -1316,11 +1312,11 @@
begin

definition
-  [no_atp]: "top = (\<lambda>x. top)"
+  [no_atp]: "\<top> = (\<lambda>x. \<top>)"
declare top_fun_def_raw [no_atp]

lemma top_apply:
-  "top x = top"
+  "\<top> x = \<top>"

instance proof
@@ -1338,6 +1334,61 @@
unfolding le_fun_def by simp

+subsection {* Order on unary and binary predicates *}
+
+lemma predicate1I:
+  assumes PQ: "\<And>x. P x \<Longrightarrow> Q x"
+  shows "P \<le> Q"
+  apply (rule le_funI)
+  apply (rule le_boolI)
+  apply (rule PQ)
+  apply assumption
+  done
+
+lemma predicate1D [Pure.dest?, dest?]:
+  "P \<le> Q \<Longrightarrow> P x \<Longrightarrow> Q x"
+  apply (erule le_funE)
+  apply (erule le_boolE)
+  apply assumption+
+  done
+
+lemma rev_predicate1D:
+  "P x \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x"
+  by (rule predicate1D)
+
+lemma predicate2I [Pure.intro!, intro!]:
+  assumes PQ: "\<And>x y. P x y \<Longrightarrow> Q x y"
+  shows "P \<le> Q"
+  apply (rule le_funI)+
+  apply (rule le_boolI)
+  apply (rule PQ)
+  apply assumption
+  done
+
+lemma predicate2D [Pure.dest, dest]:
+  "P \<le> Q \<Longrightarrow> P x y \<Longrightarrow> Q x y"
+  apply (erule le_funE)+
+  apply (erule le_boolE)
+  apply assumption+
+  done
+
+lemma rev_predicate2D:
+  "P x y \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x y"
+  by (rule predicate2D)
+
+lemma bot1E [no_atp, elim!]: "\<bottom> x \<Longrightarrow> P"
+
+lemma bot2E [elim!]: "\<bottom> x y \<Longrightarrow> P"
+
+lemma top1I [intro!]: "\<top> x"
+
+lemma top2I [intro!]: "\<top> x y"
+
+
subsection {* Name duplicates *}

lemmas order_eq_refl = preorder_class.eq_refl
@@ -1375,4 +1426,8 @@
lemmas linorder_antisym_conv2 = linorder_class.antisym_conv2
lemmas linorder_antisym_conv3 = linorder_class.antisym_conv3

+no_notation
+  top ("\<top>") and
+  bot ("\<bottom>")
+
end```
```--- a/src/HOL/Predicate.thy	Mon Feb 20 15:17:03 2012 +0100
+++ b/src/HOL/Predicate.thy	Sun Feb 19 15:30:35 2012 +0100
@@ -25,52 +25,6 @@

subsection {* Predicates as (complete) lattices *}

-text {*
-  Handy introduction and elimination rules for @{text "\<le>"}
-  on unary and binary predicates
-*}
-
-lemma predicate1I:
-  assumes PQ: "\<And>x. P x \<Longrightarrow> Q x"
-  shows "P \<le> Q"
-  apply (rule le_funI)
-  apply (rule le_boolI)
-  apply (rule PQ)
-  apply assumption
-  done
-
-lemma predicate1D [Pure.dest?, dest?]:
-  "P \<le> Q \<Longrightarrow> P x \<Longrightarrow> Q x"
-  apply (erule le_funE)
-  apply (erule le_boolE)
-  apply assumption+
-  done
-
-lemma rev_predicate1D:
-  "P x \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x"
-  by (rule predicate1D)
-
-lemma predicate2I [Pure.intro!, intro!]:
-  assumes PQ: "\<And>x y. P x y \<Longrightarrow> Q x y"
-  shows "P \<le> Q"
-  apply (rule le_funI)+
-  apply (rule le_boolI)
-  apply (rule PQ)
-  apply assumption
-  done
-
-lemma predicate2D [Pure.dest, dest]:
-  "P \<le> Q \<Longrightarrow> P x y \<Longrightarrow> Q x y"
-  apply (erule le_funE)+
-  apply (erule le_boolE)
-  apply assumption+
-  done
-
-lemma rev_predicate2D:
-  "P x y \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x y"
-  by (rule predicate2D)
-
-
subsubsection {* Equality *}

lemma pred_equals_eq [pred_set_conv]: "((\<lambda>x. x \<in> R) = (\<lambda>x. x \<in> S)) \<longleftrightarrow> (R = S)"
@@ -91,51 +45,15 @@

subsubsection {* Top and bottom elements *}

-lemma bot1E [no_atp, elim!]: "\<bottom> x \<Longrightarrow> P"
-
-lemma bot2E [elim!]: "\<bottom> x y \<Longrightarrow> P"
-
lemma bot_empty_eq: "\<bottom> = (\<lambda>x. x \<in> {})"

lemma bot_empty_eq2: "\<bottom> = (\<lambda>x y. (x, y) \<in> {})"

-lemma top1I [intro!]: "\<top> x"
-
-lemma top2I [intro!]: "\<top> x y"
-

subsubsection {* Binary intersection *}

-lemma inf1I [intro!]: "A x \<Longrightarrow> B x \<Longrightarrow> (A \<sqinter> B) x"
-
-lemma inf2I [intro!]: "A x y \<Longrightarrow> B x y \<Longrightarrow> (A \<sqinter> B) x y"
-
-lemma inf1E [elim!]: "(A \<sqinter> B) x \<Longrightarrow> (A x \<Longrightarrow> B x \<Longrightarrow> P) \<Longrightarrow> P"
-
-lemma inf2E [elim!]: "(A \<sqinter> B) x y \<Longrightarrow> (A x y \<Longrightarrow> B x y \<Longrightarrow> P) \<Longrightarrow> P"
-
-lemma inf1D1: "(A \<sqinter> B) x \<Longrightarrow> A x"
-
-lemma inf2D1: "(A \<sqinter> B) x y \<Longrightarrow> A x y"
-
-lemma inf1D2: "(A \<sqinter> B) x \<Longrightarrow> B x"
-
-lemma inf2D2: "(A \<sqinter> B) x y \<Longrightarrow> B x y"
-
lemma inf_Int_eq [pred_set_conv]: "(\<lambda>x. x \<in> R) \<sqinter> (\<lambda>x. x \<in> S) = (\<lambda>x. x \<in> R \<inter> S)"

@@ -145,35 +63,6 @@

subsubsection {* Binary union *}

-lemma sup1I1 [intro?]: "A x \<Longrightarrow> (A \<squnion> B) x"
-
-lemma sup2I1 [intro?]: "A x y \<Longrightarrow> (A \<squnion> B) x y"
-
-lemma sup1I2 [intro?]: "B x \<Longrightarrow> (A \<squnion> B) x"
-
-lemma sup2I2 [intro?]: "B x y \<Longrightarrow> (A \<squnion> B) x y"
-
-lemma sup1E [elim!]: "(A \<squnion> B) x \<Longrightarrow> (A x \<Longrightarrow> P) \<Longrightarrow> (B x \<Longrightarrow> P) \<Longrightarrow> P"
-  by (simp add: sup_fun_def) iprover
-
-lemma sup2E [elim!]: "(A \<squnion> B) x y \<Longrightarrow> (A x y \<Longrightarrow> P) \<Longrightarrow> (B x y \<Longrightarrow> P) \<Longrightarrow> P"
-  by (simp add: sup_fun_def) iprover
-
-text {*
-  \medskip Classical introduction rule: no commitment to @{text A} vs
-  @{text B}.
-*}
-
-lemma sup1CI [intro!]: "(\<not> B x \<Longrightarrow> A x) \<Longrightarrow> (A \<squnion> B) x"
-  by (auto simp add: sup_fun_def)
-
-lemma sup2CI [intro!]: "(\<not> B x y \<Longrightarrow> A x y) \<Longrightarrow> (A \<squnion> B) x y"
-  by (auto simp add: sup_fun_def)
-
lemma sup_Un_eq [pred_set_conv]: "(\<lambda>x. x \<in> R) \<squnion> (\<lambda>x. x \<in> S) = (\<lambda>x. x \<in> R \<union> S)"

@@ -183,57 +72,15 @@

subsubsection {* Intersections of families *}

-lemma INF1_iff: "(\<Sqinter>x\<in>A. B x) b = (\<forall>x\<in>A. B x b)"
-
-lemma INF2_iff: "(\<Sqinter>x\<in>A. B x) b c = (\<forall>x\<in>A. B x b c)"
-
-lemma INF1_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> B x b) \<Longrightarrow> (\<Sqinter>x\<in>A. B x) b"
-  by (auto simp add: INF_apply)
-
-lemma INF2_I [intro!]: "(\<And>x. x \<in> A \<Longrightarrow> B x b c) \<Longrightarrow> (\<Sqinter>x\<in>A. B x) b c"
-  by (auto simp add: INF_apply)
-
-lemma INF1_D [elim]: "(\<Sqinter>x\<in>A. B x) b \<Longrightarrow> a \<in> A \<Longrightarrow> B a b"
-  by (auto simp add: INF_apply)
-
-lemma INF2_D [elim]: "(\<Sqinter>x\<in>A. B x) b c \<Longrightarrow> a \<in> A \<Longrightarrow> B a b c"
-  by (auto simp add: INF_apply)
-
-lemma INF1_E [elim]: "(\<Sqinter>x\<in>A. B x) b \<Longrightarrow> (B a b \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
-  by (auto simp add: INF_apply)
-
-lemma INF2_E [elim]: "(\<Sqinter>x\<in>A. B x) b c \<Longrightarrow> (B a b c \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
-  by (auto simp add: INF_apply)
-
-lemma INF_INT_eq: "(\<Sqinter>i. (\<lambda>x. x \<in> r i)) = (\<lambda>x. x \<in> (\<Sqinter>i. r i))"
+lemma INF_INT_eq: "(\<Sqinter>i. (\<lambda>x. x \<in> r i)) = (\<lambda>x. x \<in> (\<Inter>i. r i))"

-lemma INF_INT_eq2: "(\<Sqinter>i. (\<lambda>x y. (x, y) \<in> r i)) = (\<lambda>x y. (x, y) \<in> (\<Sqinter>i. r i))"
+lemma INF_INT_eq2: "(\<Sqinter>i. (\<lambda>x y. (x, y) \<in> r i)) = (\<lambda>x y. (x, y) \<in> (\<Inter>i. r i))"

subsubsection {* Unions of families *}

-lemma SUP1_iff: "(\<Squnion>x\<in>A. B x) b = (\<exists>x\<in>A. B x b)"
-
-lemma SUP2_iff: "(\<Squnion>x\<in>A. B x) b c = (\<exists>x\<in>A. B x b c)"
-
-lemma SUP1_I [intro]: "a \<in> A \<Longrightarrow> B a b \<Longrightarrow> (\<Squnion>x\<in>A. B x) b"
-  by (auto simp add: SUP_apply)
-
-lemma SUP2_I [intro]: "a \<in> A \<Longrightarrow> B a b c \<Longrightarrow> (\<Squnion>x\<in>A. B x) b c"
-  by (auto simp add: SUP_apply)
-
-lemma SUP1_E [elim!]: "(\<Squnion>x\<in>A. B x) b \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> B x b \<Longrightarrow> R) \<Longrightarrow> R"
-  by (auto simp add: SUP_apply)
-
-lemma SUP2_E [elim!]: "(\<Squnion>x\<in>A. B x) b c \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> B x b c \<Longrightarrow> R) \<Longrightarrow> R"
-  by (auto simp add: SUP_apply)
-
lemma SUP_UN_eq [pred_set_conv]: "(\<Squnion>i. (\<lambda>x. x \<in> r i)) = (\<lambda>x. x \<in> (\<Union>i. r i))"