src/HOL/Semiring_Normalization.thy
author haftmann
Wed, 12 May 2010 13:51:22 +0200
changeset 36872 6520ba1256a6
parent 36871 3763c349c8c1
child 36873 112e613e8d0b
permissions -rw-r--r--
tuned fact collection names and some proofs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36751
7f1da69cacb3 split of semiring normalization from Groebner theory; moved field_comp_conv to Numeral_Simproces
haftmann
parents: 36720
diff changeset
     1
(*  Title:      HOL/Semiring_Normalization.thy
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     2
    Author:     Amine Chaieb, TU Muenchen
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     3
*)
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     4
36751
7f1da69cacb3 split of semiring normalization from Groebner theory; moved field_comp_conv to Numeral_Simproces
haftmann
parents: 36720
diff changeset
     5
header {* Semiring normalization *}
28402
09e4aa3ddc25 clarified dependencies between arith tools
haftmann
parents: 27666
diff changeset
     6
36751
7f1da69cacb3 split of semiring normalization from Groebner theory; moved field_comp_conv to Numeral_Simproces
haftmann
parents: 36720
diff changeset
     7
theory Semiring_Normalization
36699
816da1023508 moved nat_arith ot Nat_Numeral: clarified normalizer setup
haftmann
parents: 36698
diff changeset
     8
imports Numeral_Simprocs Nat_Transfer
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     9
uses
36753
5cf4e9128f22 renamed Normalizer to the more specific Semiring_Normalizer
haftmann
parents: 36751
diff changeset
    10
  "Tools/semiring_normalizer.ML"
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    11
begin
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    12
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    13
text {* FIXME prelude *}
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    14
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    15
class comm_semiring_1_cancel_norm (*FIXME name*) = comm_semiring_1_cancel +
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    16
  assumes add_mult_solve: "w * y + x * z = w * z + x * y \<longleftrightarrow> w = x \<or> y = z"
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    17
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    18
sublocale idom < comm_semiring_1_cancel_norm
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    19
proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    20
  fix w x y z
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    21
  show "w * y + x * z = w * z + x * y \<longleftrightarrow> w = x \<or> y = z"
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    22
  proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    23
    assume "w * y + x * z = w * z + x * y"
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    24
    then have "w * y + x * z - w * z - x * y = 0" by (simp add: algebra_simps)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    25
    then have "w * (y - z) - x * (y - z) = 0" by (simp add: algebra_simps)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    26
    then have "(y - z) * (w - x) = 0" by (simp add: algebra_simps)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    27
    then have "y - z = 0 \<or> w - x = 0" by (rule divisors_zero)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    28
    then show "w = x \<or> y = z" by auto
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    29
  qed (auto simp add: add_ac)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    30
qed
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    31
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    32
instance nat :: comm_semiring_1_cancel_norm
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    33
proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    34
  fix w x y z :: nat
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    35
  { assume p: "w * y + x * z = w * z + x * y" and ynz: "y \<noteq> z"
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    36
    hence "y < z \<or> y > z" by arith
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    37
    moreover {
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    38
      assume lt:"y <z" hence "\<exists>k. z = y + k \<and> k > 0" by (rule_tac x="z - y" in exI, auto)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    39
      then obtain k where kp: "k>0" and yz:"z = y + k" by blast
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    40
      from p have "(w * y + x *y) + x*k = (w * y + x*y) + w*k" by (simp add: yz algebra_simps)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    41
      hence "x*k = w*k" by simp
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    42
      hence "w = x" using kp by simp }
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    43
    moreover {
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    44
      assume lt: "y >z" hence "\<exists>k. y = z + k \<and> k>0" by (rule_tac x="y - z" in exI, auto)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    45
      then obtain k where kp: "k>0" and yz:"y = z + k" by blast
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    46
      from p have "(w * z + x *z) + w*k = (w * z + x*z) + x*k" by (simp add: yz algebra_simps)
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    47
      hence "w*k = x*k" by simp
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    48
      hence "w = x" using kp by simp }
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    49
    ultimately have "w=x" by blast }
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    50
  then show "w * y + x * z = w * z + x * y \<longleftrightarrow> w = x \<or> y = z" by auto
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    51
qed
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    52
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    53
text {* semiring normalization proper *}
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    54
36753
5cf4e9128f22 renamed Normalizer to the more specific Semiring_Normalizer
haftmann
parents: 36751
diff changeset
    55
setup Semiring_Normalizer.setup
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    56
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    57
context comm_semiring_1
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    58
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    59
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
    60
lemma normalizing_semiring_ops:
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    61
  shows "TERM (x + y)" and "TERM (x * y)" and "TERM (x ^ n)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    62
    and "TERM 0" and "TERM 1" .
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    63
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
    64
lemma normalizing_semiring_rules:
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    65
  "(a * m) + (b * m) = (a + b) * m"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    66
  "(a * m) + m = (a + 1) * m"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    67
  "m + (a * m) = (a + 1) * m"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    68
  "m + m = (1 + 1) * m"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    69
  "0 + a = a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    70
  "a + 0 = a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    71
  "a * b = b * a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    72
  "(a + b) * c = (a * c) + (b * c)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    73
  "0 * a = 0"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    74
  "a * 0 = 0"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    75
  "1 * a = a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    76
  "a * 1 = a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    77
  "(lx * ly) * (rx * ry) = (lx * rx) * (ly * ry)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    78
  "(lx * ly) * (rx * ry) = lx * (ly * (rx * ry))"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    79
  "(lx * ly) * (rx * ry) = rx * ((lx * ly) * ry)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    80
  "(lx * ly) * rx = (lx * rx) * ly"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    81
  "(lx * ly) * rx = lx * (ly * rx)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    82
  "lx * (rx * ry) = (lx * rx) * ry"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    83
  "lx * (rx * ry) = rx * (lx * ry)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    84
  "(a + b) + (c + d) = (a + c) + (b + d)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    85
  "(a + b) + c = a + (b + c)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    86
  "a + (c + d) = c + (a + d)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    87
  "(a + b) + c = (a + c) + b"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    88
  "a + c = c + a"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    89
  "a + (c + d) = (a + c) + d"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    90
  "(x ^ p) * (x ^ q) = x ^ (p + q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    91
  "x * (x ^ q) = x ^ (Suc q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    92
  "(x ^ q) * x = x ^ (Suc q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    93
  "x * x = x ^ 2"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    94
  "(x * y) ^ q = (x ^ q) * (y ^ q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    95
  "(x ^ p) ^ q = x ^ (p * q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    96
  "x ^ 0 = 1"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    97
  "x ^ 1 = x"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    98
  "x * (y + z) = (x * y) + (x * z)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
    99
  "x ^ (Suc q) = x * (x ^ q)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   100
  "x ^ (2*n) = (x ^ n) * (x ^ n)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   101
  "x ^ (Suc (2*n)) = x * ((x ^ n) * (x ^ n))"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   102
  by (simp_all add: algebra_simps power_add power2_eq_square power_mult_distrib power_mult)
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   103
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   104
lemmas normalizing_comm_semiring_1_axioms =
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   105
  comm_semiring_1_axioms [normalizer
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   106
    semiring ops: normalizing_semiring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   107
    semiring rules: normalizing_semiring_rules]
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   108
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   109
declaration
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   110
  {* Semiring_Normalizer.semiring_funs @{thm normalizing_comm_semiring_1_axioms} *}
23573
d85a277f90fd common normalizer_funs, avoid cterm_of;
wenzelm
parents: 23477
diff changeset
   111
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   112
end
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   113
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   114
context comm_ring_1
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   115
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   116
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   117
lemma normalizing_ring_ops: shows "TERM (x- y)" and "TERM (- x)" .
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   118
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   119
lemma normalizing_ring_rules:
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   120
  "- x = (- 1) * x"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   121
  "x - y = x + (- y)"
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   122
  by (simp_all add: diff_minus)
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   123
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   124
lemmas normalizing_comm_ring_1_axioms =
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   125
  comm_ring_1_axioms [normalizer
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   126
    semiring ops: normalizing_semiring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   127
    semiring rules: normalizing_semiring_rules
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   128
    ring ops: normalizing_ring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   129
    ring rules: normalizing_ring_rules]
30866
dd5117e2d73e now deals with devision in fields
chaieb
parents: 30729
diff changeset
   130
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   131
declaration
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   132
  {* Semiring_Normalizer.semiring_funs @{thm normalizing_comm_ring_1_axioms} *}
23327
1654013ec97c Added instantiation of algebra method to fields
chaieb
parents: 23312
diff changeset
   133
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   134
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   135
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   136
context comm_semiring_1_cancel_norm
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   137
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   138
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   139
lemma noteq_reduce:
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   140
  "a \<noteq> b \<and> c \<noteq> d \<longleftrightarrow> a * c + b * d \<noteq> a * d + b * c"
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   141
  by (simp add: add_mult_solve)
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   142
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   143
lemma add_scale_eq_noteq:
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   144
  "r \<noteq> 0 \<Longrightarrow> a = b \<and> c \<noteq> d \<Longrightarrow> a + r * c \<noteq> b + r * d"
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   145
proof (rule notI)
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   146
  assume nz: "r\<noteq> 0" and cnd: "a = b \<and> c\<noteq>d"
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   147
    and eq: "a + (r * c) = b + (r * d)"
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   148
  have "(0 * d) + (r * c) = (0 * c) + (r * d)"
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   149
    using add_imp_eq eq mult_zero_left by (simp add: cnd)
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   150
  then show False using add_mult_solve [of 0 d] nz cnd by simp
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   151
qed
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   152
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   153
lemma add_0_iff:
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   154
  "x = x + a \<longleftrightarrow> a = 0"
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   155
  using add_imp_eq [of x a 0] by auto
25250
b3a485b98963 (1) added axiom to ringb and theorems to enable algebra to prove the ideal membership problem; (2) Method algebra now calls algebra_tac which first tries to solve a universal formula, then in case of failure trie to solve the ideal membership problem (see HOL/Tools/Groebner_Basis/groebner.ML)
chaieb
parents: 23573
diff changeset
   156
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   157
declare
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   158
  normalizing_comm_semiring_1_axioms [normalizer del]
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   159
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   160
lemmas
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   161
  normalizing_comm_semiring_1_cancel_norm_axioms =
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   162
  comm_semiring_1_cancel_norm_axioms [normalizer
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   163
    semiring ops: normalizing_semiring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   164
    semiring rules: normalizing_semiring_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   165
    idom rules: noteq_reduce add_scale_eq_noteq]
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   166
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   167
declaration
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   168
  {* Semiring_Normalizer.semiring_funs @{thm normalizing_comm_semiring_1_cancel_norm_axioms} *}
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   169
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   170
end
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   171
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   172
context idom
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   173
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   174
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   175
declare normalizing_comm_ring_1_axioms [normalizer del]
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   176
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   177
lemmas normalizing_idom_axioms = idom_axioms [normalizer
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   178
  semiring ops: normalizing_semiring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   179
  semiring rules: normalizing_semiring_rules
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   180
  ring ops: normalizing_ring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   181
  ring rules: normalizing_ring_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   182
  idom rules: noteq_reduce add_scale_eq_noteq
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   183
  ideal rules: right_minus_eq add_0_iff]
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   184
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   185
declaration
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   186
  {* Semiring_Normalizer.semiring_funs @{thm normalizing_idom_axioms} *}
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   187
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   188
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   189
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   190
context field
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   191
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   192
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   193
lemma normalizing_field_ops:
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   194
  shows "TERM (x / y)" and "TERM (inverse x)" .
23327
1654013ec97c Added instantiation of algebra method to fields
chaieb
parents: 23312
diff changeset
   195
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   196
lemmas normalizing_field_rules = divide_inverse inverse_eq_divide
28402
09e4aa3ddc25 clarified dependencies between arith tools
haftmann
parents: 27666
diff changeset
   197
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   198
lemmas normalizing_field_axioms =
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   199
  field_axioms [normalizer
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   200
    semiring ops: normalizing_semiring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   201
    semiring rules: normalizing_semiring_rules
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   202
    ring ops: normalizing_ring_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   203
    ring rules: normalizing_ring_rules
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   204
    field ops: normalizing_field_ops
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   205
    field rules: normalizing_field_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   206
    idom rules: noteq_reduce add_scale_eq_noteq
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   207
    ideal rules: right_minus_eq add_0_iff]
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   208
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   209
declaration
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   210
  {* Semiring_Normalizer.field_funs @{thm normalizing_field_axioms} *}
28402
09e4aa3ddc25 clarified dependencies between arith tools
haftmann
parents: 27666
diff changeset
   211
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   212
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   213
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   214
hide_fact (open) normalizing_comm_semiring_1_axioms
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   215
  normalizing_comm_semiring_1_cancel_norm_axioms normalizing_semiring_ops normalizing_semiring_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   216
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   217
hide_fact (open) normalizing_comm_ring_1_axioms
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   218
  normalizing_idom_axioms normalizing_ring_ops normalizing_ring_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   219
36872
6520ba1256a6 tuned fact collection names and some proofs
haftmann
parents: 36871
diff changeset
   220
hide_fact (open) normalizing_field_axioms normalizing_field_ops normalizing_field_rules
36845
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   221
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   222
hide_fact (open) add_scale_eq_noteq noteq_reduce
d778c64fc35d Add rules directly to the corresponding class locales instead.
hoelzl
parents: 36756
diff changeset
   223
28402
09e4aa3ddc25 clarified dependencies between arith tools
haftmann
parents: 27666
diff changeset
   224
end