diff -r 38616a65bfbd -r 5bc81e50f2c5 src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Mon Feb 07 08:02:49 2005 +0100 +++ b/src/HOL/Finite_Set.thy Mon Feb 07 18:20:46 2005 +0100 @@ -2083,9 +2083,8 @@ and inf_least: "x \ y \ x \ z \ x \ y \ z" and sup_ge1: "x \ x \ y" and sup_ge2: "y \ x \ y" and sup_greatest: "y \ x \ z \ x \ y \ z \ x" -(* FIXME *) - and sup_inf_distrib1: "x \ y \ z = (x \ y) \ (x \ z)" - and sup_inf_distrib2: "x \ y \ z = (x \ z) \ (y \ z)" + and inf_sup_absorb: "x \ (x \ y) = x" + and sup_inf_absorb: "x \ (x \ y) = x" defines "Inf == fold1 inf" and "Sup == fold1 sup" @@ -2101,12 +2100,53 @@ lemma (in Lattice) sup_assoc: "(x \ y) \ z = x \ (y \ z)" by(blast intro!: antisym sup_ge1 sup_ge2 intro: sup_greatest trans) -lemma (in Lattice) inf_idem: "x \ x = x" +lemma (in Lattice) inf_idem[simp]: "x \ x = x" by(blast intro: antisym inf_le1 inf_le2 inf_least refl) -lemma (in Lattice) sup_idem: "x \ x = x" +lemma (in Lattice) sup_idem[simp]: "x \ x = x" by(blast intro: antisym sup_ge1 sup_ge2 sup_greatest refl) +lemma (in Lattice) sup_absorb: "x \ y \ x \ y = y" +by(blast intro: antisym sup_ge2 sup_greatest refl) + +lemma (in Lattice) inf_absorb: "x \ y \ x \ y = x" +by(blast intro: antisym inf_le1 inf_least refl) + +text{* Distributive lattices: *} + +locale DistribLattice = Lattice + + assumes sup_inf_distrib1: "x \ (y \ z) = (x \ y) \ (x \ z)" + +lemma (in Lattice) distrib_imp1: +assumes D: "!!x y z. x \ (y \ z) = (x \ y) \ (x \ z)" +shows "x \ (y \ z) = (x \ y) \ (x \ z)" +proof- + have "x \ (y \ z) = (x \ (x \ z)) \ (y \ z)" by(simp add:sup_inf_absorb) + also have "\ = x \ (z \ (x \ y))" by(simp add:D inf_comm sup_assoc) + also have "\ = ((x \ y) \ x) \ ((x \ y) \ z)" + by(simp add:inf_sup_absorb inf_comm) + also have "\ = (x \ y) \ (x \ z)" by(simp add:D) + finally show ?thesis . +qed + +lemma (in Lattice) distrib_imp2: +assumes D: "!!x y z. x \ (y \ z) = (x \ y) \ (x \ z)" +shows "x \ (y \ z) = (x \ y) \ (x \ z)" +proof- + have "x \ (y \ z) = (x \ (x \ z)) \ (y \ z)" by(simp add:inf_sup_absorb) + also have "\ = x \ (z \ (x \ y))" by(simp add:D sup_comm inf_assoc) + also have "\ = ((x \ y) \ x) \ ((x \ y) \ z)" + by(simp add:sup_inf_absorb sup_comm) + also have "\ = (x \ y) \ (x \ z)" by(simp add:D) + finally show ?thesis . +qed + + +lemma (in DistribLattice) inf_sup_distrib1: + "x \ (y \ z) = (x \ y) \ (x \ z)" +by(rule distrib_imp2[OF sup_inf_distrib1]) + + text{* Lattices are semilattices *} lemma (in Lattice) ACf_inf: "ACf inf" @@ -2163,7 +2203,18 @@ apply(erule (2) ACIfSL.fold1_belowI[OF ACIfSL_sup]) done -lemma (in Lattice) sup_Inf1_distrib: +lemma (in Lattice) sup_Inf_absorb: + "\ finite A; A \ {}; a \ A \ \ (a \ \A) = a" +apply(subst sup_comm) +apply(simp add:Inf_def sup_absorb ACIfSL.fold1_belowI[OF ACIfSL_inf]) +done + +lemma (in Lattice) inf_Sup_absorb: + "\ finite A; A \ {}; a \ A \ \ (a \ \A) = a" +by(simp add:Sup_def inf_absorb ACIfSL.fold1_belowI[OF ACIfSL_sup]) + + +lemma (in DistribLattice) sup_Inf1_distrib: assumes A: "finite A" "A \ {}" shows "(x \ \A) = \{x \ a|a. a \ A}" using A @@ -2184,8 +2235,8 @@ finally show ?case . qed - -lemma (in Lattice) sup_Inf2_distrib: +(* FIXME +lemma (in DistribLattice) sup_Inf2_distrib: assumes A: "finite A" "A \ {}" and B: "finite B" "B \ {}" shows "(\A \ \B) = \{a \ b|a b. a \ A \ b \ B}" using A @@ -2216,7 +2267,7 @@ by blast finally show ?case . qed - +*) subsection{*Min and Max*} @@ -2381,10 +2432,10 @@ lemma Min_le_Max: "\ finite A; A \ {} \ \ Min A \ Max A" by(simp add: Min_def Max_def Lattice.Inf_le_Sup[OF Lattice_min_max]) - +(* FIXME lemma max_Min2_distrib: "\ finite A; A \ {}; finite B; B \ {} \ \ max (Min A) (Min B) = Min{ max a b |a b. a \ A \ b \ B}" by(simp add: Min_def Max_def Lattice.sup_Inf2_distrib[OF Lattice_min_max]) - +*) end