62 apply auto |
62 apply auto |
63 apply (case_tac x) |
63 apply (case_tac x) |
64 apply auto |
64 apply auto |
65 done |
65 done |
66 |
66 |
67 lemma setsum_Un_disjoint': |
67 lemma setsum_union_disjoint': |
68 assumes "finite A" |
68 assumes "finite A" |
69 and "finite B" |
69 and "finite B" |
70 and "A \<inter> B = {}" |
70 and "A \<inter> B = {}" |
71 and "A \<union> B = C" |
71 and "A \<union> B = C" |
72 shows "setsum g C = setsum g A + setsum g B" |
72 shows "setsum g C = setsum g A + setsum g B" |
73 using setsum_Un_disjoint[OF assms(1-3)] and assms(4) by auto |
73 using setsum.union_disjoint[OF assms(1-3)] and assms(4) by auto |
74 |
74 |
75 lemma pointwise_minimal_pointwise_maximal: |
75 lemma pointwise_minimal_pointwise_maximal: |
76 fixes s :: "(nat \<Rightarrow> nat) set" |
76 fixes s :: "(nat \<Rightarrow> nat) set" |
77 assumes "finite s" |
77 assumes "finite s" |
78 and "s \<noteq> {}" |
78 and "s \<noteq> {}" |
149 and "\<And>s. s \<in> S \<Longrightarrow> \<not> compo s \<Longrightarrow> nF s = 0 \<or> nF s = 2" |
149 and "\<And>s. s \<in> S \<Longrightarrow> \<not> compo s \<Longrightarrow> nF s = 0 \<or> nF s = 2" |
150 and "odd (card {f\<in>F. compo' f \<and> bnd f})" |
150 and "odd (card {f\<in>F. compo' f \<and> bnd f})" |
151 shows "odd (card {s\<in>S. compo s})" |
151 shows "odd (card {s\<in>S. compo s})" |
152 proof - |
152 proof - |
153 have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + (\<Sum>s | s \<in> S \<and> compo s. nF s) = (\<Sum>s\<in>S. nF s)" |
153 have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + (\<Sum>s | s \<in> S \<and> compo s. nF s) = (\<Sum>s\<in>S. nF s)" |
154 by (subst setsum_Un_disjoint[symmetric]) (auto intro!: setsum_cong) |
154 by (subst setsum.union_disjoint[symmetric]) (auto intro!: setsum.cong) |
155 also have "\<dots> = (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> bnd f}. face f s}) + |
155 also have "\<dots> = (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> bnd f}. face f s}) + |
156 (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> \<not> bnd f}. face f s})" |
156 (\<Sum>s\<in>S. card {f \<in> {f\<in>F. compo' f \<and> \<not> bnd f}. face f s})" |
157 unfolding setsum_addf[symmetric] |
157 unfolding setsum.distrib[symmetric] |
158 by (subst card_Un_disjoint[symmetric]) |
158 by (subst card_Un_disjoint[symmetric]) |
159 (auto simp: nF_def intro!: setsum_cong arg_cong[where f=card]) |
159 (auto simp: nF_def intro!: setsum.cong arg_cong[where f=card]) |
160 also have "\<dots> = 1 * card {f\<in>F. compo' f \<and> bnd f} + 2 * card {f\<in>F. compo' f \<and> \<not> bnd f}" |
160 also have "\<dots> = 1 * card {f\<in>F. compo' f \<and> bnd f} + 2 * card {f\<in>F. compo' f \<and> \<not> bnd f}" |
161 using assms(4,5) by (fastforce intro!: arg_cong2[where f="op +"] setsum_multicount) |
161 using assms(4,5) by (fastforce intro!: arg_cong2[where f="op +"] setsum_multicount) |
162 finally have "odd ((\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + card {s\<in>S. compo s})" |
162 finally have "odd ((\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) + card {s\<in>S. compo s})" |
163 using assms(6,8) by simp |
163 using assms(6,8) by simp |
164 moreover have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) = |
164 moreover have "(\<Sum>s | s \<in> S \<and> \<not> compo s. nF s) = |
165 (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 0. nF s) + (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 2. nF s)" |
165 (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 0. nF s) + (\<Sum>s | s \<in> S \<and> \<not> compo s \<and> nF s = 2. nF s)" |
166 using assms(7) by (subst setsum_Un_disjoint[symmetric]) (fastforce intro!: setsum_cong)+ |
166 using assms(7) by (subst setsum.union_disjoint[symmetric]) (fastforce intro!: setsum.cong)+ |
167 ultimately show ?thesis |
167 ultimately show ?thesis |
168 by auto |
168 by auto |
169 qed |
169 qed |
170 |
170 |
171 subsection {* The odd/even result for faces of complete vertices, generalized. *} |
171 subsection {* The odd/even result for faces of complete vertices, generalized. *} |