Quelle Semiring_Normalization.thy
Sprache: Isabelle
(* Title: HOL/Semiring_Normalization.thy Author: Amine Chaieb, TU Muenchen
*)
section \<open>Semiring normalization\<close>
theory Semiring_Normalization imports Numeral_Simprocs begin
text\<open>Prelude\<close>
class comm_semiring_1_cancel_crossproduct = comm_semiring_1_cancel + assumes crossproduct_eq: "w * y + x * z = w * z + x * y \ w = x \ y = z" begin
lemma crossproduct_noteq: "a \ b \ c \ d \ a * c + b * d \ a * d + b * c" by (simp add: crossproduct_eq)
lemma add_scale_eq_noteq: "r \ 0 \ a = b \ c \ d \ a + r * c \ b + r * d" proof (rule notI) assume nz: "r\ 0" and cnd: "a = b \ c\d" and eq: "a + (r * c) = b + (r * d)" have"(0 * d) + (r * c) = (0 * c) + (r * d)" using add_left_imp_eq eq mult_zero_left by (simp add: cnd) thenshow False using crossproduct_eq [of 0 d] nz cnd by simp qed
lemma add_0_iff: "b = b + a \ a = 0" using add_left_imp_eq [of b a 0] by auto
end
subclass (in idom) comm_semiring_1_cancel_crossproduct proof fix w x y z show"w * y + x * z = w * z + x * y \ w = x \ y = z" proof assume"w * y + x * z = w * z + x * y" thenhave"w * y + x * z - w * z - x * y = 0"by (simp add: algebra_simps) thenhave"w * (y - z) - x * (y - z) = 0"by (simp add: algebra_simps) thenhave"(y - z) * (w - x) = 0"by (simp add: algebra_simps) thenhave"y - z = 0 \ w - x = 0" by (rule divisors_zero) thenshow"w = x \ y = z" by auto qed (auto simp add: ac_simps) qed
instance nat :: comm_semiring_1_cancel_crossproduct proof fix w x y z :: nat have aux: "\y z. y < z \ w * y + x * z = w * z + x * y \ w = x" proof - fix y z :: nat assume"y < z"thenhave"\k. z = y + k \ k \ 0" by (intro exI [of _ "z - y"]) auto thenobtain k where"z = y + k"and"k \ 0" by blast assume"w * y + x * z = w * z + x * y" thenhave"(w * y + x * y) + x * k = (w * y + x * y) + w * k"by (simp add: \<open>z = y + k\<close> algebra_simps) thenhave"x * k = w * k"by simp thenshow"w = x"using\<open>k \<noteq> 0\<close> by simp qed show"w * y + x * z = w * z + x * y \ w = x \ y = z" by (auto simp add: neq_iff dest!: aux) 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.