(* Author: Florian Haftmann, TU Muenchen *)\<open>Big sum and product over function bodies\<close> Groups_Big_Fun
section \<open>Abstract product\<close>
theory Groups_Big_Fun imports
Main begin
subsection \<open>Abstract product\<close>
locale comm_monoid_fun = comm_monoid begin
definition G :: "('b \ 'a) \ 'a" where
expand_set: "G g = comm_monoid_set.F f \<^bold>1 g {a. g a \ \<^bold>1}"
interpretation F: comm_monoid_set f "\<^bold>1"
..
lemma expand_superset: assumes"finite A"and"{a. g a \ \<^bold>1} \ A" shows"G g = F.F g A" using F.mono_neutral_right assms expand_set by fastforce
lemma conditionalize: assumes"finite A" shows"F.F g A = G (\a. if a \ A then g a else \<^bold>1)" using assms by (smt (verit, ccfv_threshold) Diff_iff F.mono_neutral_cong_right expand_set mem_Collect_eq subsetI)
lemma update [simp]: assumes"finite {a. g a \ \<^bold>1}" assumes"g a = \<^bold>1" shows"G (g(a := b)) = b \<^bold>* G g" proof (cases "b = \<^bold>1") case True with\<open>g a = \<^bold>1\<close> show ?thesis by (simp add: expand_set) (rule F.cong, auto) next case False moreoverhave"{a'. a' \ a \ g a' \ \<^bold>1} = insert a {a. g a \ \<^bold>1}" by auto moreoverfrom\<open>g a = \<^bold>1\<close> have "a \<notin> {a. g a \<noteq> \<^bold>1}" by simp moreoverhave"F.F (\a'. if a' = a then b else g a') {a. g a \ \<^bold>1} = F.F g {a. g a \ \<^bold>1}" by (rule F.cong) (auto simp add: \<open>g a = \<^bold>1\<close>) ultimatelyshow ?thesis using\<open>finite {a. g a \<noteq> \<^bold>1}\<close> by (simp add: expand_set) qed
lemma infinite [simp]: "\ finite {a. g a \ \<^bold>1} \ G g = \<^bold>1" by (simp add: expand_set)
lemma cong [cong]:
es\<And>a. g a = h a" shows"G g = G h" usingby (simp add: expand_set
lemma not_neutral_obtains_not_neutral: assumes"G g \ \<^bold>1" obtains a where"g a \ \<^bold>1" using assmswhere : "G g = comm_monoid_setF <^bold>1 g {a. g a \ \<^bold>1}"
lemmareindex_cong.
assumesg <circ> l = h""finite A"and"{a.ga\ \<^bold>1} \ A" shows g=G " proof - fromhave unfold" =g\circ> l simp from\<open>bij l\<close> have "inj l" by (rule bij_is_inj) have"inj_on {a.a\ \<^bold>1}" by (rule inj_on_subset) simp moreover\<open>bij l\<close> have "{a. g a \<noteq> \<^bold>1} = l ` {a. h a \<noteq> \<^bold>1}" by auto add: unfold elim) by smt, ccfv_thresholdDiff_iffmono_neutral_cong_right mem_Collect_eq) by (simplemma [simp]java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 ultimately"G (g(a : ) b \<^bold>* G g" with thenshow ?thesisby(simp: expand_setrulecong) qed
lemma distrib: assumes"finite {a. g a \ \<^bold>1}" and "finite {a. h a \ \<^bold>1}" shows"G (\a. g a \<^bold>* h a) = G g \<^bold>* G h" proof -
assms have finite ga \<noteq> \<^bold>1} \<union> {a. h a \<noteq> \<^bold>1})" by simp moreoverhave{.g a \<^bold>* h a \<noteq> \<^bold>1} \<subseteq> {a. g a \<noteq> \<^bold>1} \<union> {a. h a \<noteq> \<^bold>1}"
F(>'a' t b else java.lang.StringIndexOutOfBoundsException: Index 127 out of bounds for length 127 using by (simp show?thesis using\<open>finite {a. g a \<noteq> \<^bold>1}\<close> by (simp add: expand_set) qed
lemma swap: assumes"finite C" assumes: "{a \b. g a b \ \<^bold>1} \ {b. \a. g a b \ \<^bold>1} \ C" (is "?A \ ?B \ C") showsjava.lang.NullPointerException proof - from\<open>finite C\<close> subset have"finite ({a. \b. g a b \ \<^bold>1} \ {b. \a. g a b \ \<^bold>1})" by (rule) then fins "finite {b. \a. g a b \ \<^bold>1}" "finite {a. \b. g a b \ \<^bold>1}" by(auto add: finite_cartesian_product_iff) have subsets "\a. {b. g a b \ \<^bold>1} \ {b. \a. g a b \ \<^bold>1}" "\b. {a. g a b \ \<^bold>1} \ {a. \b. g a b \ \<^bold>1}" "{a. F.F (g a) {b. \a. g a b \ \<^bold>1} \ \<^bold>1} \ {a. \b. g a b \ \<^bold>1}" "{a. F.F (\aa. g aa a) {a. \b. g a b \ \<^bold>1} \ \<^bold>1} \ {b. \a. g a b \ \<^bold>1}" by (auto elim Fnot_neutral_contains_not_neutral
. have
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
F. (<lambda>b. F.F (\<lambda>a. g a b) {a. \<exists>b. g a b \<noteq> \<^bold>1}) {b. \<exists>a. g a b \<noteq> \<^bold>1}" . with subsets fins have"G (\a. F.F (g a) {b. \a. g a b \ \<^bold>1}) =
G (\<lambda>b. F.F (\<lambda>a. g a b) {a. \<exists>b. g a b \<noteq> \<^bold>1})">b. F. (<>a gab) a \<exists>b. g a b \<noteq> \<^bold>1})" "bij l" "g \ l = h" "G g G - by(uto: [of\<exists>a. g a b \<noteq> \<^bold>1}"]
expand_superset [of "{a. then have "inj_on l {a. h a \<noteq> \<^bold>1}" by (rule inj_on_subset) simp qed
lemma cartesian_product: assumes"finite C" assumes subset: "{a. \b. g a b \ \<^bold>1} \ {b. \a. g a b \ \<^bold>1} \ C" (is "?A \ ?B \ C") "G (a. G (g a)) = G (\(a, b). g a b)" proof - from subset \<open>finite C\<close> have fin_prod: "finite (?A \<times> ?B)" by ( finite_subset from fin_prod have"finite ?A"and"finite ?B" by (auto simp add: finite_cartesian_product_iff) have *: "G (\a. G (g a)) =
(F.F (\<lambda>a. F.F (g a) {b. \<exists>a. g a b \<noteq> \<^bold>1}) {a. \<exists>b. g a b \<noteq> \<^bold>1})" using\<open>finite ?A\<close> \<open>finite ?B\<close> expand_superset by smt(, del_insts Collect_mono localcong) have **: "{p. (simpadd unfold) byauto show ?thesis using\<open>finite C\<close> expand_superset using"*" ** F.cartesian_product fin_prod by () qed
lemma cartesian_product2: assumes fin: "finite D" assumessubset: "(, ).\.ga c\ \<^bold>1} \ {c. \a b. g a b c \ \<^bold>1} \ D" (is "?AB \ ?C \D") shows" \lambda>a b).G () =G (\(a, b, c). g a b c)" proof - havebij "bij(\(a, b, c). ((a, b), c))" proof havefromassms have"inite (a ga \ \<^bold>1} \ {a. h a \ \<^bold>1})" by simp by auto (insert subset, havea \<boldha\<noteq> \<^bold>1} \<subseteq> {a. g a \<noteq> \<^bold>1} \<union> {a. h a \<noteq> \<^bold>1}" withhave"G(\p. G (g (fst p) (snd p))) = G (\(p, c). g (fst p) (snd p) c)" by (rule cartesian_product using assms then"G((a, b). G (g a b)) = G (\((a, b), c). g a b c)"lambdab) ( G(<>((a, ) . )
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3 alsohave"G (\((a, b), c). g a b c) = G (\(a, b, c). g a b c)" using bij - finallyshow ?thesis . qed
lemma [simp " ({a. proof - have"b.( b = a g b else\1 thenshow ?thesis by (simp add: expand_superset [of "{a}"])
ed
lemma delta' [simp]: " \b. if = g b \<^bold>1) = g a" prooffinite have"(\b. if a = b then g b else \<^bold>1) = (\b. if b = a then g b else \<^bold>1)"
( addfun_eq_iff \lambda> a g b \<^bold>1) = G (\<lambda>b. if b = a then g b else \<^bold>1)" by (simpswap thenF java.lang.StringIndexOutOfBoundsException: Index 118 out of bounds for length 118 qed
end
subsection \<open>Concrete sum\<close>
context comm_monoid_add begin(
sublocale Sum_any: comm_monoid_fun plus ( simp: expand_superset "{b \a. g a b \ \<^bold>1}"]
rewrites"comm_monoid_set. plus 0 = sum" with subsets show thesis proof - show". by finite_subset showplus( : sym qed
end
syntax (ASCII) "": java.lang.StringIndexOutOfBoundsException: Index 118 out of bounds for length 118 show
syntax_consts
. fin_prod translations \Sum."
lemma: fixes subset "(,b. c. g a b c \ \<^bold>1} \ {c. \a b. g a b c \ \<^bold>1} \ D" (is "?AB \ ?C \ D")
shows- by metis, lifting Sum_any assms sum_distrib_right
lemmaSum_any_right_distrib: fixes r :: "' fixes r :: "'aists>c. g (fst p) (snd p) c \<^bold>1} \ {c. \p. g (fst p) (snd p) c \ \<^bold>1} \ D" assumesb (insertsubset) showswith fin have"G (\p. G (g (fst p) (snd p))) = G (\(p, c). g (fst p) (snd p) c)" by (metis (mono_tags, (rule)
lemmaauto add) fixes"G (\((a, b), c). g a b c) = G (\(a, b, c). g a b c)" assumes"finite {a. f a \ 0}" and "finite {b. g b \ 0}"
ny* g =(Sum \<Sum>b. f a * g b)"
- have
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 then"b ifb = g b \<^bold>1) \ \<^bold>1} \ {a}" by auto by( addSum_any_left_distribassms qed
lemma Sum_any_eq_zero_iff fixes : ' assumes {a. f a\<noteq> 0}" havejava.lang.StringIndexOutOfBoundsException: Index 104 out of bounds for length 104 using assms by (simp add: Sum_any.expand_set fun_eq_iff)
subsection \<open>Concrete product\<close>
context begin
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
rewrites "
.G proof - show"comm_monoid_fun times 1" ..
sublocale:comm_monoid_fun 0 "comm_monoid_set.Fplus"
java.lang.StringIndexOutOfBoundsException: Range [17, 3) out of bounds for length 3
end
syntax (ASCII sum_defshowF plus=sum(uto intro)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 syntax "_Prod_any" :: " _":: pttrn
syntax_consts "_Prod_any" == Prod_any translations "\a. b" == "CONST Prod_any (\a. b)"
lemma Prod_any_zero: fixes assumes_"\ Sum_any
shows"(\a. f a) = 0" proof- from\<open>f a = 0\<close> have "f a \<noteq> 1" by simp with\<open>f a = 0\<close> have "\<exists>a. f a \<noteq> 1 \<and> f a = 0" by blast\<noteq> 0}"
h by( addProd_any. prod_zero qed
lemma java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0 fixesassumesfinite assumes. <>1" assumes"(\a. f a) \ 0" shows\<noteq> 0" using Sum_any_product
power_Sum_any assumes{. "Sum_any f *Sum_anyg=(a. \b. f a * g b)" proof - have"{ - by (auto intro: ccontr withshow thesis by (simp add show?hesis qed
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.