author | wenzelm |
Sat, 20 Jun 2015 16:31:44 +0200 | |
changeset 60533 | 1e7ccd864b62 |
parent 58889 | 5b7a9633cfa8 |
child 60534 | b2add2b08412 |
permissions | -rw-r--r-- |
28952
15a4b2cf8c34
made repository layout more coherent with logical distribution structure; stripped some $Id$s
haftmann
parents:
27487
diff
changeset
|
1 |
(* Author: Bernhard Haeupler |
17516 | 2 |
|
3 |
Proving equalities in commutative rings done "right" in Isabelle/HOL. |
|
4 |
*) |
|
5 |
||
60533 | 6 |
section \<open>Proving equalities in commutative rings\<close> |
17516 | 7 |
|
8 |
theory Commutative_Ring |
|
58770 | 9 |
imports Main |
17516 | 10 |
begin |
11 |
||
60533 | 12 |
text \<open>Syntax of multivariate polynomials (pol) and polynomial expressions.\<close> |
17516 | 13 |
|
58310 | 14 |
datatype 'a pol = |
17516 | 15 |
Pc 'a |
16 |
| Pinj nat "'a pol" |
|
17 |
| PX "'a pol" nat "'a pol" |
|
18 |
||
58310 | 19 |
datatype 'a polex = |
20622 | 20 |
Pol "'a pol" |
17516 | 21 |
| Add "'a polex" "'a polex" |
22 |
| Sub "'a polex" "'a polex" |
|
23 |
| Mul "'a polex" "'a polex" |
|
24 |
| Pow "'a polex" nat |
|
25 |
| Neg "'a polex" |
|
26 |
||
60533 | 27 |
text \<open>Interpretation functions for the shadow syntax.\<close> |
17516 | 28 |
|
55754 | 29 |
primrec Ipol :: "'a::{comm_ring_1} list \<Rightarrow> 'a pol \<Rightarrow> 'a" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
30 |
where |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
31 |
"Ipol l (Pc c) = c" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
32 |
| "Ipol l (Pinj i P) = Ipol (drop i l) P" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
33 |
| "Ipol l (PX P x Q) = Ipol l P * (hd l)^x + Ipol (drop 1 l) Q" |
17516 | 34 |
|
55754 | 35 |
primrec Ipolex :: "'a::{comm_ring_1} list \<Rightarrow> 'a polex \<Rightarrow> 'a" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
36 |
where |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
37 |
"Ipolex l (Pol P) = Ipol l P" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
38 |
| "Ipolex l (Add P Q) = Ipolex l P + Ipolex l Q" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
39 |
| "Ipolex l (Sub P Q) = Ipolex l P - Ipolex l Q" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
40 |
| "Ipolex l (Mul P Q) = Ipolex l P * Ipolex l Q" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
41 |
| "Ipolex l (Pow p n) = Ipolex l p ^ n" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
42 |
| "Ipolex l (Neg P) = - Ipolex l P" |
17516 | 43 |
|
60533 | 44 |
text \<open>Create polynomial normalized polynomials given normalized inputs.\<close> |
17516 | 45 |
|
55754 | 46 |
definition mkPinj :: "nat \<Rightarrow> 'a pol \<Rightarrow> 'a pol" |
47 |
where |
|
19736 | 48 |
"mkPinj x P = (case P of |
17516 | 49 |
Pc c \<Rightarrow> Pc c | |
50 |
Pinj y P \<Rightarrow> Pinj (x + y) P | |
|
51 |
PX p1 y p2 \<Rightarrow> Pinj x P)" |
|
52 |
||
55754 | 53 |
definition mkPX :: "'a::comm_ring pol \<Rightarrow> nat \<Rightarrow> 'a pol \<Rightarrow> 'a pol" |
54 |
where |
|
55 |
"mkPX P i Q = |
|
56 |
(case P of |
|
57 |
Pc c \<Rightarrow> if c = 0 then mkPinj 1 Q else PX P i Q |
|
58 |
| Pinj j R \<Rightarrow> PX P i Q |
|
59 |
| PX P2 i2 Q2 \<Rightarrow> if Q2 = Pc 0 then PX P2 (i + i2) Q else PX P i Q)" |
|
17516 | 60 |
|
60533 | 61 |
text \<open>Defining the basic ring operations on normalized polynomials\<close> |
17516 | 62 |
|
58259 | 63 |
lemma pol_size_nz[simp]: "size (p :: 'a pol) \<noteq> 0" |
64 |
by (cases p) simp_all |
|
65 |
||
55754 | 66 |
function add :: "'a::comm_ring pol \<Rightarrow> 'a pol \<Rightarrow> 'a pol" (infixl "\<oplus>" 65) |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
67 |
where |
55754 | 68 |
"Pc a \<oplus> Pc b = Pc (a + b)" |
69 |
| "Pc c \<oplus> Pinj i P = Pinj i (P \<oplus> Pc c)" |
|
70 |
| "Pinj i P \<oplus> Pc c = Pinj i (P \<oplus> Pc c)" |
|
71 |
| "Pc c \<oplus> PX P i Q = PX P i (Q \<oplus> Pc c)" |
|
72 |
| "PX P i Q \<oplus> Pc c = PX P i (Q \<oplus> Pc c)" |
|
73 |
| "Pinj x P \<oplus> Pinj y Q = |
|
74 |
(if x = y then mkPinj x (P \<oplus> Q) |
|
75 |
else (if x > y then mkPinj y (Pinj (x - y) P \<oplus> Q) |
|
76 |
else mkPinj x (Pinj (y - x) Q \<oplus> P)))" |
|
77 |
| "Pinj x P \<oplus> PX Q y R = |
|
78 |
(if x = 0 then P \<oplus> PX Q y R |
|
79 |
else (if x = 1 then PX Q y (R \<oplus> P) |
|
80 |
else PX Q y (R \<oplus> Pinj (x - 1) P)))" |
|
81 |
| "PX P x R \<oplus> Pinj y Q = |
|
82 |
(if y = 0 then PX P x R \<oplus> Q |
|
83 |
else (if y = 1 then PX P x (R \<oplus> Q) |
|
84 |
else PX P x (R \<oplus> Pinj (y - 1) Q)))" |
|
85 |
| "PX P1 x P2 \<oplus> PX Q1 y Q2 = |
|
86 |
(if x = y then mkPX (P1 \<oplus> Q1) x (P2 \<oplus> Q2) |
|
87 |
else (if x > y then mkPX (PX P1 (x - y) (Pc 0) \<oplus> Q1) y (P2 \<oplus> Q2) |
|
88 |
else mkPX (PX Q1 (y-x) (Pc 0) \<oplus> P1) x (P2 \<oplus> Q2)))" |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
89 |
by pat_completeness auto |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
90 |
termination by (relation "measure (\<lambda>(x, y). size x + size y)") auto |
17516 | 91 |
|
55754 | 92 |
function mul :: "'a::{comm_ring} pol \<Rightarrow> 'a pol \<Rightarrow> 'a pol" (infixl "\<otimes>" 70) |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
93 |
where |
55754 | 94 |
"Pc a \<otimes> Pc b = Pc (a * b)" |
95 |
| "Pc c \<otimes> Pinj i P = |
|
96 |
(if c = 0 then Pc 0 else mkPinj i (P \<otimes> Pc c))" |
|
97 |
| "Pinj i P \<otimes> Pc c = |
|
98 |
(if c = 0 then Pc 0 else mkPinj i (P \<otimes> Pc c))" |
|
99 |
| "Pc c \<otimes> PX P i Q = |
|
100 |
(if c = 0 then Pc 0 else mkPX (P \<otimes> Pc c) i (Q \<otimes> Pc c))" |
|
101 |
| "PX P i Q \<otimes> Pc c = |
|
102 |
(if c = 0 then Pc 0 else mkPX (P \<otimes> Pc c) i (Q \<otimes> Pc c))" |
|
103 |
| "Pinj x P \<otimes> Pinj y Q = |
|
104 |
(if x = y then mkPinj x (P \<otimes> Q) else |
|
105 |
(if x > y then mkPinj y (Pinj (x-y) P \<otimes> Q) |
|
106 |
else mkPinj x (Pinj (y - x) Q \<otimes> P)))" |
|
107 |
| "Pinj x P \<otimes> PX Q y R = |
|
108 |
(if x = 0 then P \<otimes> PX Q y R else |
|
109 |
(if x = 1 then mkPX (Pinj x P \<otimes> Q) y (R \<otimes> P) |
|
110 |
else mkPX (Pinj x P \<otimes> Q) y (R \<otimes> Pinj (x - 1) P)))" |
|
111 |
| "PX P x R \<otimes> Pinj y Q = |
|
112 |
(if y = 0 then PX P x R \<otimes> Q else |
|
113 |
(if y = 1 then mkPX (Pinj y Q \<otimes> P) x (R \<otimes> Q) |
|
114 |
else mkPX (Pinj y Q \<otimes> P) x (R \<otimes> Pinj (y - 1) Q)))" |
|
115 |
| "PX P1 x P2 \<otimes> PX Q1 y Q2 = |
|
116 |
mkPX (P1 \<otimes> Q1) (x + y) (P2 \<otimes> Q2) \<oplus> |
|
117 |
(mkPX (P1 \<otimes> mkPinj 1 Q2) x (Pc 0) \<oplus> |
|
118 |
(mkPX (Q1 \<otimes> mkPinj 1 P2) y (Pc 0)))" |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
119 |
by pat_completeness auto |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
120 |
termination by (relation "measure (\<lambda>(x, y). size x + size y)") |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
121 |
(auto simp add: mkPinj_def split: pol.split) |
17516 | 122 |
|
60533 | 123 |
text \<open>Negation\<close> |
55754 | 124 |
primrec neg :: "'a::{comm_ring} pol \<Rightarrow> 'a pol" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
125 |
where |
55754 | 126 |
"neg (Pc c) = Pc (-c)" |
127 |
| "neg (Pinj i P) = Pinj i (neg P)" |
|
128 |
| "neg (PX P x Q) = PX (neg P) x (neg Q)" |
|
17516 | 129 |
|
60533 | 130 |
text \<open>Substraction\<close> |
55754 | 131 |
definition sub :: "'a::{comm_ring} pol \<Rightarrow> 'a pol \<Rightarrow> 'a pol" (infixl "\<ominus>" 65) |
132 |
where "sub P Q = P \<oplus> neg Q" |
|
17516 | 133 |
|
60533 | 134 |
text \<open>Square for Fast Exponentation\<close> |
55754 | 135 |
primrec sqr :: "'a::{comm_ring_1} pol \<Rightarrow> 'a pol" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
136 |
where |
55754 | 137 |
"sqr (Pc c) = Pc (c * c)" |
138 |
| "sqr (Pinj i P) = mkPinj i (sqr P)" |
|
139 |
| "sqr (PX A x B) = |
|
140 |
mkPX (sqr A) (x + x) (sqr B) \<oplus> mkPX (Pc (1 + 1) \<otimes> A \<otimes> mkPinj 1 B) x (Pc 0)" |
|
17516 | 141 |
|
60533 | 142 |
text \<open>Fast Exponentation\<close> |
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58310
diff
changeset
|
143 |
|
55754 | 144 |
fun pow :: "nat \<Rightarrow> 'a::{comm_ring_1} pol \<Rightarrow> 'a pol" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
145 |
where |
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58310
diff
changeset
|
146 |
pow_if [simp del]: "pow n P = |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
147 |
(if n = 0 then Pc 1 else if even n then pow (n div 2) (sqr P) |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
148 |
else P \<otimes> pow (n div 2) (sqr P))" |
17516 | 149 |
|
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58310
diff
changeset
|
150 |
lemma pow_simps [simp]: |
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58310
diff
changeset
|
151 |
"pow 0 P = Pc 1" |
58712 | 152 |
"pow (2 * n) P = pow n (sqr P)" |
153 |
"pow (Suc (2 * n)) P = P \<otimes> pow n (sqr P)" |
|
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58310
diff
changeset
|
154 |
by (simp_all add: pow_if) |
17516 | 155 |
|
58712 | 156 |
lemma even_pow: |
157 |
"even n \<Longrightarrow> pow n P = pow (n div 2) (sqr P)" |
|
158 |
by (erule evenE) simp |
|
159 |
||
160 |
lemma odd_pow: |
|
161 |
"odd n \<Longrightarrow> pow n P = P \<otimes> pow (n div 2) (sqr P)" |
|
162 |
by (erule oddE) simp |
|
163 |
||
164 |
||
60533 | 165 |
text \<open>Normalization of polynomial expressions\<close> |
17516 | 166 |
|
55754 | 167 |
primrec norm :: "'a::{comm_ring_1} polex \<Rightarrow> 'a pol" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
168 |
where |
55754 | 169 |
"norm (Pol P) = P" |
170 |
| "norm (Add P Q) = norm P \<oplus> norm Q" |
|
171 |
| "norm (Sub P Q) = norm P \<ominus> norm Q" |
|
172 |
| "norm (Mul P Q) = norm P \<otimes> norm Q" |
|
173 |
| "norm (Pow P n) = pow n (norm P)" |
|
174 |
| "norm (Neg P) = neg (norm P)" |
|
17516 | 175 |
|
60533 | 176 |
text \<open>mkPinj preserve semantics\<close> |
17516 | 177 |
lemma mkPinj_ci: "Ipol l (mkPinj a B) = Ipol l (Pinj a B)" |
29667 | 178 |
by (induct B) (auto simp add: mkPinj_def algebra_simps) |
17516 | 179 |
|
60533 | 180 |
text \<open>mkPX preserves semantics\<close> |
17516 | 181 |
lemma mkPX_ci: "Ipol l (mkPX A b C) = Ipol l (PX A b C)" |
29667 | 182 |
by (cases A) (auto simp add: mkPX_def mkPinj_ci power_add algebra_simps) |
17516 | 183 |
|
60533 | 184 |
text \<open>Correctness theorems for the implemented operations\<close> |
17516 | 185 |
|
60533 | 186 |
text \<open>Negation\<close> |
20622 | 187 |
lemma neg_ci: "Ipol l (neg P) = -(Ipol l P)" |
188 |
by (induct P arbitrary: l) auto |
|
17516 | 189 |
|
60533 | 190 |
text \<open>Addition\<close> |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
191 |
lemma add_ci: "Ipol l (P \<oplus> Q) = Ipol l P + Ipol l Q" |
20622 | 192 |
proof (induct P Q arbitrary: l rule: add.induct) |
17516 | 193 |
case (6 x P y Q) |
194 |
show ?case |
|
195 |
proof (rule linorder_cases) |
|
196 |
assume "x < y" |
|
29667 | 197 |
with 6 show ?case by (simp add: mkPinj_ci algebra_simps) |
17516 | 198 |
next |
199 |
assume "x = y" |
|
200 |
with 6 show ?case by (simp add: mkPinj_ci) |
|
201 |
next |
|
202 |
assume "x > y" |
|
29667 | 203 |
with 6 show ?case by (simp add: mkPinj_ci algebra_simps) |
17516 | 204 |
qed |
205 |
next |
|
206 |
case (7 x P Q y R) |
|
207 |
have "x = 0 \<or> x = 1 \<or> x > 1" by arith |
|
208 |
moreover |
|
209 |
{ assume "x = 0" with 7 have ?case by simp } |
|
210 |
moreover |
|
29667 | 211 |
{ assume "x = 1" with 7 have ?case by (simp add: algebra_simps) } |
17516 | 212 |
moreover |
213 |
{ assume "x > 1" from 7 have ?case by (cases x) simp_all } |
|
214 |
ultimately show ?case by blast |
|
215 |
next |
|
216 |
case (8 P x R y Q) |
|
217 |
have "y = 0 \<or> y = 1 \<or> y > 1" by arith |
|
218 |
moreover |
|
219 |
{ assume "y = 0" with 8 have ?case by simp } |
|
220 |
moreover |
|
221 |
{ assume "y = 1" with 8 have ?case by simp } |
|
222 |
moreover |
|
223 |
{ assume "y > 1" with 8 have ?case by simp } |
|
224 |
ultimately show ?case by blast |
|
225 |
next |
|
226 |
case (9 P1 x P2 Q1 y Q2) |
|
227 |
show ?case |
|
228 |
proof (rule linorder_cases) |
|
229 |
assume a: "x < y" hence "EX d. d + x = y" by arith |
|
29667 | 230 |
with 9 a show ?case by (auto simp add: mkPX_ci power_add algebra_simps) |
17516 | 231 |
next |
232 |
assume a: "y < x" hence "EX d. d + y = x" by arith |
|
29667 | 233 |
with 9 a show ?case by (auto simp add: power_add mkPX_ci algebra_simps) |
17516 | 234 |
next |
235 |
assume "x = y" |
|
29667 | 236 |
with 9 show ?case by (simp add: mkPX_ci algebra_simps) |
17516 | 237 |
qed |
29667 | 238 |
qed (auto simp add: algebra_simps) |
17516 | 239 |
|
60533 | 240 |
text \<open>Multiplication\<close> |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
241 |
lemma mul_ci: "Ipol l (P \<otimes> Q) = Ipol l P * Ipol l Q" |
20622 | 242 |
by (induct P Q arbitrary: l rule: mul.induct) |
29667 | 243 |
(simp_all add: mkPX_ci mkPinj_ci algebra_simps add_ci power_add) |
17516 | 244 |
|
60533 | 245 |
text \<open>Substraction\<close> |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
246 |
lemma sub_ci: "Ipol l (P \<ominus> Q) = Ipol l P - Ipol l Q" |
17516 | 247 |
by (simp add: add_ci neg_ci sub_def) |
248 |
||
60533 | 249 |
text \<open>Square\<close> |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
250 |
lemma sqr_ci: "Ipol ls (sqr P) = Ipol ls P * Ipol ls P" |
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
251 |
by (induct P arbitrary: ls) |
29667 | 252 |
(simp_all add: add_ci mkPinj_ci mkPX_ci mul_ci algebra_simps power_add) |
17516 | 253 |
|
60533 | 254 |
text \<open>Power\<close> |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
22665
diff
changeset
|
255 |
lemma pow_ci: "Ipol ls (pow n P) = Ipol ls P ^ n" |
58712 | 256 |
proof (induct n arbitrary: P rule: less_induct) |
257 |
case (less k) |
|
17516 | 258 |
show ?case |
58712 | 259 |
proof (cases "k = 0") |
260 |
case True then show ?thesis by simp |
|
20622 | 261 |
next |
58712 | 262 |
case False then have "k > 0" by simp |
263 |
then have "k div 2 < k" by arith |
|
264 |
with less have *: "Ipol ls (pow (k div 2) (sqr P)) = Ipol ls (sqr P) ^ (k div 2)" |
|
265 |
by simp |
|
17516 | 266 |
show ?thesis |
58712 | 267 |
proof (cases "even k") |
268 |
case True with * show ?thesis |
|
269 |
by (simp add: even_pow sqr_ci power_mult_distrib power_add [symmetric] mult_2 [symmetric] even_two_times_div_two) |
|
17516 | 270 |
next |
58712 | 271 |
case False with * show ?thesis |
58834 | 272 |
by (simp add: odd_pow mul_ci sqr_ci power_mult_distrib power_add [symmetric] mult_2 [symmetric] power_Suc [symmetric]) |
17516 | 273 |
qed |
274 |
qed |
|
275 |
qed |
|
276 |
||
60533 | 277 |
text \<open>Normalization preserves semantics\<close> |
20622 | 278 |
lemma norm_ci: "Ipolex l Pe = Ipol l (norm Pe)" |
17516 | 279 |
by (induct Pe) (simp_all add: add_ci sub_ci mul_ci neg_ci pow_ci) |
280 |
||
60533 | 281 |
text \<open>Reflection lemma: Key to the (incomplete) decision procedure\<close> |
17516 | 282 |
lemma norm_eq: |
20622 | 283 |
assumes "norm P1 = norm P2" |
17516 | 284 |
shows "Ipolex l P1 = Ipolex l P2" |
285 |
proof - |
|
41807 | 286 |
from assms have "Ipol l (norm P1) = Ipol l (norm P2)" by simp |
20622 | 287 |
then show ?thesis by (simp only: norm_ci) |
17516 | 288 |
qed |
289 |
||
290 |
||
48891 | 291 |
ML_file "commutative_ring_tac.ML" |
47432 | 292 |
|
60533 | 293 |
method_setup comm_ring = \<open> |
47432 | 294 |
Scan.succeed (SIMPLE_METHOD' o Commutative_Ring_Tac.tac) |
60533 | 295 |
\<close> "reflective decision procedure for equalities over commutative rings" |
17516 | 296 |
|
297 |
end |