src/HOL/Semiring_Normalization.thy
author wenzelm
Mon, 12 Apr 2021 14:14:47 +0200
changeset 73563 55b66a45bc94
parent 70332 315489d836d8
permissions -rw-r--r--
tuned;
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
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59557
diff changeset
     5
section \<open>Semiring normalization\<close>
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
66836
4eb431c3f974 tuned imports
haftmann
parents: 61153
diff changeset
     8
imports Numeral_Simprocs
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
     9
begin
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    10
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59557
diff changeset
    11
text \<open>Prelude\<close>
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    12
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    13
class comm_semiring_1_cancel_crossproduct = comm_semiring_1_cancel +
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    14
  assumes crossproduct_eq: "w * y + x * z = w * z + x * y \<longleftrightarrow> w = x \<or> y = z"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    15
begin
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    16
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    17
lemma crossproduct_noteq:
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    18
  "a \<noteq> b \<and> c \<noteq> d \<longleftrightarrow> a * c + b * d \<noteq> a * d + b * c"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    19
  by (simp add: crossproduct_eq)
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    20
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    21
lemma add_scale_eq_noteq:
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    22
  "r \<noteq> 0 \<Longrightarrow> a = b \<and> c \<noteq> d \<Longrightarrow> a + r * c \<noteq> b + r * d"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    23
proof (rule notI)
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    24
  assume nz: "r\<noteq> 0" and cnd: "a = b \<and> c\<noteq>d"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    25
    and eq: "a + (r * c) = b + (r * d)"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    26
  have "(0 * d) + (r * c) = (0 * c) + (r * d)"
59557
ebd8ecacfba6 establish unique preferred fact names
haftmann
parents: 59554
diff changeset
    27
    using add_left_imp_eq eq mult_zero_left by (simp add: cnd)
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    28
  then show False using crossproduct_eq [of 0 d] nz cnd by simp
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    29
qed
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    30
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    31
lemma add_0_iff:
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    32
  "b = b + a \<longleftrightarrow> a = 0"
59557
ebd8ecacfba6 establish unique preferred fact names
haftmann
parents: 59554
diff changeset
    33
  using add_left_imp_eq [of b a 0] by auto
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    34
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    35
end
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    36
37946
be3c0df7bb90 proper subclass instead of sublocale
haftmann
parents: 36873
diff changeset
    37
subclass (in idom) comm_semiring_1_cancel_crossproduct
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    38
proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    39
  fix w x y z
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    40
  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
    41
  proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    42
    assume "w * y + x * z = w * z + x * y"
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    43
    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
    44
    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
    45
    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
    46
    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
    47
    then show "w = x \<or> y = z" by auto
57514
bdc2c6b40bf2 prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents: 54230
diff changeset
    48
  qed (auto simp add: ac_simps)
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    49
qed
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    50
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    51
instance nat :: comm_semiring_1_cancel_crossproduct
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    52
proof
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    53
  fix w x y z :: nat
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    54
  have aux: "\<And>y z. y < z \<Longrightarrow> w * y + x * z = w * z + x * y \<Longrightarrow> w = x"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    55
  proof -
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    56
    fix y z :: nat
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    57
    assume "y < z" then have "\<exists>k. z = y + k \<and> k \<noteq> 0" by (intro exI [of _ "z - y"]) auto
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    58
    then obtain k where "z = y + k" and "k \<noteq> 0" by blast
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    59
    assume "w * y + x * z = w * z + x * y"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59557
diff changeset
    60
    then have "(w * y + x * y) + x * k = (w * y + x * y) + w * k" by (simp add: \<open>z = y + k\<close> algebra_simps)
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    61
    then have "x * k = w * k" by simp
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59557
diff changeset
    62
    then show "w = x" using \<open>k \<noteq> 0\<close> by simp
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    63
  qed
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    64
  show "w * y + x * z = w * z + x * y \<longleftrightarrow> w = x \<or> y = z"
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
    65
    by (auto simp add: neq_iff dest!: aux)
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    66
qed
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
    67
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 59557
diff changeset
    68
text \<open>Semiring normalization proper\<close>
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    69
69605
a96320074298 isabelle update -u path_cartouches;
wenzelm
parents: 69593
diff changeset
    70
ML_file \<open>Tools/semiring_normalizer.ML\<close>
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
    71
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    72
context comm_semiring_1
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    73
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
    74
70332
315489d836d8 avoid spammed sledgehammer proofs
haftmann
parents: 69605
diff changeset
    75
lemma semiring_normalization_rules [no_atp]:
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    76
  "(a * m) + (b * m) = (a + b) * m"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    77
  "(a * m) + m = (a + 1) * m"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    78
  "m + (a * m) = (a + 1) * m"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    79
  "m + m = (1 + 1) * m"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    80
  "0 + a = a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    81
  "a + 0 = a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    82
  "a * b = b * a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    83
  "(a + b) * c = (a * c) + (b * c)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    84
  "0 * a = 0"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    85
  "a * 0 = 0"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    86
  "1 * a = a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    87
  "a * 1 = a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    88
  "(lx * ly) * (rx * ry) = (lx * rx) * (ly * ry)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    89
  "(lx * ly) * (rx * ry) = lx * (ly * (rx * ry))"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    90
  "(lx * ly) * (rx * ry) = rx * ((lx * ly) * ry)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    91
  "(lx * ly) * rx = (lx * rx) * ly"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    92
  "(lx * ly) * rx = lx * (ly * rx)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    93
  "lx * (rx * ry) = (lx * rx) * ry"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    94
  "lx * (rx * ry) = rx * (lx * ry)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    95
  "(a + b) + (c + d) = (a + c) + (b + d)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    96
  "(a + b) + c = a + (b + c)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    97
  "a + (c + d) = c + (a + d)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    98
  "(a + b) + c = (a + c) + b"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
    99
  "a + c = c + a"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   100
  "a + (c + d) = (a + c) + d"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   101
  "(x ^ p) * (x ^ q) = x ^ (p + q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   102
  "x * (x ^ q) = x ^ (Suc q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   103
  "(x ^ q) * x = x ^ (Suc q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   104
  "x * x = x\<^sup>2"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   105
  "(x * y) ^ q = (x ^ q) * (y ^ q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   106
  "(x ^ p) ^ q = x ^ (p * q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   107
  "x ^ 0 = 1"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   108
  "x ^ 1 = x"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   109
  "x * (y + z) = (x * y) + (x * z)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   110
  "x ^ (Suc q) = x * (x ^ q)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   111
  "x ^ (2*n) = (x ^ n) * (x ^ n)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   112
  by (simp_all add: algebra_simps power_add power2_eq_square
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   113
    power_mult_distrib power_mult del: one_add_one)
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   114
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   115
local_setup \<open>
59554
4044f53326c9 inlined rules to free user-space from technical names
haftmann
parents: 59553
diff changeset
   116
  Semiring_Normalizer.declare @{thm comm_semiring_1_axioms}
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   117
    {semiring = ([\<^term>\<open>x + y\<close>, \<^term>\<open>x * y\<close>, \<^term>\<open>x ^ n\<close>, \<^term>\<open>0\<close>, \<^term>\<open>1\<close>],
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   118
      @{thms semiring_normalization_rules}),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   119
     ring = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   120
     field = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   121
     idom = [],
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   122
     ideal = []}
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   123
\<close>
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   124
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   125
end
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   126
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   127
context comm_ring_1
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   128
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   129
70332
315489d836d8 avoid spammed sledgehammer proofs
haftmann
parents: 69605
diff changeset
   130
lemma ring_normalization_rules [no_atp]:
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   131
  "- x = (- 1) * x"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   132
  "x - y = x + (- y)"
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   133
  by simp_all
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   134
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   135
local_setup \<open>
59554
4044f53326c9 inlined rules to free user-space from technical names
haftmann
parents: 59553
diff changeset
   136
  Semiring_Normalizer.declare @{thm comm_ring_1_axioms}
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   137
    {semiring = ([\<^term>\<open>x + y\<close>, \<^term>\<open>x * y\<close>, \<^term>\<open>x ^ n\<close>, \<^term>\<open>0\<close>, \<^term>\<open>1\<close>],
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   138
      @{thms semiring_normalization_rules}),
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   139
      ring = ([\<^term>\<open>x - y\<close>, \<^term>\<open>- x\<close>], @{thms ring_normalization_rules}),
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   140
      field = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   141
      idom = [],
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   142
      ideal = []}
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   143
\<close>
30866
dd5117e2d73e now deals with devision in fields
chaieb
parents: 30729
diff changeset
   144
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   145
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   146
36873
112e613e8d0b tuned proofs and fact and class names
haftmann
parents: 36872
diff changeset
   147
context comm_semiring_1_cancel_crossproduct
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   148
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   149
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   150
local_setup \<open>
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   151
  Semiring_Normalizer.declare @{thm comm_semiring_1_cancel_crossproduct_axioms}
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   152
    {semiring = ([\<^term>\<open>x + y\<close>, \<^term>\<open>x * y\<close>, \<^term>\<open>x ^ n\<close>, \<^term>\<open>0\<close>, \<^term>\<open>1\<close>],
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   153
      @{thms semiring_normalization_rules}),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   154
     ring = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   155
     field = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   156
     idom = @{thms crossproduct_noteq add_scale_eq_noteq},
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   157
     ideal = []}
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   158
\<close>
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   159
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   160
end
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   161
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   162
context idom
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   163
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   164
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   165
local_setup \<open>
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   166
  Semiring_Normalizer.declare @{thm idom_axioms}
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   167
   {semiring = ([\<^term>\<open>x + y\<close>, \<^term>\<open>x * y\<close>, \<^term>\<open>x ^ n\<close>, \<^term>\<open>0\<close>, \<^term>\<open>1\<close>],
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   168
      @{thms semiring_normalization_rules}),
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   169
    ring = ([\<^term>\<open>x - y\<close>, \<^term>\<open>- x\<close>], @{thms ring_normalization_rules}),
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   170
    field = ([], []),
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   171
    idom = @{thms crossproduct_noteq add_scale_eq_noteq},
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   172
    ideal = @{thms right_minus_eq add_0_iff}}
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   173
\<close>
23252
67268bb40b21 Semiring normalization and Groebner Bases.
wenzelm
parents:
diff changeset
   174
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   175
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   176
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   177
context field
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   178
begin
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   179
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   180
local_setup \<open>
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   181
  Semiring_Normalizer.declare @{thm field_axioms}
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   182
   {semiring = ([\<^term>\<open>x + y\<close>, \<^term>\<open>x * y\<close>, \<^term>\<open>x ^ n\<close>, \<^term>\<open>0\<close>, \<^term>\<open>1\<close>],
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   183
      @{thms semiring_normalization_rules}),
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   184
    ring = ([\<^term>\<open>x - y\<close>, \<^term>\<open>- x\<close>], @{thms ring_normalization_rules}),
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 66836
diff changeset
   185
    field = ([\<^term>\<open>x / y\<close>, \<^term>\<open>inverse x\<close>], @{thms divide_inverse inverse_eq_divide}),
61153
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   186
    idom = @{thms crossproduct_noteq add_scale_eq_noteq},
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   187
    ideal = @{thms right_minus_eq add_0_iff}}
3d5e01b427cb more standard local_theory operations;
wenzelm
parents: 60758
diff changeset
   188
\<close>
36756
c1ae8a0b4265 moved normalization proof tool infrastructure to canonical algebraic classes
haftmann
parents: 36753
diff changeset
   189
36871
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   190
end
3763c349c8c1 grouped local statements
haftmann
parents: 36845
diff changeset
   191
52435
6646bb548c6b migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents: 48891
diff changeset
   192
code_identifier
6646bb548c6b migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents: 48891
diff changeset
   193
  code_module Semiring_Normalization \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 37946
diff changeset
   194
28402
09e4aa3ddc25 clarified dependencies between arith tools
haftmann
parents: 27666
diff changeset
   195
end