author | traytel |
Fri, 28 Feb 2014 17:54:52 +0100 | |
changeset 55811 | aa1acc25126b |
parent 55793 | 52c8f934ea6f |
child 58259 | 52c35a59bbf5 |
permissions | -rw-r--r-- |
31021 | 1 |
(* Author: Bernhard Haeupler |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
2 |
|
17388 | 3 |
This theory is about of the relative completeness of method comm-ring |
4 |
method. As long as the reified atomic polynomials of type 'a pol are |
|
5 |
in normal form, the cring method is complete. |
|
6 |
*) |
|
7 |
||
8 |
header {* Proof of the relative completeness of method comm-ring *} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
9 |
|
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
10 |
theory Commutative_Ring_Complete |
17508 | 11 |
imports Commutative_Ring |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
12 |
begin |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
13 |
|
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
14 |
text {* Formalization of normal form *} |
44779 | 15 |
fun isnorm :: "'a::comm_ring pol \<Rightarrow> bool" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
16 |
where |
55754 | 17 |
"isnorm (Pc c) \<longleftrightarrow> True" |
18 |
| "isnorm (Pinj i (Pc c)) \<longleftrightarrow> False" |
|
19 |
| "isnorm (Pinj i (Pinj j Q)) \<longleftrightarrow> False" |
|
20 |
| "isnorm (Pinj 0 P) \<longleftrightarrow> False" |
|
21 |
| "isnorm (Pinj i (PX Q1 j Q2)) \<longleftrightarrow> isnorm (PX Q1 j Q2)" |
|
22 |
| "isnorm (PX P 0 Q) \<longleftrightarrow> False" |
|
23 |
| "isnorm (PX (Pc c) i Q) \<longleftrightarrow> c \<noteq> 0 \<and> isnorm Q" |
|
24 |
| "isnorm (PX (PX P1 j (Pc c)) i Q) \<longleftrightarrow> c \<noteq> 0 \<and> isnorm (PX P1 j (Pc c)) \<and> isnorm Q" |
|
25 |
| "isnorm (PX P i Q) \<longleftrightarrow> isnorm P \<and> isnorm Q" |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
26 |
|
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
27 |
(* Some helpful lemmas *) |
44779 | 28 |
lemma norm_Pinj_0_False: "isnorm (Pinj 0 P) = False" |
29 |
by (cases P) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
30 |
|
44779 | 31 |
lemma norm_PX_0_False: "isnorm (PX (Pc 0) i Q) = False" |
32 |
by (cases i) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
33 |
|
44779 | 34 |
lemma norm_Pinj: "isnorm (Pinj i Q) \<Longrightarrow> isnorm Q" |
35 |
by (cases i) (simp add: norm_Pinj_0_False norm_PX_0_False, cases Q, auto) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
36 |
|
44779 | 37 |
lemma norm_PX2: "isnorm (PX P i Q) \<Longrightarrow> isnorm Q" |
55754 | 38 |
apply (cases i) |
39 |
apply auto |
|
40 |
apply (cases P) |
|
41 |
apply auto |
|
42 |
apply (case_tac pol2) |
|
43 |
apply auto |
|
44 |
done |
|
44779 | 45 |
|
46 |
lemma norm_PX1: "isnorm (PX P i Q) \<Longrightarrow> isnorm P" |
|
55754 | 47 |
apply (cases i) |
48 |
apply auto |
|
49 |
apply (cases P) |
|
50 |
apply auto |
|
51 |
apply (case_tac pol2) |
|
52 |
apply auto |
|
53 |
done |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
54 |
|
55754 | 55 |
lemma mkPinj_cn: "y \<noteq> 0 \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (mkPinj y Q)" |
44779 | 56 |
apply (auto simp add: mkPinj_def norm_Pinj_0_False split: pol.split) |
57 |
apply (case_tac nat, auto simp add: norm_Pinj_0_False) |
|
58 |
apply (case_tac pol, auto) |
|
59 |
apply (case_tac y, auto) |
|
60 |
done |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
61 |
|
55793 | 62 |
lemma norm_PXtrans: |
55754 | 63 |
assumes A: "isnorm (PX P x Q)" |
55793 | 64 |
and "isnorm Q2" |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
65 |
shows "isnorm (PX P x Q2)" |
44779 | 66 |
proof (cases P) |
67 |
case (PX p1 y p2) |
|
55754 | 68 |
with assms show ?thesis |
69 |
apply (cases x) |
|
70 |
apply auto |
|
71 |
apply (cases p2) |
|
72 |
apply auto |
|
73 |
done |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
74 |
next |
44779 | 75 |
case Pc |
76 |
with assms show ?thesis by (cases x) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
77 |
next |
44779 | 78 |
case Pinj |
79 |
with assms show ?thesis by (cases x) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
80 |
qed |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
81 |
|
55793 | 82 |
lemma norm_PXtrans2: |
83 |
assumes "isnorm (PX P x Q)" |
|
84 |
and "isnorm Q2" |
|
85 |
shows "isnorm (PX P (Suc (n + x)) Q2)" |
|
86 |
proof (cases P) |
|
87 |
case (PX p1 y p2) |
|
88 |
with assms show ?thesis |
|
89 |
apply (cases x) |
|
90 |
apply auto |
|
91 |
apply (cases p2) |
|
92 |
apply auto |
|
93 |
done |
|
94 |
next |
|
95 |
case Pc |
|
96 |
with assms show ?thesis |
|
97 |
by (cases x) auto |
|
98 |
next |
|
99 |
case Pinj |
|
100 |
with assms show ?thesis |
|
101 |
by (cases x) auto |
|
102 |
qed |
|
103 |
||
23266 | 104 |
text {* mkPX conserves normalizedness (@{text "_cn"}) *} |
55793 | 105 |
lemma mkPX_cn: |
55754 | 106 |
assumes "x \<noteq> 0" |
107 |
and "isnorm P" |
|
55793 | 108 |
and "isnorm Q" |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
109 |
shows "isnorm (mkPX P x Q)" |
55754 | 110 |
proof (cases P) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
111 |
case (Pc c) |
55754 | 112 |
with assms show ?thesis |
113 |
by (cases x) (auto simp add: mkPinj_cn mkPX_def) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
114 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
115 |
case (Pinj i Q) |
55754 | 116 |
with assms show ?thesis |
117 |
by (cases x) (auto simp add: mkPinj_cn mkPX_def) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
118 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
119 |
case (PX P1 y P2) |
55793 | 120 |
with assms have Y0: "y > 0" |
121 |
by (cases y) auto |
|
41807 | 122 |
from assms PX have "isnorm P1" "isnorm P2" |
123 |
by (auto simp add: norm_PX1[of P1 y P2] norm_PX2[of P1 y P2]) |
|
124 |
from assms PX Y0 show ?thesis |
|
44779 | 125 |
by (cases x) (auto simp add: mkPX_def norm_PXtrans2[of P1 y _ Q _], cases P2, auto) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
126 |
qed |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
127 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
128 |
text {* add conserves normalizedness *} |
44779 | 129 |
lemma add_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<oplus> Q)" |
130 |
proof (induct P Q rule: add.induct) |
|
131 |
case (2 c i P2) |
|
55793 | 132 |
then show ?case |
133 |
by (cases P2) (simp_all, cases i, simp_all) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
134 |
next |
44779 | 135 |
case (3 i P2 c) |
55793 | 136 |
then show ?case |
137 |
by (cases P2) (simp_all, cases i, simp_all) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
138 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
139 |
case (4 c P2 i Q2) |
44779 | 140 |
then have "isnorm P2" "isnorm Q2" |
141 |
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2]) |
|
142 |
with 4 show ?case |
|
143 |
by (cases i) (simp, cases P2, auto, case_tac pol2, auto) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
144 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
145 |
case (5 P2 i Q2 c) |
44779 | 146 |
then have "isnorm P2" "isnorm Q2" |
147 |
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2]) |
|
148 |
with 5 show ?case |
|
149 |
by (cases i) (simp, cases P2, auto, case_tac pol2, auto) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
150 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
151 |
case (6 x P2 y Q2) |
55793 | 152 |
then have Y0: "y > 0" |
153 |
by (cases y) (auto simp add: norm_Pinj_0_False) |
|
154 |
with 6 have X0: "x > 0" |
|
155 |
by (cases x) (auto simp add: norm_Pinj_0_False) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
156 |
have "x < y \<or> x = y \<or> x > y" by arith |
55793 | 157 |
moreover { |
158 |
assume "x < y" |
|
55754 | 159 |
then have "\<exists>d. y = d + x" by arith |
41807 | 160 |
then obtain d where y: "y = d + x" .. |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
161 |
moreover |
41807 | 162 |
note 6 X0 |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
163 |
moreover |
44779 | 164 |
from 6 have "isnorm P2" "isnorm Q2" |
165 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
166 |
moreover |
44779 | 167 |
from 6 `x < y` y have "isnorm (Pinj d Q2)" |
168 |
by (cases d, simp, cases Q2, auto) |
|
55793 | 169 |
ultimately have ?case by (simp add: mkPinj_cn) |
170 |
} |
|
171 |
moreover { |
|
172 |
assume "x = y" |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
173 |
moreover |
44779 | 174 |
from 6 have "isnorm P2" "isnorm Q2" |
175 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
176 |
moreover |
41807 | 177 |
note 6 Y0 |
55793 | 178 |
ultimately have ?case by (simp add: mkPinj_cn) |
179 |
} |
|
180 |
moreover { |
|
181 |
assume "x > y" |
|
182 |
then have "\<exists>d. x = d + y" |
|
183 |
by arith |
|
184 |
then obtain d where x: "x = d + y" .. |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
185 |
moreover |
41807 | 186 |
note 6 Y0 |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
187 |
moreover |
44779 | 188 |
from 6 have "isnorm P2" "isnorm Q2" |
189 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
190 |
moreover |
44779 | 191 |
from 6 `x > y` x have "isnorm (Pinj d P2)" |
192 |
by (cases d) (simp, cases P2, auto) |
|
55793 | 193 |
ultimately have ?case by (simp add: mkPinj_cn) |
194 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
195 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
196 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
197 |
case (7 x P2 Q2 y R) |
44779 | 198 |
have "x = 0 \<or> x = 1 \<or> x > 1" by arith |
55793 | 199 |
moreover { |
200 |
assume "x = 0" |
|
201 |
with 7 have ?case by (auto simp add: norm_Pinj_0_False) |
|
202 |
} |
|
203 |
moreover { |
|
204 |
assume "x = 1" |
|
44779 | 205 |
from 7 have "isnorm R" "isnorm P2" |
206 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
41807 | 207 |
with 7 `x = 1` have "isnorm (R \<oplus> P2)" by simp |
44779 | 208 |
with 7 `x = 1` have ?case |
55793 | 209 |
by (simp add: norm_PXtrans[of Q2 y _]) |
210 |
} |
|
211 |
moreover { |
|
212 |
assume "x > 1" then have "\<exists>d. x=Suc (Suc d)" by arith |
|
44779 | 213 |
then obtain d where X: "x=Suc (Suc d)" .. |
41807 | 214 |
with 7 have NR: "isnorm R" "isnorm P2" |
215 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
216 |
with 7 X have "isnorm (Pinj (x - 1) P2)" by (cases P2) auto |
|
217 |
with 7 X NR have "isnorm (R \<oplus> Pinj (x - 1) P2)" by simp |
|
44779 | 218 |
with `isnorm (PX Q2 y R)` X have ?case |
55793 | 219 |
by (simp add: norm_PXtrans[of Q2 y _]) |
220 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
221 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
222 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
223 |
case (8 Q2 y R x P2) |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
224 |
have "x = 0 \<or> x = 1 \<or> x > 1" by arith |
55793 | 225 |
moreover { |
226 |
assume "x = 0" |
|
227 |
with 8 have ?case |
|
228 |
by (auto simp add: norm_Pinj_0_False) |
|
229 |
} |
|
230 |
moreover { |
|
231 |
assume "x = 1" |
|
232 |
with 8 have "isnorm R" "isnorm P2" |
|
233 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
234 |
with 8 `x = 1` have "isnorm (R \<oplus> P2)" |
|
235 |
by simp |
|
236 |
with 8 `x = 1` have ?case |
|
237 |
by (simp add: norm_PXtrans[of Q2 y _]) |
|
238 |
} |
|
239 |
moreover { |
|
240 |
assume "x > 1" |
|
241 |
then have "\<exists>d. x = Suc (Suc d)" by arith |
|
41807 | 242 |
then obtain d where X: "x = Suc (Suc d)" .. |
243 |
with 8 have NR: "isnorm R" "isnorm P2" |
|
244 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
55793 | 245 |
with 8 X have "isnorm (Pinj (x - 1) P2)" |
246 |
by (cases P2) auto |
|
247 |
with 8 `x > 1` NR have "isnorm (R \<oplus> Pinj (x - 1) P2)" |
|
248 |
by simp |
|
249 |
with `isnorm (PX Q2 y R)` X have ?case |
|
250 |
by (simp add: norm_PXtrans[of Q2 y _]) |
|
251 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
252 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
253 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
254 |
case (9 P1 x P2 Q1 y Q2) |
55793 | 255 |
then have Y0: "y > 0" by (cases y) auto |
256 |
with 9 have X0: "x > 0" by (cases x) auto |
|
41807 | 257 |
with 9 have NP1: "isnorm P1" and NP2: "isnorm P2" |
258 |
by (auto simp add: norm_PX1[of P1 _ P2] norm_PX2[of P1 _ P2]) |
|
44779 | 259 |
with 9 have NQ1: "isnorm Q1" and NQ2: "isnorm Q2" |
41807 | 260 |
by (auto simp add: norm_PX1[of Q1 _ Q2] norm_PX2[of Q1 _ Q2]) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
261 |
have "y < x \<or> x = y \<or> x < y" by arith |
55793 | 262 |
moreover { |
263 |
assume sm1: "y < x" |
|
264 |
then have "\<exists>d. x = d + y" by arith |
|
41807 | 265 |
then obtain d where sm2: "x = d + y" .. |
266 |
note 9 NQ1 NP1 NP2 NQ2 sm1 sm2 |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
267 |
moreover |
55793 | 268 |
have "isnorm (PX P1 d (Pc 0))" |
41807 | 269 |
proof (cases P1) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
270 |
case (PX p1 y p2) |
55793 | 271 |
with 9 sm1 sm2 show ?thesis |
272 |
by (cases d) (simp, cases p2, auto) |
|
41807 | 273 |
next |
55793 | 274 |
case Pc |
275 |
with 9 sm1 sm2 show ?thesis |
|
276 |
by (cases d) auto |
|
41807 | 277 |
next |
55793 | 278 |
case Pinj |
279 |
with 9 sm1 sm2 show ?thesis |
|
280 |
by (cases d) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
281 |
qed |
55793 | 282 |
ultimately have "isnorm (P2 \<oplus> Q2)" "isnorm (PX P1 (x - y) (Pc 0) \<oplus> Q1)" |
283 |
by auto |
|
284 |
with Y0 sm1 sm2 have ?case |
|
285 |
by (simp add: mkPX_cn) |
|
286 |
} |
|
287 |
moreover { |
|
288 |
assume "x = y" |
|
289 |
with 9 NP1 NP2 NQ1 NQ2 have "isnorm (P2 \<oplus> Q2)" "isnorm (P1 \<oplus> Q1)" |
|
290 |
by auto |
|
291 |
with `x = y` Y0 have ?case |
|
292 |
by (simp add: mkPX_cn) |
|
293 |
} |
|
294 |
moreover { |
|
295 |
assume sm1: "x < y" |
|
296 |
then have "\<exists>d. y = d + x" by arith |
|
41807 | 297 |
then obtain d where sm2: "y = d + x" .. |
298 |
note 9 NQ1 NP1 NP2 NQ2 sm1 sm2 |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
299 |
moreover |
55793 | 300 |
have "isnorm (PX Q1 d (Pc 0))" |
41807 | 301 |
proof (cases Q1) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
302 |
case (PX p1 y p2) |
55793 | 303 |
with 9 sm1 sm2 show ?thesis |
304 |
by (cases d) (simp, cases p2, auto) |
|
41807 | 305 |
next |
55793 | 306 |
case Pc |
307 |
with 9 sm1 sm2 show ?thesis |
|
308 |
by (cases d) auto |
|
41807 | 309 |
next |
55793 | 310 |
case Pinj |
311 |
with 9 sm1 sm2 show ?thesis |
|
312 |
by (cases d) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
313 |
qed |
55793 | 314 |
ultimately have "isnorm (P2 \<oplus> Q2)" "isnorm (PX Q1 (y - x) (Pc 0) \<oplus> P1)" |
315 |
by auto |
|
316 |
with X0 sm1 sm2 have ?case |
|
317 |
by (simp add: mkPX_cn) |
|
318 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
319 |
ultimately show ?case by blast |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
320 |
qed simp |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
321 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
322 |
text {* mul concerves normalizedness *} |
44779 | 323 |
lemma mul_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<otimes> Q)" |
324 |
proof (induct P Q rule: mul.induct) |
|
55793 | 325 |
case (2 c i P2) |
326 |
then show ?case |
|
44779 | 327 |
by (cases P2) (simp_all, cases i, simp_all add: mkPinj_cn) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
328 |
next |
55793 | 329 |
case (3 i P2 c) |
330 |
then show ?case |
|
44779 | 331 |
by (cases P2) (simp_all, cases i, simp_all add: mkPinj_cn) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
332 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
333 |
case (4 c P2 i Q2) |
44779 | 334 |
then have "isnorm P2" "isnorm Q2" |
335 |
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2]) |
|
55793 | 336 |
with 4 show ?case |
44779 | 337 |
by (cases "c = 0") (simp_all, cases "i = 0", simp_all add: mkPX_cn) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
338 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
339 |
case (5 P2 i Q2 c) |
44779 | 340 |
then have "isnorm P2" "isnorm Q2" |
341 |
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2]) |
|
41807 | 342 |
with 5 show ?case |
44779 | 343 |
by (cases "c = 0") (simp_all, cases "i = 0", simp_all add: mkPX_cn) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
344 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
345 |
case (6 x P2 y Q2) |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
346 |
have "x < y \<or> x = y \<or> x > y" by arith |
55793 | 347 |
moreover { |
348 |
assume "x < y" |
|
349 |
then have "\<exists>d. y = d + x" by arith |
|
41807 | 350 |
then obtain d where y: "y = d + x" .. |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
351 |
moreover |
41807 | 352 |
note 6 |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
353 |
moreover |
55793 | 354 |
from 6 have "x > 0" |
355 |
by (cases x) (auto simp add: norm_Pinj_0_False) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
356 |
moreover |
55793 | 357 |
from 6 have "isnorm P2" "isnorm Q2" |
358 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
359 |
moreover |
55793 | 360 |
from 6 `x < y` y have "isnorm (Pinj d Q2)" |
361 |
by (cases d) (simp, cases Q2, auto) |
|
362 |
ultimately have ?case by (simp add: mkPinj_cn) |
|
363 |
} |
|
364 |
moreover { |
|
365 |
assume "x = y" |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
366 |
moreover |
55793 | 367 |
from 6 have "isnorm P2" "isnorm Q2" |
368 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
369 |
moreover |
55793 | 370 |
from 6 have "y>0" |
371 |
by (cases y) (auto simp add: norm_Pinj_0_False) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
372 |
moreover |
41807 | 373 |
note 6 |
55793 | 374 |
ultimately have ?case by (simp add: mkPinj_cn) |
375 |
} |
|
376 |
moreover { |
|
377 |
assume "x > y" |
|
378 |
then have "\<exists>d. x = d + y" by arith |
|
41807 | 379 |
then obtain d where x: "x = d + y" .. |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
380 |
moreover |
41807 | 381 |
note 6 |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
382 |
moreover |
55793 | 383 |
from 6 have "y > 0" |
384 |
by (cases y) (auto simp add: norm_Pinj_0_False) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
385 |
moreover |
55793 | 386 |
from 6 have "isnorm P2" "isnorm Q2" |
387 |
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
388 |
moreover |
55793 | 389 |
from 6 `x > y` x have "isnorm (Pinj d P2)" |
390 |
by (cases d) (simp, cases P2, auto) |
|
391 |
ultimately have ?case by (simp add: mkPinj_cn) |
|
392 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
393 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
394 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
395 |
case (7 x P2 Q2 y R) |
41807 | 396 |
then have Y0: "y > 0" by (cases y) auto |
397 |
have "x = 0 \<or> x = 1 \<or> x > 1" by arith |
|
55793 | 398 |
moreover { |
399 |
assume "x = 0" |
|
400 |
with 7 have ?case |
|
401 |
by (auto simp add: norm_Pinj_0_False) |
|
402 |
} |
|
403 |
moreover { |
|
404 |
assume "x = 1" |
|
405 |
from 7 have "isnorm R" "isnorm P2" |
|
406 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
407 |
with 7 `x = 1` have "isnorm (R \<otimes> P2)" "isnorm Q2" |
|
408 |
by (auto simp add: norm_PX1[of Q2 y R]) |
|
409 |
with 7 `x = 1` Y0 have ?case |
|
410 |
by (simp add: mkPX_cn) |
|
411 |
} |
|
412 |
moreover { |
|
413 |
assume "x > 1" |
|
414 |
then have "\<exists>d. x = Suc (Suc d)" |
|
415 |
by arith |
|
41807 | 416 |
then obtain d where X: "x = Suc (Suc d)" .. |
417 |
from 7 have NR: "isnorm R" "isnorm Q2" |
|
418 |
by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
419 |
moreover |
55793 | 420 |
from 7 X have "isnorm (Pinj (x - 1) P2)" |
421 |
by (cases P2) auto |
|
41807 | 422 |
moreover |
55793 | 423 |
from 7 have "isnorm (Pinj x P2)" |
424 |
by (cases P2) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
425 |
moreover |
41807 | 426 |
note 7 X |
55793 | 427 |
ultimately have "isnorm (R \<otimes> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<otimes> Q2)" |
428 |
by auto |
|
429 |
with Y0 X have ?case |
|
430 |
by (simp add: mkPX_cn) |
|
431 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
432 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
433 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
434 |
case (8 Q2 y R x P2) |
55793 | 435 |
then have Y0: "y > 0" |
436 |
by (cases y) auto |
|
41807 | 437 |
have "x = 0 \<or> x = 1 \<or> x > 1" by arith |
55793 | 438 |
moreover { |
439 |
assume "x = 0" |
|
440 |
with 8 have ?case |
|
441 |
by (auto simp add: norm_Pinj_0_False) |
|
442 |
} |
|
443 |
moreover { |
|
444 |
assume "x = 1" |
|
445 |
from 8 have "isnorm R" "isnorm P2" |
|
446 |
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R]) |
|
447 |
with 8 `x = 1` have "isnorm (R \<otimes> P2)" "isnorm Q2" |
|
448 |
by (auto simp add: norm_PX1[of Q2 y R]) |
|
449 |
with 8 `x = 1` Y0 have ?case |
|
450 |
by (simp add: mkPX_cn) |
|
451 |
} |
|
452 |
moreover { |
|
453 |
assume "x > 1" |
|
454 |
then have "\<exists>d. x = Suc (Suc d)" by arith |
|
41807 | 455 |
then obtain d where X: "x = Suc (Suc d)" .. |
456 |
from 8 have NR: "isnorm R" "isnorm Q2" |
|
457 |
by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R]) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
458 |
moreover |
55793 | 459 |
from 8 X have "isnorm (Pinj (x - 1) P2)" |
460 |
by (cases P2) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
461 |
moreover |
55793 | 462 |
from 8 X have "isnorm (Pinj x P2)" |
463 |
by (cases P2) auto |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
464 |
moreover |
41807 | 465 |
note 8 X |
55793 | 466 |
ultimately have "isnorm (R \<otimes> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<otimes> Q2)" |
467 |
by auto |
|
468 |
with Y0 X have ?case by (simp add: mkPX_cn) |
|
469 |
} |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
470 |
ultimately show ?case by blast |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
471 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
472 |
case (9 P1 x P2 Q1 y Q2) |
41807 | 473 |
from 9 have X0: "x > 0" by (cases x) auto |
474 |
from 9 have Y0: "y > 0" by (cases y) auto |
|
475 |
note 9 |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
476 |
moreover |
55793 | 477 |
from 9 have "isnorm P1" "isnorm P2" |
478 |
by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2]) |
|
479 |
moreover |
|
480 |
from 9 have "isnorm Q1" "isnorm Q2" |
|
481 |
by (auto simp add: norm_PX1[of Q1 y Q2] norm_PX2[of Q1 y Q2]) |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
482 |
ultimately have "isnorm (P1 \<otimes> Q1)" "isnorm (P2 \<otimes> Q2)" |
55793 | 483 |
"isnorm (P1 \<otimes> mkPinj 1 Q2)" "isnorm (Q1 \<otimes> mkPinj 1 P2)" |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
484 |
by (auto simp add: mkPinj_cn) |
41807 | 485 |
with 9 X0 Y0 have |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
486 |
"isnorm (mkPX (P1 \<otimes> Q1) (x + y) (P2 \<otimes> Q2))" |
55793 | 487 |
"isnorm (mkPX (P1 \<otimes> mkPinj (Suc 0) Q2) x (Pc 0))" |
488 |
"isnorm (mkPX (Q1 \<otimes> mkPinj (Suc 0) P2) y (Pc 0))" |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
489 |
by (auto simp add: mkPX_cn) |
55754 | 490 |
then show ?case by (simp add: add_cn) |
41807 | 491 |
qed simp |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
492 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
493 |
text {* neg conserves normalizedness *} |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
494 |
lemma neg_cn: "isnorm P \<Longrightarrow> isnorm (neg P)" |
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
495 |
proof (induct P) |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
496 |
case (Pinj i P2) |
55793 | 497 |
then have "isnorm P2" |
498 |
by (simp add: norm_Pinj[of i P2]) |
|
499 |
with Pinj show ?case |
|
500 |
by (cases P2) (auto, cases i, auto) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
501 |
next |
41807 | 502 |
case (PX P1 x P2) note PX1 = this |
503 |
from PX have "isnorm P2" "isnorm P1" |
|
504 |
by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2]) |
|
505 |
with PX show ?case |
|
506 |
proof (cases P1) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
507 |
case (PX p1 y p2) |
55793 | 508 |
with PX1 show ?thesis |
509 |
by (cases x) (auto, cases p2, auto) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
510 |
next |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
511 |
case Pinj |
55793 | 512 |
with PX1 show ?thesis |
513 |
by (cases x) auto |
|
41807 | 514 |
qed (cases x, auto) |
515 |
qed simp |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
516 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
517 |
text {* sub conserves normalizedness *} |
44779 | 518 |
lemma sub_cn: "isnorm p \<Longrightarrow> isnorm q \<Longrightarrow> isnorm (p \<ominus> q)" |
519 |
by (simp add: sub_def add_cn neg_cn) |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
520 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
521 |
text {* sqr conserves normalizizedness *} |
44779 | 522 |
lemma sqr_cn: "isnorm P \<Longrightarrow> isnorm (sqr P)" |
41807 | 523 |
proof (induct P) |
44779 | 524 |
case Pc |
525 |
then show ?case by simp |
|
526 |
next |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
527 |
case (Pinj i Q) |
41807 | 528 |
then show ?case |
44779 | 529 |
by (cases Q) (auto simp add: mkPX_cn mkPinj_cn, cases i, auto simp add: mkPX_cn mkPinj_cn) |
55793 | 530 |
next |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
531 |
case (PX P1 x P2) |
55754 | 532 |
then have "x + x \<noteq> 0" "isnorm P2" "isnorm P1" |
41807 | 533 |
by (cases x, auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2]) |
534 |
with PX have "isnorm (mkPX (Pc (1 + 1) \<otimes> P1 \<otimes> mkPinj (Suc 0) P2) x (Pc 0))" |
|
535 |
and "isnorm (mkPX (sqr P1) (x + x) (sqr P2))" |
|
536 |
by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn) |
|
55793 | 537 |
then show ?case |
538 |
by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn) |
|
44779 | 539 |
qed |
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
540 |
|
22742
06165e40e7bd
switched from recdef to function package; constants add, mul, pow now curried; infix syntax for algebraic operations.
haftmann
parents:
17508
diff
changeset
|
541 |
text {* pow conserves normalizedness *} |
44779 | 542 |
lemma pow_cn: "isnorm P \<Longrightarrow> isnorm (pow n P)" |
543 |
proof (induct n arbitrary: P rule: less_induct) |
|
544 |
case (less k) |
|
55793 | 545 |
show ?case |
41807 | 546 |
proof (cases "k = 0") |
44779 | 547 |
case True |
548 |
then show ?thesis by simp |
|
549 |
next |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
550 |
case False |
41807 | 551 |
then have K2: "k div 2 < k" by (cases k) auto |
44779 | 552 |
from less have "isnorm (sqr P)" by (simp add: sqr_cn) |
553 |
with less False K2 show ?thesis |
|
554 |
by (simp add: allE[of _ "(k div 2)" _] allE[of _ "(sqr P)" _], cases k, auto simp add: mul_cn) |
|
555 |
qed |
|
17378
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
556 |
qed |
105519771c67
The oracle for Presburger has been changer: It is automatically generated form a verified formaliztion of Cooper's Algorithm ex/Reflected_Presburger.thy
chaieb
parents:
diff
changeset
|
557 |
|
17388 | 558 |
end |