514 interpretation AC_add: ACe ["op +" "0::'a::comm_monoid_add"] |
514 interpretation AC_add: ACe ["op +" "0::'a::comm_monoid_add"] |
515 by(auto intro: ACf.intro ACe_axioms.intro add_assoc add_commute) |
515 by(auto intro: ACf.intro ACe_axioms.intro add_assoc add_commute) |
516 |
516 |
517 interpretation AC_mult: ACe ["op *" "1::'a::comm_monoid_mult"] |
517 interpretation AC_mult: ACe ["op *" "1::'a::comm_monoid_mult"] |
518 apply - |
518 apply - |
519 apply (fast intro: ACf.intro mult_assoc ab_semigroup_mult.mult_commute) |
519 apply (fast intro: ACf.intro mult_assoc mult_commute) |
520 apply (fastsimp intro: ACe_axioms.intro mult_assoc ab_semigroup_mult.mult_commute) |
520 apply (fastsimp intro: ACe_axioms.intro mult_assoc mult_commute) |
521 done |
521 done |
522 |
522 |
523 (* |
|
524 lemma ACf_add: "ACf (op + :: 'a::comm_monoid_add \<Rightarrow> 'a \<Rightarrow> 'a)" |
|
525 by(fastsimp intro: ACf.intro add_assoc add_commute) |
|
526 |
|
527 lemma ACe_add: "ACe (op +) (0::'a::comm_monoid_add)" |
|
528 by(fastsimp intro: ACe.intro ACe_axioms.intro ACf_add) |
|
529 |
|
530 lemma ACf_mult: "ACf (op * :: 'a::comm_monoid_mult \<Rightarrow> 'a \<Rightarrow> 'a)" |
|
531 by(fast intro: ACf.intro mult_assoc ab_semigroup_mult.mult_commute) |
|
532 |
|
533 lemma ACe_mult: "ACe (op * ) (1::'a::comm_monoid_mult)" |
|
534 by(fastsimp intro: ACe.intro ACe_axioms.intro ACf_mult) |
|
535 *) |
|
536 |
523 |
537 subsubsection{*From @{term foldSet} to @{term fold}*} |
524 subsubsection{*From @{term foldSet} to @{term fold}*} |
538 |
525 |
539 lemma image_less_Suc: "h ` {i. i < Suc m} = insert (h m) (h ` {i. i < m})" |
526 lemma image_less_Suc: "h ` {i. i < Suc m} = insert (h m) (h ` {i. i < m})" |
540 by (auto simp add: less_Suc_eq) |
527 by (auto simp add: less_Suc_eq) |
2147 done |
2134 done |
2148 |
2135 |
2149 |
2136 |
2150 subsubsection{* Fold laws in lattices *} |
2137 subsubsection{* Fold laws in lattices *} |
2151 |
2138 |
2152 lemma (in Lattice) Inf_le_Sup: "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> \<Sqinter>A \<sqsubseteq> \<Squnion>A" |
2139 lemma (in Lattice) Inf_le_Sup[simp]: "\<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> \<Sqinter>A \<sqsubseteq> \<Squnion>A" |
2153 apply(unfold Sup_def Inf_def) |
2140 apply(unfold Sup_def Inf_def) |
2154 apply(subgoal_tac "EX a. a:A") |
2141 apply(subgoal_tac "EX a. a:A") |
2155 prefer 2 apply blast |
2142 prefer 2 apply blast |
2156 apply(erule exE) |
2143 apply(erule exE) |
2157 apply(rule trans) |
2144 apply(rule trans) |
2158 apply(erule (2) ACIfSL.fold1_belowI[OF ACIfSL_inf]) |
2145 apply(erule (2) ACIfSL.fold1_belowI[OF ACIfSL_inf]) |
2159 apply(erule (2) ACIfSL.fold1_belowI[OF ACIfSL_sup]) |
2146 apply(erule (2) ACIfSL.fold1_belowI[OF ACIfSL_sup]) |
2160 done |
2147 done |
2161 |
2148 |
2162 lemma (in Lattice) sup_Inf_absorb: |
2149 lemma (in Lattice) sup_Inf_absorb[simp]: |
2163 "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<squnion> \<Sqinter>A) = a" |
2150 "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<squnion> \<Sqinter>A) = a" |
2164 apply(subst sup_commute) |
2151 apply(subst sup_commute) |
2165 apply(simp add:Inf_def sup_absorb ACIfSL.fold1_belowI[OF ACIfSL_inf]) |
2152 apply(simp add:Inf_def sup_absorb ACIfSL.fold1_belowI[OF ACIfSL_inf]) |
2166 done |
2153 done |
2167 |
2154 |
2168 lemma (in Lattice) inf_Sup_absorb: |
2155 lemma (in Lattice) inf_Sup_absorb[simp]: |
2169 "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<sqinter> \<Squnion>A) = a" |
2156 "\<lbrakk> finite A; A \<noteq> {}; a \<in> A \<rbrakk> \<Longrightarrow> (a \<sqinter> \<Squnion>A) = a" |
2170 by(simp add:Sup_def inf_absorb ACIfSL.fold1_belowI[OF ACIfSL_sup]) |
2157 by(simp add:Sup_def inf_absorb ACIfSL.fold1_belowI[OF ACIfSL_sup]) |
2171 |
2158 |
2172 |
2159 |
2173 lemma (in Distrib_Lattice) sup_Inf1_distrib: |
2160 lemma (in Distrib_Lattice) sup_Inf1_distrib: |
2258 interpretation AC_max [rule del]: ACIf ["max:: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a"] |
2245 interpretation AC_max [rule del]: ACIf ["max:: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a"] |
2259 apply(rule ACIf_axioms.intro) |
2246 apply(rule ACIf_axioms.intro) |
2260 apply(auto simp:max_def) |
2247 apply(auto simp:max_def) |
2261 done |
2248 done |
2262 |
2249 |
2263 interpretation AC_min [rule del]: ACIfSL ["min:: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "op \<le>"] |
2250 interpretation AC_min [rule del]: |
|
2251 ACIfSL ["min:: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "op \<le>"] |
2264 apply(rule ACIfSL_axioms.intro) |
2252 apply(rule ACIfSL_axioms.intro) |
2265 apply(auto simp:min_def) |
2253 apply(auto simp:min_def) |
2266 done |
2254 done |
2267 |
2255 |
2268 interpretation AC_min [rule del]: ACIfSLlin ["min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "op \<le>"] |
2256 interpretation AC_min [rule del]: |
|
2257 ACIfSLlin ["min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "op \<le>"] |
2269 apply(rule ACIfSLlin_axioms.intro) |
2258 apply(rule ACIfSLlin_axioms.intro) |
2270 apply(auto simp:min_def) |
2259 apply(auto simp:min_def) |
2271 done |
2260 done |
2272 |
2261 |
2273 interpretation AC_max [rule del]: ACIfSL ["max :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "%x y. y\<le>x"] |
2262 interpretation AC_max [rule del]: |
|
2263 ACIfSL ["max :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "%x y. y\<le>x"] |
2274 apply(rule ACIfSL_axioms.intro) |
2264 apply(rule ACIfSL_axioms.intro) |
2275 apply(auto simp:max_def) |
2265 apply(auto simp:max_def) |
2276 done |
2266 done |
2277 |
2267 |
2278 interpretation AC_max [rule del]: ACIfSLlin ["max :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "%x y. y\<le>x"] |
2268 interpretation AC_max [rule del]: |
|
2269 ACIfSLlin ["max :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "%x y. y\<le>x"] |
2279 apply(rule ACIfSLlin_axioms.intro) |
2270 apply(rule ACIfSLlin_axioms.intro) |
2280 apply(auto simp:max_def) |
2271 apply(auto simp:max_def) |
2281 done |
2272 done |
2282 |
2273 |
2283 lemma Lattice_min_max [rule del]: "Lattice (op \<le>) (min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a) max" |
2274 interpretation min_max [rule del]: |
2284 apply(rule Lattice.intro) |
2275 Lattice ["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max" "Min" "Max"] |
2285 apply(rule partial_order_order) |
2276 apply - |
2286 apply(rule lower_semilattice.axioms[OF lower_semilattice_lin_min]) |
2277 apply(rule Min_def) |
2287 apply(rule upper_semilattice.axioms[OF upper_semilattice_lin_max]) |
2278 apply(rule Max_def) |
2288 done |
2279 done |
2289 |
2280 |
2290 lemma Distrib_Lattice_min_max [rule del]: |
2281 |
2291 "Distrib_Lattice (op \<le>) (min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a) max" |
2282 interpretation min_max [rule del]: |
2292 apply(rule Distrib_Lattice.intro) |
2283 Distrib_Lattice ["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max" "Min" "Max"] |
2293 apply(rule partial_order_order) |
2284 . |
2294 apply(rule lower_semilattice.axioms[OF lower_semilattice_lin_min]) |
|
2295 apply(rule upper_semilattice.axioms[OF upper_semilattice_lin_max]) |
|
2296 apply(rule distrib_lattice.axioms[OF distrib_lattice_min_max]) |
|
2297 done |
|
2298 |
|
2299 interpretation Lattice_min_max [rule del]: |
|
2300 Lattice ["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max"] |
|
2301 using Lattice_min_max |
|
2302 by (auto dest: Lattice.axioms) |
|
2303 |
|
2304 interpretation Lattice_min_max [rule del]: |
|
2305 Distrib_Lattice ["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max"] |
|
2306 using Distrib_Lattice_min_max |
|
2307 by (fast dest: Distrib_Lattice.axioms) |
|
2308 |
2285 |
2309 text {* Classical rules from the locales are deleted in the above |
2286 text {* Classical rules from the locales are deleted in the above |
2310 interpretations, since they interfere with the claset setup for |
2287 interpretations, since they interfere with the claset setup for |
2311 @{text "op \<le>"}. *} |
2288 @{text "op \<le>"}. *} |
2312 |
2289 |