| author | wenzelm | 
| Fri, 18 Oct 2024 16:43:02 +0200 | |
| changeset 81191 | 60f46822a22c | 
| parent 80105 | 2fa018321400 | 
| 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  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
3  | 
This theory is about of the relative completeness of the ring  | 
| 
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
4  | 
method. As long as the reified atomic polynomials of type pol are  | 
| 
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
5  | 
in normal form, the ring method is complete.  | 
| 17388 | 6  | 
*)  | 
7  | 
||
| 60533 | 8  | 
section \<open>Proof of the relative completeness of method comm-ring\<close>  | 
| 
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  | 
| 67123 | 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  | 
|
| 60533 | 14  | 
text \<open>Formalization of normal form\<close>  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
15  | 
fun isnorm :: "pol \<Rightarrow> bool"  | 
| 67123 | 16  | 
where  | 
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  | 
|
| 67123 | 27  | 
|
28  | 
subsection \<open>Some helpful lemmas\<close>  | 
|
29  | 
||
| 44779 | 30  | 
lemma norm_Pinj_0_False: "isnorm (Pinj 0 P) = False"  | 
31  | 
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
 | 
32  | 
|
| 44779 | 33  | 
lemma norm_PX_0_False: "isnorm (PX (Pc 0) i Q) = False"  | 
34  | 
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
 | 
35  | 
|
| 44779 | 36  | 
lemma norm_Pinj: "isnorm (Pinj i Q) \<Longrightarrow> isnorm Q"  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
37  | 
using isnorm.elims(2) by fastforce  | 
| 
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
 | 
38  | 
|
| 44779 | 39  | 
lemma norm_PX2: "isnorm (PX P i Q) \<Longrightarrow> isnorm Q"  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
40  | 
using isnorm.elims(1) by auto  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
41  | 
|
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
42  | 
lemma norm_PX1: assumes "isnorm (PX P i Q)" shows "isnorm P"  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
43  | 
proof (cases P)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
44  | 
case (Pc x1)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
45  | 
then show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
46  | 
by auto  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
47  | 
qed (use assms isnorm.elims(1) in auto)  | 
| 44779 | 48  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
49  | 
lemma mkPinj_cn:  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
50  | 
assumes "y \<noteq> 0" and "isnorm Q"  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
51  | 
shows "isnorm (mkPinj y Q)"  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
52  | 
proof (cases Q)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
53  | 
case Pc  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
54  | 
with assms show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
55  | 
by (simp add: mkPinj_def)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
56  | 
next  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
57  | 
case Pinj  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
58  | 
with assms show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
59  | 
using isnorm.elims(2) isnorm.simps(5) mkPinj_def by fastforce  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
60  | 
next  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
61  | 
case PX  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
62  | 
with assms show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
63  | 
using isnorm.elims(1) mkPinj_def by auto  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
64  | 
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
 | 
65  | 
|
| 55793 | 66  | 
lemma norm_PXtrans:  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
67  | 
assumes "isnorm (PX P x Q)" and "isnorm Q2"  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
68  | 
shows "isnorm (PX P x Q2)"  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
69  | 
using assms isnorm.elims(3) by fastforce  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
70  | 
|
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
71  | 
|
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
72  | 
lemma norm_PXtrans2:  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
73  | 
assumes "isnorm (PX P x Q)"  | 
| 55793 | 74  | 
and "isnorm Q2"  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
75  | 
shows "isnorm (PX P (Suc (n + x)) Q2)"  | 
| 44779 | 76  | 
proof (cases P)  | 
77  | 
case (PX p1 y p2)  | 
|
| 55754 | 78  | 
with assms show ?thesis  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
79  | 
using isnorm.elims(2) by fastforce  | 
| 
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  | 
next  | 
| 44779 | 81  | 
case Pc  | 
| 60535 | 82  | 
with assms show ?thesis  | 
83  | 
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
 | 
84  | 
next  | 
| 44779 | 85  | 
case Pinj  | 
| 60535 | 86  | 
with assms show ?thesis  | 
87  | 
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
 | 
88  | 
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
 | 
89  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
90  | 
text \<open>\<open>mkPX\<close> preserves the normal property (\<open>_cn\<close>)\<close>  | 
| 55793 | 91  | 
lemma mkPX_cn:  | 
| 55754 | 92  | 
assumes "x \<noteq> 0"  | 
93  | 
and "isnorm P"  | 
|
| 55793 | 94  | 
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
 | 
95  | 
shows "isnorm (mkPX P x Q)"  | 
| 55754 | 96  | 
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
 | 
97  | 
case (Pc c)  | 
| 55754 | 98  | 
with assms show ?thesis  | 
99  | 
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
 | 
100  | 
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
 | 
101  | 
case (Pinj i Q)  | 
| 55754 | 102  | 
with assms show ?thesis  | 
103  | 
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
 | 
104  | 
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
 | 
105  | 
case (PX P1 y P2)  | 
| 55793 | 106  | 
with assms have Y0: "y > 0"  | 
107  | 
by (cases y) auto  | 
|
| 41807 | 108  | 
from assms PX have "isnorm P1" "isnorm P2"  | 
109  | 
by (auto simp add: norm_PX1[of P1 y P2] norm_PX2[of P1 y P2])  | 
|
110  | 
from assms PX Y0 show ?thesis  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
111  | 
proof (cases P2)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
112  | 
case (Pc x1)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
113  | 
then show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
114  | 
using assms gr0_conv_Suc PX by (auto simp add: mkPX_def norm_PXtrans2)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
115  | 
next  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
116  | 
case (Pinj x21 x22)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
117  | 
with assms gr0_conv_Suc PX show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
118  | 
by (auto simp: mkPX_def)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
119  | 
next  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
120  | 
case (PX x31 x32 x33)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
121  | 
with assms gr0_conv_Suc \<open>P = PX P1 y P2\<close>  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
122  | 
show ?thesis  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
123  | 
using assms PX by (auto simp add: mkPX_def norm_PXtrans2)  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
124  | 
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
 | 
125  | 
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
 | 
126  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
127  | 
text \<open>\<open>add\<close> preserves the normal property\<close>  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
128  | 
lemma add_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<langle>+\<rangle> Q)"  | 
| 44779 | 129  | 
proof (induct P Q rule: add.induct)  | 
| 60535 | 130  | 
case 1  | 
131  | 
then show ?case by simp  | 
|
132  | 
next  | 
|
| 44779 | 133  | 
case (2 c i P2)  | 
| 55793 | 134  | 
then show ?case  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
135  | 
using isnorm.elims(2) by fastforce  | 
| 
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
 | 
136  | 
next  | 
| 44779 | 137  | 
case (3 i P2 c)  | 
| 55793 | 138  | 
then show ?case  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
139  | 
using isnorm.elims(2) by fastforce  | 
| 
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
 | 
140  | 
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
 | 
141  | 
case (4 c P2 i Q2)  | 
| 44779 | 142  | 
then have "isnorm P2" "isnorm Q2"  | 
143  | 
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])  | 
|
144  | 
with 4 show ?case  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
145  | 
using isnorm.elims(2) by fastforce  | 
| 
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
 | 
146  | 
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
 | 
147  | 
case (5 P2 i Q2 c)  | 
| 44779 | 148  | 
then have "isnorm P2" "isnorm Q2"  | 
149  | 
by (auto simp only: norm_PX1[of P2 i Q2] norm_PX2[of P2 i Q2])  | 
|
150  | 
with 5 show ?case  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
151  | 
using isnorm.elims(2) by fastforce  | 
| 
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
 | 
152  | 
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
 | 
153  | 
case (6 x P2 y Q2)  | 
| 55793 | 154  | 
then have Y0: "y > 0"  | 
155  | 
by (cases y) (auto simp add: norm_Pinj_0_False)  | 
|
156  | 
with 6 have X0: "x > 0"  | 
|
157  | 
by (cases x) (auto simp add: norm_Pinj_0_False)  | 
|
| 60535 | 158  | 
consider "x < y" | "x = y" | "x > y" by arith  | 
159  | 
then show ?case  | 
|
160  | 
proof cases  | 
|
| 60567 | 161  | 
case xy: 1  | 
| 60535 | 162  | 
then obtain d where y: "y = d + x"  | 
163  | 
by atomize_elim arith  | 
|
164  | 
from 6 have *: "isnorm P2" "isnorm Q2"  | 
|
| 44779 | 165  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
| 60567 | 166  | 
from 6 xy y have "isnorm (Pinj d Q2)"  | 
| 44779 | 167  | 
by (cases d, simp, cases Q2, auto)  | 
| 60535 | 168  | 
with 6 X0 y * show ?thesis  | 
169  | 
by (simp add: mkPinj_cn)  | 
|
170  | 
next  | 
|
| 60567 | 171  | 
case xy: 2  | 
| 44779 | 172  | 
from 6 have "isnorm P2" "isnorm Q2"  | 
173  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
|
| 60567 | 174  | 
with xy 6 Y0 show ?thesis  | 
| 60535 | 175  | 
by (simp add: mkPinj_cn)  | 
176  | 
next  | 
|
| 60567 | 177  | 
case xy: 3  | 
| 60535 | 178  | 
then obtain d where x: "x = d + y"  | 
179  | 
by atomize_elim arith  | 
|
180  | 
from 6 have *: "isnorm P2" "isnorm Q2"  | 
|
| 44779 | 181  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
| 60567 | 182  | 
from 6 xy x have "isnorm (Pinj d P2)"  | 
| 44779 | 183  | 
by (cases d) (simp, cases P2, auto)  | 
| 60567 | 184  | 
with xy 6 Y0 * x show ?thesis by (simp add: mkPinj_cn)  | 
| 60535 | 185  | 
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
 | 
186  | 
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
 | 
187  | 
case (7 x P2 Q2 y R)  | 
| 60535 | 188  | 
consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"  | 
189  | 
by atomize_elim arith  | 
|
190  | 
then show ?case  | 
|
191  | 
proof cases  | 
|
| 60767 | 192  | 
case 1  | 
| 60535 | 193  | 
with 7 show ?thesis  | 
194  | 
by (auto simp add: norm_Pinj_0_False)  | 
|
195  | 
next  | 
|
| 60567 | 196  | 
case x: 2  | 
| 44779 | 197  | 
from 7 have "isnorm R" "isnorm P2"  | 
198  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
199  | 
with 7 x have "isnorm (R \<langle>+\<rangle> P2)"  | 
| 60535 | 200  | 
by simp  | 
| 60567 | 201  | 
with 7 x show ?thesis  | 
| 55793 | 202  | 
by (simp add: norm_PXtrans[of Q2 y _])  | 
| 60535 | 203  | 
next  | 
| 60567 | 204  | 
case x: 3  | 
| 41807 | 205  | 
with 7 have NR: "isnorm R" "isnorm P2"  | 
206  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 60567 | 207  | 
with 7 x have "isnorm (Pinj (x - 1) P2)"  | 
| 60535 | 208  | 
by (cases P2) auto  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
209  | 
with 7 x NR have "isnorm (R \<langle>+\<rangle> Pinj (x - 1) P2)"  | 
| 60535 | 210  | 
by simp  | 
| 60567 | 211  | 
with \<open>isnorm (PX Q2 y R)\<close> x show ?thesis  | 
| 55793 | 212  | 
by (simp add: norm_PXtrans[of Q2 y _])  | 
| 60535 | 213  | 
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
 | 
214  | 
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
 | 
215  | 
case (8 Q2 y R x P2)  | 
| 60535 | 216  | 
consider "x = 0" | "x = 1" | "x > 1"  | 
217  | 
by arith  | 
|
218  | 
then show ?case  | 
|
219  | 
proof cases  | 
|
220  | 
case 1  | 
|
221  | 
with 8 show ?thesis  | 
|
| 55793 | 222  | 
by (auto simp add: norm_Pinj_0_False)  | 
| 60535 | 223  | 
next  | 
| 60567 | 224  | 
case x: 2  | 
| 55793 | 225  | 
with 8 have "isnorm R" "isnorm P2"  | 
226  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
227  | 
with 8 x have "isnorm (R \<langle>+\<rangle> P2)"  | 
| 55793 | 228  | 
by simp  | 
| 60567 | 229  | 
with 8 x show ?thesis  | 
| 55793 | 230  | 
by (simp add: norm_PXtrans[of Q2 y _])  | 
| 60535 | 231  | 
next  | 
| 60567 | 232  | 
case x: 3  | 
| 60535 | 233  | 
then obtain d where x: "x = Suc (Suc d)" by atomize_elim arith  | 
| 41807 | 234  | 
with 8 have NR: "isnorm R" "isnorm P2"  | 
235  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 60535 | 236  | 
with 8 x have "isnorm (Pinj (x - 1) P2)"  | 
| 55793 | 237  | 
by (cases P2) auto  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
238  | 
with 8 x NR have "isnorm (R \<langle>+\<rangle> Pinj (x - 1) P2)"  | 
| 55793 | 239  | 
by simp  | 
| 60535 | 240  | 
with \<open>isnorm (PX Q2 y R)\<close> x show ?thesis  | 
| 55793 | 241  | 
by (simp add: norm_PXtrans[of Q2 y _])  | 
| 60535 | 242  | 
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
 | 
243  | 
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
 | 
244  | 
case (9 P1 x P2 Q1 y Q2)  | 
| 55793 | 245  | 
then have Y0: "y > 0" by (cases y) auto  | 
246  | 
with 9 have X0: "x > 0" by (cases x) auto  | 
|
| 41807 | 247  | 
with 9 have NP1: "isnorm P1" and NP2: "isnorm P2"  | 
248  | 
by (auto simp add: norm_PX1[of P1 _ P2] norm_PX2[of P1 _ P2])  | 
|
| 44779 | 249  | 
with 9 have NQ1: "isnorm Q1" and NQ2: "isnorm Q2"  | 
| 41807 | 250  | 
by (auto simp add: norm_PX1[of Q1 _ Q2] norm_PX2[of Q1 _ Q2])  | 
| 60535 | 251  | 
consider "y < x" | "x = y" | "x < y" by arith  | 
252  | 
then show ?case  | 
|
253  | 
proof cases  | 
|
| 60567 | 254  | 
case xy: 1  | 
| 60535 | 255  | 
then obtain d where x: "x = d + y"  | 
256  | 
by atomize_elim arith  | 
|
| 55793 | 257  | 
have "isnorm (PX P1 d (Pc 0))"  | 
| 41807 | 258  | 
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
 | 
259  | 
case (PX p1 y p2)  | 
| 60567 | 260  | 
with 9 xy x show ?thesis  | 
| 55793 | 261  | 
by (cases d) (simp, cases p2, auto)  | 
| 41807 | 262  | 
next  | 
| 55793 | 263  | 
case Pc  | 
| 60567 | 264  | 
with 9 xy x show ?thesis  | 
| 55793 | 265  | 
by (cases d) auto  | 
| 41807 | 266  | 
next  | 
| 55793 | 267  | 
case Pinj  | 
| 60567 | 268  | 
with 9 xy x show ?thesis  | 
| 55793 | 269  | 
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
 | 
270  | 
qed  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
271  | 
with 9 NQ1 NP1 NP2 NQ2 xy x have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (PX P1 (x - y) (Pc 0) \<langle>+\<rangle> Q1)"  | 
| 55793 | 272  | 
by auto  | 
| 60567 | 273  | 
with Y0 xy x show ?thesis  | 
| 55793 | 274  | 
by (simp add: mkPX_cn)  | 
| 60535 | 275  | 
next  | 
| 60567 | 276  | 
case xy: 2  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
277  | 
with 9 NP1 NP2 NQ1 NQ2 have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (P1 \<langle>+\<rangle> Q1)"  | 
| 55793 | 278  | 
by auto  | 
| 60567 | 279  | 
with xy Y0 show ?thesis  | 
| 55793 | 280  | 
by (simp add: mkPX_cn)  | 
| 60535 | 281  | 
next  | 
| 60567 | 282  | 
case xy: 3  | 
| 60535 | 283  | 
then obtain d where y: "y = d + x"  | 
284  | 
by atomize_elim arith  | 
|
| 55793 | 285  | 
have "isnorm (PX Q1 d (Pc 0))"  | 
| 41807 | 286  | 
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
 | 
287  | 
case (PX p1 y p2)  | 
| 60567 | 288  | 
with 9 xy y show ?thesis  | 
| 55793 | 289  | 
by (cases d) (simp, cases p2, auto)  | 
| 41807 | 290  | 
next  | 
| 55793 | 291  | 
case Pc  | 
| 60567 | 292  | 
with 9 xy y show ?thesis  | 
| 55793 | 293  | 
by (cases d) auto  | 
| 41807 | 294  | 
next  | 
| 55793 | 295  | 
case Pinj  | 
| 60567 | 296  | 
with 9 xy y show ?thesis  | 
| 55793 | 297  | 
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
 | 
298  | 
qed  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
299  | 
with 9 NQ1 NP1 NP2 NQ2 xy y have "isnorm (P2 \<langle>+\<rangle> Q2)" "isnorm (PX Q1 (y - x) (Pc 0) \<langle>+\<rangle> P1)"  | 
| 55793 | 300  | 
by auto  | 
| 60567 | 301  | 
with X0 xy y show ?thesis  | 
| 55793 | 302  | 
by (simp add: mkPX_cn)  | 
| 60535 | 303  | 
qed  | 
304  | 
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
 | 
305  | 
|
| 67123 | 306  | 
text \<open>\<open>mul\<close> concerves normalizedness\<close>  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
307  | 
lemma mul_cn: "isnorm P \<Longrightarrow> isnorm Q \<Longrightarrow> isnorm (P \<langle>*\<rangle> Q)"  | 
| 44779 | 308  | 
proof (induct P Q rule: mul.induct)  | 
| 60535 | 309  | 
case 1  | 
310  | 
then show ?case by simp  | 
|
311  | 
next  | 
|
| 55793 | 312  | 
case (2 c i P2)  | 
313  | 
then show ?case  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
314  | 
by (metis mkPinj_cn mul.simps(2) norm_Pinj 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
 | 
315  | 
next  | 
| 55793 | 316  | 
case (3 i P2 c)  | 
317  | 
then show ?case  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
318  | 
by (metis mkPinj_cn mul.simps(3) norm_Pinj 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
 | 
319  | 
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
 | 
320  | 
case (4 c P2 i Q2)  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
321  | 
then show ?case  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
322  | 
by (metis isnorm.simps(6) mkPX_cn mul.simps(4) norm_PX1 norm_PX2)  | 
| 
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
 | 
323  | 
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
 | 
324  | 
case (5 P2 i Q2 c)  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
325  | 
then show ?case  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
326  | 
by (metis isnorm.simps(6) mkPX_cn mul.simps(5) norm_PX1 norm_PX2)  | 
| 
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
 | 
327  | 
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
 | 
328  | 
case (6 x P2 y Q2)  | 
| 60535 | 329  | 
consider "x < y" | "x = y" | "x > y" by arith  | 
330  | 
then show ?case  | 
|
331  | 
proof cases  | 
|
| 60567 | 332  | 
case xy: 1  | 
| 60535 | 333  | 
then obtain d where y: "y = d + x"  | 
334  | 
by atomize_elim arith  | 
|
335  | 
from 6 have *: "x > 0"  | 
|
| 55793 | 336  | 
by (cases x) (auto simp add: norm_Pinj_0_False)  | 
| 60535 | 337  | 
from 6 have **: "isnorm P2" "isnorm Q2"  | 
| 55793 | 338  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
| 60567 | 339  | 
from 6 xy y have "isnorm (Pinj d Q2)"  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
340  | 
apply simp  | 
| 
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
341  | 
by (smt (verit, ccfv_SIG) "**"(2) Suc_pred isnorm.elims(1) isnorm.simps(2) isnorm.simps(3) isnorm.simps(5))  | 
| 60535 | 342  | 
with 6 * ** y show ?thesis  | 
343  | 
by (simp add: mkPinj_cn)  | 
|
344  | 
next  | 
|
| 60567 | 345  | 
case xy: 2  | 
| 60535 | 346  | 
from 6 have *: "isnorm P2" "isnorm Q2"  | 
| 55793 | 347  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
| 60535 | 348  | 
from 6 have **: "y > 0"  | 
349  | 
by (cases y) (auto simp add: norm_Pinj_0_False)  | 
|
| 60567 | 350  | 
with 6 xy * ** show ?thesis  | 
| 60535 | 351  | 
by (simp add: mkPinj_cn)  | 
352  | 
next  | 
|
| 60567 | 353  | 
case xy: 3  | 
| 60535 | 354  | 
then obtain d where x: "x = d + y"  | 
355  | 
by atomize_elim arith  | 
|
356  | 
from 6 have *: "y > 0"  | 
|
| 55793 | 357  | 
by (cases y) (auto simp add: norm_Pinj_0_False)  | 
| 60535 | 358  | 
from 6 have **: "isnorm P2" "isnorm Q2"  | 
| 55793 | 359  | 
by (auto simp add: norm_Pinj[of _ P2] norm_Pinj[of _ Q2])  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
360  | 
with 6 xy x have "isnorm (Pinj d P2)"  | 
| 60535 | 361  | 
apply simp  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
362  | 
by (smt (verit, ccfv_SIG) Suc_pred isnorm.elims(1) isnorm.simps(2) isnorm.simps(3) isnorm.simps(5))  | 
| 60567 | 363  | 
with 6 xy * ** x show ?thesis  | 
| 60535 | 364  | 
by (simp add: mkPinj_cn)  | 
365  | 
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
 | 
366  | 
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
 | 
367  | 
case (7 x P2 Q2 y R)  | 
| 41807 | 368  | 
then have Y0: "y > 0" by (cases y) auto  | 
| 60535 | 369  | 
consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"  | 
370  | 
by atomize_elim arith  | 
|
371  | 
then show ?case  | 
|
372  | 
proof cases  | 
|
373  | 
case 1  | 
|
374  | 
with 7 show ?thesis  | 
|
| 55793 | 375  | 
by (auto simp add: norm_Pinj_0_False)  | 
| 60535 | 376  | 
next  | 
| 60567 | 377  | 
case x: 2  | 
| 55793 | 378  | 
from 7 have "isnorm R" "isnorm P2"  | 
379  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
380  | 
with 7 x have "isnorm (R \<langle>*\<rangle> P2)" "isnorm Q2"  | 
| 55793 | 381  | 
by (auto simp add: norm_PX1[of Q2 y R])  | 
| 60567 | 382  | 
with 7 x Y0 show ?thesis  | 
| 55793 | 383  | 
by (simp add: mkPX_cn)  | 
| 60535 | 384  | 
next  | 
| 60567 | 385  | 
case x: 3  | 
| 60535 | 386  | 
from 7 have *: "isnorm R" "isnorm Q2"  | 
| 41807 | 387  | 
by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])  | 
| 60567 | 388  | 
from 7 x have "isnorm (Pinj (x - 1) P2)"  | 
| 55793 | 389  | 
by (cases P2) auto  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
390  | 
with 7 x * have "isnorm (R \<langle>*\<rangle> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<langle>*\<rangle> Q2)"  | 
| 55793 | 391  | 
by auto  | 
| 60567 | 392  | 
with Y0 x show ?thesis  | 
| 55793 | 393  | 
by (simp add: mkPX_cn)  | 
| 60535 | 394  | 
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
 | 
395  | 
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
 | 
396  | 
case (8 Q2 y R x P2)  | 
| 55793 | 397  | 
then have Y0: "y > 0"  | 
398  | 
by (cases y) auto  | 
|
| 60535 | 399  | 
consider "x = 0" | "x = 1" | d where "x = Suc (Suc d)"  | 
400  | 
by atomize_elim arith  | 
|
401  | 
then show ?case  | 
|
402  | 
proof cases  | 
|
403  | 
case 1  | 
|
404  | 
with 8 show ?thesis  | 
|
| 55793 | 405  | 
by (auto simp add: norm_Pinj_0_False)  | 
| 60535 | 406  | 
next  | 
| 60567 | 407  | 
case x: 2  | 
| 55793 | 408  | 
from 8 have "isnorm R" "isnorm P2"  | 
409  | 
by (auto simp add: norm_Pinj[of _ P2] norm_PX2[of Q2 y R])  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
410  | 
with 8 x have "isnorm (R \<langle>*\<rangle> P2)" "isnorm Q2"  | 
| 55793 | 411  | 
by (auto simp add: norm_PX1[of Q2 y R])  | 
| 60567 | 412  | 
with 8 x Y0 show ?thesis  | 
| 55793 | 413  | 
by (simp add: mkPX_cn)  | 
| 60535 | 414  | 
next  | 
| 60567 | 415  | 
case x: 3  | 
| 60535 | 416  | 
from 8 have *: "isnorm R" "isnorm Q2"  | 
| 41807 | 417  | 
by (auto simp add: norm_PX2[of Q2 y R] norm_PX1[of Q2 y R])  | 
| 60567 | 418  | 
from 8 x have "isnorm (Pinj (x - 1) P2)"  | 
| 55793 | 419  | 
by (cases P2) auto  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
420  | 
with 8 x * have "isnorm (R \<langle>*\<rangle> Pinj (x - 1) P2)" "isnorm (Pinj x P2 \<langle>*\<rangle> Q2)"  | 
| 55793 | 421  | 
by auto  | 
| 60567 | 422  | 
with Y0 x show ?thesis  | 
| 60535 | 423  | 
by (simp add: mkPX_cn)  | 
424  | 
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
 | 
425  | 
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
 | 
426  | 
case (9 P1 x P2 Q1 y Q2)  | 
| 41807 | 427  | 
from 9 have X0: "x > 0" by (cases x) auto  | 
428  | 
from 9 have Y0: "y > 0" by (cases y) auto  | 
|
| 60535 | 429  | 
from 9 have *: "isnorm P1" "isnorm P2"  | 
| 55793 | 430  | 
by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])  | 
431  | 
from 9 have "isnorm Q1" "isnorm Q2"  | 
|
432  | 
by (auto simp add: norm_PX1[of Q1 y Q2] norm_PX2[of Q1 y Q2])  | 
|
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
433  | 
with 9 * have "isnorm (P1 \<langle>*\<rangle> Q1)" "isnorm (P2 \<langle>*\<rangle> Q2)"  | 
| 
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
434  | 
"isnorm (P1 \<langle>*\<rangle> mkPinj 1 Q2)" "isnorm (Q1 \<langle>*\<rangle> 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
 | 
435  | 
by (auto simp add: mkPinj_cn)  | 
| 41807 | 436  | 
with 9 X0 Y0 have  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
437  | 
"isnorm (mkPX (P1 \<langle>*\<rangle> Q1) (x + y) (P2 \<langle>*\<rangle> Q2))"  | 
| 
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
438  | 
"isnorm (mkPX (P1 \<langle>*\<rangle> mkPinj (Suc 0) Q2) x (Pc 0))"  | 
| 
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
439  | 
"isnorm (mkPX (Q1 \<langle>*\<rangle> 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
 | 
440  | 
by (auto simp add: mkPX_cn)  | 
| 60535 | 441  | 
then show ?case  | 
442  | 
by (simp add: add_cn)  | 
|
443  | 
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
 | 
444  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
445  | 
text \<open>neg preserves the normal property\<close>  | 
| 
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
 | 
446  | 
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
 | 
447  | 
proof (induct P)  | 
| 60535 | 448  | 
case Pc  | 
449  | 
then show ?case by simp  | 
|
450  | 
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
 | 
451  | 
case (Pinj i P2)  | 
| 55793 | 452  | 
then have "isnorm P2"  | 
453  | 
by (simp add: norm_Pinj[of i P2])  | 
|
454  | 
with Pinj show ?case  | 
|
455  | 
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
 | 
456  | 
next  | 
| 41807 | 457  | 
case (PX P1 x P2) note PX1 = this  | 
458  | 
from PX have "isnorm P2" "isnorm P1"  | 
|
459  | 
by (auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2])  | 
|
460  | 
with PX show ?case  | 
|
461  | 
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
 | 
462  | 
case (PX p1 y p2)  | 
| 55793 | 463  | 
with PX1 show ?thesis  | 
464  | 
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
 | 
465  | 
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
 | 
466  | 
case Pinj  | 
| 55793 | 467  | 
with PX1 show ?thesis  | 
468  | 
by (cases x) auto  | 
|
| 41807 | 469  | 
qed (cases x, auto)  | 
| 60535 | 470  | 
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
 | 
471  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
472  | 
text \<open>sub preserves the normal property\<close>  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
473  | 
lemma sub_cn: "isnorm p \<Longrightarrow> isnorm q \<Longrightarrow> isnorm (p \<langle>-\<rangle> q)"  | 
| 44779 | 474  | 
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
 | 
475  | 
|
| 60533 | 476  | 
text \<open>sqr conserves normalizizedness\<close>  | 
| 44779 | 477  | 
lemma sqr_cn: "isnorm P \<Longrightarrow> isnorm (sqr P)"  | 
| 41807 | 478  | 
proof (induct P)  | 
| 44779 | 479  | 
case Pc  | 
480  | 
then show ?case by simp  | 
|
481  | 
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
 | 
482  | 
case (Pinj i Q)  | 
| 41807 | 483  | 
then show ?case  | 
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
484  | 
by (metis Commutative_Ring.sqr.simps(2) mkPinj_cn norm_Pinj norm_Pinj_0_False)  | 
| 55793 | 485  | 
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
 | 
486  | 
case (PX P1 x P2)  | 
| 55754 | 487  | 
then have "x + x \<noteq> 0" "isnorm P2" "isnorm P1"  | 
| 67123 | 488  | 
by (cases x) (use PX in \<open>auto simp add: norm_PX1[of P1 x P2] norm_PX2[of P1 x P2]\<close>)  | 
| 
64962
 
bf41e1109db3
Added new / improved tactics for fields and rings
 
berghofe 
parents: 
61586 
diff
changeset
 | 
489  | 
with PX have "isnorm (mkPX (Pc (1 + 1) \<langle>*\<rangle> P1 \<langle>*\<rangle> mkPinj (Suc 0) P2) x (Pc 0))"  | 
| 60535 | 490  | 
and "isnorm (mkPX (sqr P1) (x + x) (sqr P2))"  | 
| 41807 | 491  | 
by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)  | 
| 55793 | 492  | 
then show ?case  | 
493  | 
by (auto simp add: add_cn mkPX_cn mkPinj_cn mul_cn)  | 
|
| 44779 | 494  | 
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
 | 
495  | 
|
| 
80105
 
2fa018321400
Streamlining of many more archaic proofs
 
paulson <lp15@cam.ac.uk> 
parents: 
67123 
diff
changeset
 | 
496  | 
text \<open>\<open>pow\<close> preserves the normal property\<close>  | 
| 44779 | 497  | 
lemma pow_cn: "isnorm P \<Longrightarrow> isnorm (pow n P)"  | 
498  | 
proof (induct n arbitrary: P rule: less_induct)  | 
|
499  | 
case (less k)  | 
|
| 55793 | 500  | 
show ?case  | 
| 41807 | 501  | 
proof (cases "k = 0")  | 
| 44779 | 502  | 
case True  | 
503  | 
then show ?thesis by simp  | 
|
504  | 
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
 | 
505  | 
case False  | 
| 60535 | 506  | 
then have K2: "k div 2 < k"  | 
507  | 
by (cases k) auto  | 
|
508  | 
from less have "isnorm (sqr P)"  | 
|
509  | 
by (simp add: sqr_cn)  | 
|
| 44779 | 510  | 
with less False K2 show ?thesis  | 
| 58712 | 511  | 
by (cases "even k") (auto simp add: mul_cn elim: evenE oddE)  | 
| 44779 | 512  | 
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
 | 
513  | 
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
 | 
514  | 
|
| 17388 | 515  | 
end  |