16 (*********************************************************************************) |
16 (*********************************************************************************) |
17 |
17 |
18 datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num |
18 datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num |
19 | Mul int num |
19 | Mul int num |
20 |
20 |
21 primrec num_size :: "num \<Rightarrow> nat" -- \<open>A size for num to make inductive proofs simpler\<close> |
21 primrec num_size :: "num \<Rightarrow> nat" \<comment> \<open>A size for num to make inductive proofs simpler\<close> |
22 where |
22 where |
23 "num_size (C c) = 1" |
23 "num_size (C c) = 1" |
24 | "num_size (Bound n) = 1" |
24 | "num_size (Bound n) = 1" |
25 | "num_size (Neg a) = 1 + num_size a" |
25 | "num_size (Neg a) = 1 + num_size a" |
26 | "num_size (Add a b) = 1 + num_size a + num_size b" |
26 | "num_size (Add a b) = 1 + num_size a + num_size b" |
42 T| F| Lt num| Le num| Gt num| Ge num| Eq num| NEq num| Dvd int num| NDvd int num| |
42 T| F| Lt num| Le num| Gt num| Ge num| Eq num| NEq num| Dvd int num| NDvd int num| |
43 NOT fm| And fm fm| Or fm fm| Imp fm fm| Iff fm fm| E fm| A fm |
43 NOT fm| And fm fm| Or fm fm| Imp fm fm| Iff fm fm| E fm| A fm |
44 | Closed nat | NClosed nat |
44 | Closed nat | NClosed nat |
45 |
45 |
46 |
46 |
47 fun fmsize :: "fm \<Rightarrow> nat" -- \<open>A size for fm\<close> |
47 fun fmsize :: "fm \<Rightarrow> nat" \<comment> \<open>A size for fm\<close> |
48 where |
48 where |
49 "fmsize (NOT p) = 1 + fmsize p" |
49 "fmsize (NOT p) = 1 + fmsize p" |
50 | "fmsize (And p q) = 1 + fmsize p + fmsize q" |
50 | "fmsize (And p q) = 1 + fmsize p + fmsize q" |
51 | "fmsize (Or p q) = 1 + fmsize p + fmsize q" |
51 | "fmsize (Or p q) = 1 + fmsize p + fmsize q" |
52 | "fmsize (Imp p q) = 3 + fmsize p + fmsize q" |
52 | "fmsize (Imp p q) = 3 + fmsize p + fmsize q" |
58 | "fmsize p = 1" |
58 | "fmsize p = 1" |
59 |
59 |
60 lemma fmsize_pos: "fmsize p > 0" |
60 lemma fmsize_pos: "fmsize p > 0" |
61 by (induct p rule: fmsize.induct) simp_all |
61 by (induct p rule: fmsize.induct) simp_all |
62 |
62 |
63 primrec Ifm :: "bool list \<Rightarrow> int list \<Rightarrow> fm \<Rightarrow> bool" -- \<open>Semantics of formulae (fm)\<close> |
63 primrec Ifm :: "bool list \<Rightarrow> int list \<Rightarrow> fm \<Rightarrow> bool" \<comment> \<open>Semantics of formulae (fm)\<close> |
64 where |
64 where |
65 "Ifm bbs bs T \<longleftrightarrow> True" |
65 "Ifm bbs bs T \<longleftrightarrow> True" |
66 | "Ifm bbs bs F \<longleftrightarrow> False" |
66 | "Ifm bbs bs F \<longleftrightarrow> False" |
67 | "Ifm bbs bs (Lt a) \<longleftrightarrow> Inum bs a < 0" |
67 | "Ifm bbs bs (Lt a) \<longleftrightarrow> Inum bs a < 0" |
68 | "Ifm bbs bs (Gt a) \<longleftrightarrow> Inum bs a > 0" |
68 | "Ifm bbs bs (Gt a) \<longleftrightarrow> Inum bs a > 0" |
111 |
111 |
112 lemma prep: "Ifm bbs bs (prep p) = Ifm bbs bs p" |
112 lemma prep: "Ifm bbs bs (prep p) = Ifm bbs bs p" |
113 by (induct p arbitrary: bs rule: prep.induct) auto |
113 by (induct p arbitrary: bs rule: prep.induct) auto |
114 |
114 |
115 |
115 |
116 fun qfree :: "fm \<Rightarrow> bool" -- \<open>Quantifier freeness\<close> |
116 fun qfree :: "fm \<Rightarrow> bool" \<comment> \<open>Quantifier freeness\<close> |
117 where |
117 where |
118 "qfree (E p) \<longleftrightarrow> False" |
118 "qfree (E p) \<longleftrightarrow> False" |
119 | "qfree (A p) \<longleftrightarrow> False" |
119 | "qfree (A p) \<longleftrightarrow> False" |
120 | "qfree (NOT p) \<longleftrightarrow> qfree p" |
120 | "qfree (NOT p) \<longleftrightarrow> qfree p" |
121 | "qfree (And p q) \<longleftrightarrow> qfree p \<and> qfree q" |
121 | "qfree (And p q) \<longleftrightarrow> qfree p \<and> qfree q" |
125 | "qfree p \<longleftrightarrow> True" |
125 | "qfree p \<longleftrightarrow> True" |
126 |
126 |
127 |
127 |
128 text \<open>Boundedness and substitution\<close> |
128 text \<open>Boundedness and substitution\<close> |
129 |
129 |
130 primrec numbound0 :: "num \<Rightarrow> bool" -- \<open>a num is INDEPENDENT of Bound 0\<close> |
130 primrec numbound0 :: "num \<Rightarrow> bool" \<comment> \<open>a num is INDEPENDENT of Bound 0\<close> |
131 where |
131 where |
132 "numbound0 (C c) \<longleftrightarrow> True" |
132 "numbound0 (C c) \<longleftrightarrow> True" |
133 | "numbound0 (Bound n) \<longleftrightarrow> n > 0" |
133 | "numbound0 (Bound n) \<longleftrightarrow> n > 0" |
134 | "numbound0 (CN n i a) \<longleftrightarrow> n > 0 \<and> numbound0 a" |
134 | "numbound0 (CN n i a) \<longleftrightarrow> n > 0 \<and> numbound0 a" |
135 | "numbound0 (Neg a) \<longleftrightarrow> numbound0 a" |
135 | "numbound0 (Neg a) \<longleftrightarrow> numbound0 a" |
140 lemma numbound0_I: |
140 lemma numbound0_I: |
141 assumes nb: "numbound0 a" |
141 assumes nb: "numbound0 a" |
142 shows "Inum (b # bs) a = Inum (b' # bs) a" |
142 shows "Inum (b # bs) a = Inum (b' # bs) a" |
143 using nb by (induct a rule: num.induct) (auto simp add: gr0_conv_Suc) |
143 using nb by (induct a rule: num.induct) (auto simp add: gr0_conv_Suc) |
144 |
144 |
145 primrec bound0 :: "fm \<Rightarrow> bool" -- \<open>A Formula is independent of Bound 0\<close> |
145 primrec bound0 :: "fm \<Rightarrow> bool" \<comment> \<open>A Formula is independent of Bound 0\<close> |
146 where |
146 where |
147 "bound0 T \<longleftrightarrow> True" |
147 "bound0 T \<longleftrightarrow> True" |
148 | "bound0 F \<longleftrightarrow> True" |
148 | "bound0 F \<longleftrightarrow> True" |
149 | "bound0 (Lt a) \<longleftrightarrow> numbound0 a" |
149 | "bound0 (Lt a) \<longleftrightarrow> numbound0 a" |
150 | "bound0 (Le a) \<longleftrightarrow> numbound0 a" |
150 | "bound0 (Le a) \<longleftrightarrow> numbound0 a" |
186 |
186 |
187 lemma numsubst0_I': |
187 lemma numsubst0_I': |
188 "numbound0 a \<Longrightarrow> Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b'#bs) a)#bs) t" |
188 "numbound0 a \<Longrightarrow> Inum (b#bs) (numsubst0 a t) = Inum ((Inum (b'#bs) a)#bs) t" |
189 by (induct t rule: numsubst0.induct) (auto simp: nth_Cons' numbound0_I[where b="b" and b'="b'"]) |
189 by (induct t rule: numsubst0.induct) (auto simp: nth_Cons' numbound0_I[where b="b" and b'="b'"]) |
190 |
190 |
191 primrec subst0:: "num \<Rightarrow> fm \<Rightarrow> fm" -- \<open>substitue a num into a formula for Bound 0\<close> |
191 primrec subst0:: "num \<Rightarrow> fm \<Rightarrow> fm" \<comment> \<open>substitue a num into a formula for Bound 0\<close> |
192 where |
192 where |
193 "subst0 t T = T" |
193 "subst0 t T = T" |
194 | "subst0 t F = F" |
194 | "subst0 t F = F" |
195 | "subst0 t (Lt a) = Lt (numsubst0 t a)" |
195 | "subst0 t (Lt a) = Lt (numsubst0 t a)" |
196 | "subst0 t (Le a) = Le (numsubst0 t a)" |
196 | "subst0 t (Le a) = Le (numsubst0 t a)" |
252 using nb by (induct p rule: decr.induct) (simp_all add: gr0_conv_Suc decrnum) |
252 using nb by (induct p rule: decr.induct) (simp_all add: gr0_conv_Suc decrnum) |
253 |
253 |
254 lemma decr_qf: "bound0 p \<Longrightarrow> qfree (decr p)" |
254 lemma decr_qf: "bound0 p \<Longrightarrow> qfree (decr p)" |
255 by (induct p) simp_all |
255 by (induct p) simp_all |
256 |
256 |
257 fun isatom :: "fm \<Rightarrow> bool" -- \<open>test for atomicity\<close> |
257 fun isatom :: "fm \<Rightarrow> bool" \<comment> \<open>test for atomicity\<close> |
258 where |
258 where |
259 "isatom T \<longleftrightarrow> True" |
259 "isatom T \<longleftrightarrow> True" |
260 | "isatom F \<longleftrightarrow> True" |
260 | "isatom F \<longleftrightarrow> True" |
261 | "isatom (Lt a) \<longleftrightarrow> True" |
261 | "isatom (Lt a) \<longleftrightarrow> True" |
262 | "isatom (Le a) \<longleftrightarrow> True" |
262 | "isatom (Le a) \<longleftrightarrow> True" |
854 using qe_inv DJ_qe[OF qe_inv] |
854 using qe_inv DJ_qe[OF qe_inv] |
855 by (induct p rule: qelim.induct) |
855 by (induct p rule: qelim.induct) |
856 (auto simp add: not disj conj iff imp not_qf disj_qf conj_qf imp_qf iff_qf |
856 (auto simp add: not disj conj iff imp not_qf disj_qf conj_qf imp_qf iff_qf |
857 simpfm simpfm_qf simp del: simpfm.simps) |
857 simpfm simpfm_qf simp del: simpfm.simps) |
858 |
858 |
859 text \<open>Linearity for fm where Bound 0 ranges over @{text "\<int>"}\<close> |
859 text \<open>Linearity for fm where Bound 0 ranges over \<open>\<int>\<close>\<close> |
860 |
860 |
861 fun zsplit0 :: "num \<Rightarrow> int \<times> num" -- \<open>splits the bounded from the unbounded part\<close> |
861 fun zsplit0 :: "num \<Rightarrow> int \<times> num" \<comment> \<open>splits the bounded from the unbounded part\<close> |
862 where |
862 where |
863 "zsplit0 (C c) = (0, C c)" |
863 "zsplit0 (C c) = (0, C c)" |
864 | "zsplit0 (Bound n) = (if n = 0 then (1, C 0) else (0, Bound n))" |
864 | "zsplit0 (Bound n) = (if n = 0 then (1, C 0) else (0, Bound n))" |
865 | "zsplit0 (CN n i a) = |
865 | "zsplit0 (CN n i a) = |
866 (let (i', a') = zsplit0 a |
866 (let (i', a') = zsplit0 a |
987 by (simp add: distrib_left) |
987 by (simp add: distrib_left) |
988 finally show ?case using th th2 |
988 finally show ?case using th th2 |
989 by simp |
989 by simp |
990 qed |
990 qed |
991 |
991 |
992 consts iszlfm :: "fm \<Rightarrow> bool" -- \<open>Linearity test for fm\<close> |
992 consts iszlfm :: "fm \<Rightarrow> bool" \<comment> \<open>Linearity test for fm\<close> |
993 recdef iszlfm "measure size" |
993 recdef iszlfm "measure size" |
994 "iszlfm (And p q) \<longleftrightarrow> iszlfm p \<and> iszlfm q" |
994 "iszlfm (And p q) \<longleftrightarrow> iszlfm p \<and> iszlfm q" |
995 "iszlfm (Or p q) \<longleftrightarrow> iszlfm p \<and> iszlfm q" |
995 "iszlfm (Or p q) \<longleftrightarrow> iszlfm p \<and> iszlfm q" |
996 "iszlfm (Eq (CN 0 c e)) \<longleftrightarrow> c > 0 \<and> numbound0 e" |
996 "iszlfm (Eq (CN 0 c e)) \<longleftrightarrow> c > 0 \<and> numbound0 e" |
997 "iszlfm (NEq (CN 0 c e)) \<longleftrightarrow> c > 0 \<and> numbound0 e" |
997 "iszlfm (NEq (CN 0 c e)) \<longleftrightarrow> c > 0 \<and> numbound0 e" |
1004 "iszlfm p \<longleftrightarrow> isatom p \<and> bound0 p" |
1004 "iszlfm p \<longleftrightarrow> isatom p \<and> bound0 p" |
1005 |
1005 |
1006 lemma zlin_qfree: "iszlfm p \<Longrightarrow> qfree p" |
1006 lemma zlin_qfree: "iszlfm p \<Longrightarrow> qfree p" |
1007 by (induct p rule: iszlfm.induct) auto |
1007 by (induct p rule: iszlfm.induct) auto |
1008 |
1008 |
1009 consts zlfm :: "fm \<Rightarrow> fm" -- \<open>Linearity transformation for fm\<close> |
1009 consts zlfm :: "fm \<Rightarrow> fm" \<comment> \<open>Linearity transformation for fm\<close> |
1010 recdef zlfm "measure fmsize" |
1010 recdef zlfm "measure fmsize" |
1011 "zlfm (And p q) = And (zlfm p) (zlfm q)" |
1011 "zlfm (And p q) = And (zlfm p) (zlfm q)" |
1012 "zlfm (Or p q) = Or (zlfm p) (zlfm q)" |
1012 "zlfm (Or p q) = Or (zlfm p) (zlfm q)" |
1013 "zlfm (Imp p q) = Or (zlfm (NOT p)) (zlfm q)" |
1013 "zlfm (Imp p q) = Or (zlfm (NOT p)) (zlfm q)" |
1014 "zlfm (Iff p q) = Or (And (zlfm p) (zlfm q)) (And (zlfm (NOT p)) (zlfm (NOT q)))" |
1014 "zlfm (Iff p q) = Or (And (zlfm p) (zlfm q)) (And (zlfm (NOT p)) (zlfm (NOT q)))" |
1256 with Ia 4 dvd_minus_iff[of "abs j" "?c*i + ?N ?r"] show ?thesis |
1256 with Ia 4 dvd_minus_iff[of "abs j" "?c*i + ?N ?r"] show ?thesis |
1257 by (simp add: Let_def split_def) |
1257 by (simp add: Let_def split_def) |
1258 qed |
1258 qed |
1259 qed auto |
1259 qed auto |
1260 |
1260 |
1261 consts minusinf :: "fm \<Rightarrow> fm" -- \<open>Virtual substitution of @{text "-\<infinity>"}\<close> |
1261 consts minusinf :: "fm \<Rightarrow> fm" \<comment> \<open>Virtual substitution of \<open>-\<infinity>\<close>\<close> |
1262 recdef minusinf "measure size" |
1262 recdef minusinf "measure size" |
1263 "minusinf (And p q) = And (minusinf p) (minusinf q)" |
1263 "minusinf (And p q) = And (minusinf p) (minusinf q)" |
1264 "minusinf (Or p q) = Or (minusinf p) (minusinf q)" |
1264 "minusinf (Or p q) = Or (minusinf p) (minusinf q)" |
1265 "minusinf (Eq (CN 0 c e)) = F" |
1265 "minusinf (Eq (CN 0 c e)) = F" |
1266 "minusinf (NEq (CN 0 c e)) = T" |
1266 "minusinf (NEq (CN 0 c e)) = T" |
1271 "minusinf p = p" |
1271 "minusinf p = p" |
1272 |
1272 |
1273 lemma minusinf_qfree: "qfree p \<Longrightarrow> qfree (minusinf p)" |
1273 lemma minusinf_qfree: "qfree p \<Longrightarrow> qfree (minusinf p)" |
1274 by (induct p rule: minusinf.induct) auto |
1274 by (induct p rule: minusinf.induct) auto |
1275 |
1275 |
1276 consts plusinf :: "fm \<Rightarrow> fm" -- \<open>Virtual substitution of @{text "+\<infinity>"}\<close> |
1276 consts plusinf :: "fm \<Rightarrow> fm" \<comment> \<open>Virtual substitution of \<open>+\<infinity>\<close>\<close> |
1277 recdef plusinf "measure size" |
1277 recdef plusinf "measure size" |
1278 "plusinf (And p q) = And (plusinf p) (plusinf q)" |
1278 "plusinf (And p q) = And (plusinf p) (plusinf q)" |
1279 "plusinf (Or p q) = Or (plusinf p) (plusinf q)" |
1279 "plusinf (Or p q) = Or (plusinf p) (plusinf q)" |
1280 "plusinf (Eq (CN 0 c e)) = F" |
1280 "plusinf (Eq (CN 0 c e)) = F" |
1281 "plusinf (NEq (CN 0 c e)) = T" |
1281 "plusinf (NEq (CN 0 c e)) = T" |
1283 "plusinf (Le (CN 0 c e)) = F" |
1283 "plusinf (Le (CN 0 c e)) = F" |
1284 "plusinf (Gt (CN 0 c e)) = T" |
1284 "plusinf (Gt (CN 0 c e)) = T" |
1285 "plusinf (Ge (CN 0 c e)) = T" |
1285 "plusinf (Ge (CN 0 c e)) = T" |
1286 "plusinf p = p" |
1286 "plusinf p = p" |
1287 |
1287 |
1288 consts \<delta> :: "fm \<Rightarrow> int" -- \<open>Compute @{text "lcm {d| N\<^sup>? Dvd c*x+t \<in> p}"}\<close> |
1288 consts \<delta> :: "fm \<Rightarrow> int" \<comment> \<open>Compute \<open>lcm {d| N\<^sup>? Dvd c*x+t \<in> p}\<close>\<close> |
1289 recdef \<delta> "measure size" |
1289 recdef \<delta> "measure size" |
1290 "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)" |
1290 "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)" |
1291 "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)" |
1291 "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)" |
1292 "\<delta> (Dvd i (CN 0 c e)) = i" |
1292 "\<delta> (Dvd i (CN 0 c e)) = i" |
1293 "\<delta> (NDvd i (CN 0 c e)) = i" |
1293 "\<delta> (NDvd i (CN 0 c e)) = i" |
1294 "\<delta> p = 1" |
1294 "\<delta> p = 1" |
1295 |
1295 |
1296 consts d_\<delta> :: "fm \<Rightarrow> int \<Rightarrow> bool" -- \<open>check if a given l divides all the ds above\<close> |
1296 consts d_\<delta> :: "fm \<Rightarrow> int \<Rightarrow> bool" \<comment> \<open>check if a given l divides all the ds above\<close> |
1297 recdef d_\<delta> "measure size" |
1297 recdef d_\<delta> "measure size" |
1298 "d_\<delta> (And p q) = (\<lambda>d. d_\<delta> p d \<and> d_\<delta> q d)" |
1298 "d_\<delta> (And p q) = (\<lambda>d. d_\<delta> p d \<and> d_\<delta> q d)" |
1299 "d_\<delta> (Or p q) = (\<lambda>d. d_\<delta> p d \<and> d_\<delta> q d)" |
1299 "d_\<delta> (Or p q) = (\<lambda>d. d_\<delta> p d \<and> d_\<delta> q d)" |
1300 "d_\<delta> (Dvd i (CN 0 c e)) = (\<lambda>d. i dvd d)" |
1300 "d_\<delta> (Dvd i (CN 0 c e)) = (\<lambda>d. i dvd d)" |
1301 "d_\<delta> (NDvd i (CN 0 c e)) = (\<lambda>d. i dvd d)" |
1301 "d_\<delta> (NDvd i (CN 0 c e)) = (\<lambda>d. i dvd d)" |
1352 from th th' dp show ?case |
1352 from th th' dp show ?case |
1353 by simp |
1353 by simp |
1354 qed simp_all |
1354 qed simp_all |
1355 |
1355 |
1356 |
1356 |
1357 consts a_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> fm" -- \<open>adjust the coefficients of a formula\<close> |
1357 consts a_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> fm" \<comment> \<open>adjust the coefficients of a formula\<close> |
1358 recdef a_\<beta> "measure size" |
1358 recdef a_\<beta> "measure size" |
1359 "a_\<beta> (And p q) = (\<lambda>k. And (a_\<beta> p k) (a_\<beta> q k))" |
1359 "a_\<beta> (And p q) = (\<lambda>k. And (a_\<beta> p k) (a_\<beta> q k))" |
1360 "a_\<beta> (Or p q) = (\<lambda>k. Or (a_\<beta> p k) (a_\<beta> q k))" |
1360 "a_\<beta> (Or p q) = (\<lambda>k. Or (a_\<beta> p k) (a_\<beta> q k))" |
1361 "a_\<beta> (Eq (CN 0 c e)) = (\<lambda>k. Eq (CN 0 1 (Mul (k div c) e)))" |
1361 "a_\<beta> (Eq (CN 0 c e)) = (\<lambda>k. Eq (CN 0 1 (Mul (k div c) e)))" |
1362 "a_\<beta> (NEq (CN 0 c e)) = (\<lambda>k. NEq (CN 0 1 (Mul (k div c) e)))" |
1362 "a_\<beta> (NEq (CN 0 c e)) = (\<lambda>k. NEq (CN 0 1 (Mul (k div c) e)))" |
1366 "a_\<beta> (Ge (CN 0 c e)) = (\<lambda>k. Ge (CN 0 1 (Mul (k div c) e)))" |
1366 "a_\<beta> (Ge (CN 0 c e)) = (\<lambda>k. Ge (CN 0 1 (Mul (k div c) e)))" |
1367 "a_\<beta> (Dvd i (CN 0 c e)) =(\<lambda>k. Dvd ((k div c)*i) (CN 0 1 (Mul (k div c) e)))" |
1367 "a_\<beta> (Dvd i (CN 0 c e)) =(\<lambda>k. Dvd ((k div c)*i) (CN 0 1 (Mul (k div c) e)))" |
1368 "a_\<beta> (NDvd i (CN 0 c e))=(\<lambda>k. NDvd ((k div c)*i) (CN 0 1 (Mul (k div c) e)))" |
1368 "a_\<beta> (NDvd i (CN 0 c e))=(\<lambda>k. NDvd ((k div c)*i) (CN 0 1 (Mul (k div c) e)))" |
1369 "a_\<beta> p = (\<lambda>k. p)" |
1369 "a_\<beta> p = (\<lambda>k. p)" |
1370 |
1370 |
1371 consts d_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> bool" -- \<open>test if all coeffs c of c divide a given l\<close> |
1371 consts d_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> bool" \<comment> \<open>test if all coeffs c of c divide a given l\<close> |
1372 recdef d_\<beta> "measure size" |
1372 recdef d_\<beta> "measure size" |
1373 "d_\<beta> (And p q) = (\<lambda>k. (d_\<beta> p k) \<and> (d_\<beta> q k))" |
1373 "d_\<beta> (And p q) = (\<lambda>k. (d_\<beta> p k) \<and> (d_\<beta> q k))" |
1374 "d_\<beta> (Or p q) = (\<lambda>k. (d_\<beta> p k) \<and> (d_\<beta> q k))" |
1374 "d_\<beta> (Or p q) = (\<lambda>k. (d_\<beta> p k) \<and> (d_\<beta> q k))" |
1375 "d_\<beta> (Eq (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1375 "d_\<beta> (Eq (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1376 "d_\<beta> (NEq (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1376 "d_\<beta> (NEq (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1380 "d_\<beta> (Ge (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1380 "d_\<beta> (Ge (CN 0 c e)) = (\<lambda>k. c dvd k)" |
1381 "d_\<beta> (Dvd i (CN 0 c e)) =(\<lambda>k. c dvd k)" |
1381 "d_\<beta> (Dvd i (CN 0 c e)) =(\<lambda>k. c dvd k)" |
1382 "d_\<beta> (NDvd i (CN 0 c e))=(\<lambda>k. c dvd k)" |
1382 "d_\<beta> (NDvd i (CN 0 c e))=(\<lambda>k. c dvd k)" |
1383 "d_\<beta> p = (\<lambda>k. True)" |
1383 "d_\<beta> p = (\<lambda>k. True)" |
1384 |
1384 |
1385 consts \<zeta> :: "fm \<Rightarrow> int" -- \<open>computes the lcm of all coefficients of x\<close> |
1385 consts \<zeta> :: "fm \<Rightarrow> int" \<comment> \<open>computes the lcm of all coefficients of x\<close> |
1386 recdef \<zeta> "measure size" |
1386 recdef \<zeta> "measure size" |
1387 "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)" |
1387 "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)" |
1388 "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)" |
1388 "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)" |
1389 "\<zeta> (Eq (CN 0 c e)) = c" |
1389 "\<zeta> (Eq (CN 0 c e)) = c" |
1390 "\<zeta> (NEq (CN 0 c e)) = c" |
1390 "\<zeta> (NEq (CN 0 c e)) = c" |
1432 "mirror (Ge (CN 0 c e)) = Le (CN 0 c (Neg e))" |
1432 "mirror (Ge (CN 0 c e)) = Le (CN 0 c (Neg e))" |
1433 "mirror (Dvd i (CN 0 c e)) = Dvd i (CN 0 c (Neg e))" |
1433 "mirror (Dvd i (CN 0 c e)) = Dvd i (CN 0 c (Neg e))" |
1434 "mirror (NDvd i (CN 0 c e)) = NDvd i (CN 0 c (Neg e))" |
1434 "mirror (NDvd i (CN 0 c e)) = NDvd i (CN 0 c (Neg e))" |
1435 "mirror p = p" |
1435 "mirror p = p" |
1436 |
1436 |
1437 text \<open>Lemmas for the correctness of @{text "\<sigma>_\<rho>"}\<close> |
1437 text \<open>Lemmas for the correctness of \<open>\<sigma>_\<rho>\<close>\<close> |
1438 |
1438 |
1439 lemma dvd1_eq1: |
1439 lemma dvd1_eq1: |
1440 fixes x :: int |
1440 fixes x :: int |
1441 shows "x > 0 \<Longrightarrow> x dvd 1 \<longleftrightarrow> x = 1" |
1441 shows "x > 0 \<Longrightarrow> x dvd 1 \<longleftrightarrow> x = 1" |
1442 by simp |
1442 by simp |