317 |
317 |
318 lemma tmmul_blt[simp]: "tmboundslt n t \<Longrightarrow> tmboundslt n (tmmul t i)" |
318 lemma tmmul_blt[simp]: "tmboundslt n t \<Longrightarrow> tmboundslt n (tmmul t i)" |
319 by (induct t arbitrary: i rule: tmmul.induct) (auto simp add: Let_def) |
319 by (induct t arbitrary: i rule: tmmul.induct) (auto simp add: Let_def) |
320 |
320 |
321 lemma tmmul_allpolys_npoly[simp]: |
321 lemma tmmul_allpolys_npoly[simp]: |
322 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
322 assumes "SORT_CONSTRAINT('a::field_char_0)" |
323 shows "allpolys isnpoly t \<Longrightarrow> isnpoly c \<Longrightarrow> allpolys isnpoly (tmmul t c)" |
323 shows "allpolys isnpoly t \<Longrightarrow> isnpoly c \<Longrightarrow> allpolys isnpoly (tmmul t c)" |
324 by (induct t rule: tmmul.induct) (simp_all add: Let_def polymul_norm) |
324 by (induct t rule: tmmul.induct) (simp_all add: Let_def polymul_norm) |
325 |
325 |
326 definition tmneg :: "tm \<Rightarrow> tm" |
326 definition tmneg :: "tm \<Rightarrow> tm" |
327 where "tmneg t \<equiv> tmmul t (C (- 1,1))" |
327 where "tmneg t \<equiv> tmmul t (C (- 1,1))" |
343 |
343 |
344 lemma [simp]: "isnpoly (C (-1, 1))" |
344 lemma [simp]: "isnpoly (C (-1, 1))" |
345 by (simp add: isnpoly_def) |
345 by (simp add: isnpoly_def) |
346 |
346 |
347 lemma tmneg_allpolys_npoly[simp]: |
347 lemma tmneg_allpolys_npoly[simp]: |
348 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
348 assumes "SORT_CONSTRAINT('a::field_char_0)" |
349 shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly (tmneg t)" |
349 shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly (tmneg t)" |
350 by (auto simp: tmneg_def) |
350 by (auto simp: tmneg_def) |
351 |
351 |
352 lemma tmsub[simp]: "Itm vs bs (tmsub a b) = Itm vs bs (Sub a b)" |
352 lemma tmsub[simp]: "Itm vs bs (tmsub a b) = Itm vs bs (Sub a b)" |
353 using tmsub_def by simp |
353 using tmsub_def by simp |
360 |
360 |
361 lemma tmsub_blt[simp]: "tmboundslt n t \<Longrightarrow> tmboundslt n s \<Longrightarrow> tmboundslt n (tmsub t s)" |
361 lemma tmsub_blt[simp]: "tmboundslt n t \<Longrightarrow> tmboundslt n s \<Longrightarrow> tmboundslt n (tmsub t s)" |
362 using tmsub_def by simp |
362 using tmsub_def by simp |
363 |
363 |
364 lemma tmsub_allpolys_npoly[simp]: |
364 lemma tmsub_allpolys_npoly[simp]: |
365 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
365 assumes "SORT_CONSTRAINT('a::field_char_0)" |
366 shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly s \<Longrightarrow> allpolys isnpoly (tmsub t s)" |
366 shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly s \<Longrightarrow> allpolys isnpoly (tmsub t s)" |
367 by (simp add: tmsub_def isnpoly_def) |
367 by (simp add: tmsub_def isnpoly_def) |
368 |
368 |
369 fun simptm :: "tm \<Rightarrow> tm" |
369 fun simptm :: "tm \<Rightarrow> tm" |
370 where |
370 where |
377 (let i' = polynate i in if i' = 0\<^sub>p then CP 0\<^sub>p else tmmul (simptm t) i')" |
377 (let i' = polynate i in if i' = 0\<^sub>p then CP 0\<^sub>p else tmmul (simptm t) i')" |
378 | "simptm (CNP n c t) = |
378 | "simptm (CNP n c t) = |
379 (let c' = polynate c in if c' = 0\<^sub>p then simptm t else tmadd (CNP n c' (CP 0\<^sub>p)) (simptm t))" |
379 (let c' = polynate c in if c' = 0\<^sub>p then simptm t else tmadd (CNP n c' (CP 0\<^sub>p)) (simptm t))" |
380 |
380 |
381 lemma polynate_stupid: |
381 lemma polynate_stupid: |
382 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
382 assumes "SORT_CONSTRAINT('a::field_char_0)" |
383 shows "polynate t = 0\<^sub>p \<Longrightarrow> Ipoly bs t = (0::'a)" |
383 shows "polynate t = 0\<^sub>p \<Longrightarrow> Ipoly bs t = (0::'a)" |
384 apply (subst polynate[symmetric]) |
384 apply (subst polynate[symmetric]) |
385 apply simp |
385 apply simp |
386 done |
386 done |
387 |
387 |
400 lemma [simp]: "isnpoly 0\<^sub>p" |
400 lemma [simp]: "isnpoly 0\<^sub>p" |
401 and [simp]: "isnpoly (C (1, 1))" |
401 and [simp]: "isnpoly (C (1, 1))" |
402 by (simp_all add: isnpoly_def) |
402 by (simp_all add: isnpoly_def) |
403 |
403 |
404 lemma simptm_allpolys_npoly[simp]: |
404 lemma simptm_allpolys_npoly[simp]: |
405 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
405 assumes "SORT_CONSTRAINT('a::field_char_0)" |
406 shows "allpolys isnpoly (simptm p)" |
406 shows "allpolys isnpoly (simptm p)" |
407 by (induct p rule: simptm.induct) (auto simp add: Let_def) |
407 by (induct p rule: simptm.induct) (auto simp add: Let_def) |
408 |
408 |
409 declare let_cong[fundef_cong del] |
409 declare let_cong[fundef_cong del] |
410 |
410 |
490 |
490 |
491 lemma allpolys_split0: "allpolys isnpoly p \<Longrightarrow> allpolys isnpoly (snd (split0 p))" |
491 lemma allpolys_split0: "allpolys isnpoly p \<Longrightarrow> allpolys isnpoly (snd (split0 p))" |
492 by (induct p rule: split0.induct) (auto simp add: isnpoly_def Let_def split_def) |
492 by (induct p rule: split0.induct) (auto simp add: isnpoly_def Let_def split_def) |
493 |
493 |
494 lemma isnpoly_fst_split0: |
494 lemma isnpoly_fst_split0: |
495 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
495 assumes "SORT_CONSTRAINT('a::field_char_0)" |
496 shows "allpolys isnpoly p \<Longrightarrow> isnpoly (fst (split0 p))" |
496 shows "allpolys isnpoly p \<Longrightarrow> isnpoly (fst (split0 p))" |
497 by (induct p rule: split0.induct) |
497 by (induct p rule: split0.induct) |
498 (auto simp add: polyadd_norm polysub_norm polyneg_norm polymul_norm Let_def split_def) |
498 (auto simp add: polyadd_norm polysub_norm polyneg_norm polymul_norm Let_def split_def) |
499 |
499 |
500 |
500 |
1170 definition "simple t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then le s else Le (CNP 0 c s))" |
1170 definition "simple t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then le s else Le (CNP 0 c s))" |
1171 definition "simpeq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then eq s else Eq (CNP 0 c s))" |
1171 definition "simpeq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then eq s else Eq (CNP 0 c s))" |
1172 definition "simpneq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then neq s else NEq (CNP 0 c s))" |
1172 definition "simpneq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then neq s else NEq (CNP 0 c s))" |
1173 |
1173 |
1174 lemma simplt_islin [simp]: |
1174 lemma simplt_islin [simp]: |
1175 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
1175 assumes "SORT_CONSTRAINT('a::field_char_0)" |
1176 shows "islin (simplt t)" |
1176 shows "islin (simplt t)" |
1177 unfolding simplt_def |
1177 unfolding simplt_def |
1178 using split0_nb0' |
1178 using split0_nb0' |
1179 by (auto simp add: lt_lin Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1179 by (auto simp add: lt_lin Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1180 islin_stupid allpolys_split0[OF simptm_allpolys_npoly]) |
1180 islin_stupid allpolys_split0[OF simptm_allpolys_npoly]) |
1181 |
1181 |
1182 lemma simple_islin [simp]: |
1182 lemma simple_islin [simp]: |
1183 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
1183 assumes "SORT_CONSTRAINT('a::field_char_0)" |
1184 shows "islin (simple t)" |
1184 shows "islin (simple t)" |
1185 unfolding simple_def |
1185 unfolding simple_def |
1186 using split0_nb0' |
1186 using split0_nb0' |
1187 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1187 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1188 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] le_lin) |
1188 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] le_lin) |
1189 |
1189 |
1190 lemma simpeq_islin [simp]: |
1190 lemma simpeq_islin [simp]: |
1191 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
1191 assumes "SORT_CONSTRAINT('a::field_char_0)" |
1192 shows "islin (simpeq t)" |
1192 shows "islin (simpeq t)" |
1193 unfolding simpeq_def |
1193 unfolding simpeq_def |
1194 using split0_nb0' |
1194 using split0_nb0' |
1195 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1195 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1196 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] eq_lin) |
1196 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] eq_lin) |
1197 |
1197 |
1198 lemma simpneq_islin [simp]: |
1198 lemma simpneq_islin [simp]: |
1199 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
1199 assumes "SORT_CONSTRAINT('a::field_char_0)" |
1200 shows "islin (simpneq t)" |
1200 shows "islin (simpneq t)" |
1201 unfolding simpneq_def |
1201 unfolding simpneq_def |
1202 using split0_nb0' |
1202 using split0_nb0' |
1203 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1203 by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] |
1204 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] neq_lin) |
1204 islin_stupid allpolys_split0[OF simptm_allpolys_npoly] neq_lin) |
1205 |
1205 |
1206 lemma really_stupid: "\<not> (\<forall>c1 s'. (c1, s') \<noteq> split0 s)" |
1206 lemma really_stupid: "\<not> (\<forall>c1 s'. (c1, s') \<noteq> split0 s)" |
1207 by (cases "split0 s") auto |
1207 by (cases "split0 s") auto |
1208 |
1208 |
1209 lemma split0_npoly: |
1209 lemma split0_npoly: |
1210 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
1210 assumes "SORT_CONSTRAINT('a::field_char_0)" |
1211 and *: "allpolys isnpoly t" |
1211 and *: "allpolys isnpoly t" |
1212 shows "isnpoly (fst (split0 t))" |
1212 shows "isnpoly (fst (split0 t))" |
1213 and "allpolys isnpoly (snd (split0 t))" |
1213 and "allpolys isnpoly (snd (split0 t))" |
1214 using * |
1214 using * |
1215 by (induct t rule: split0.induct) |
1215 by (induct t rule: split0.induct) |
3625 using lp tnb |
3625 using lp tnb |
3626 by (induct p c t rule: msubstpos.induct) |
3626 by (induct p c t rule: msubstpos.induct) |
3627 (auto simp add: msubsteq2_nb msubstltpos_nb msubstlepos_nb) |
3627 (auto simp add: msubsteq2_nb msubstltpos_nb msubstlepos_nb) |
3628 |
3628 |
3629 lemma msubstneg_nb: |
3629 lemma msubstneg_nb: |
3630 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
3630 assumes "SORT_CONSTRAINT('a::field_char_0)" |
3631 and lp: "islin p" |
3631 and lp: "islin p" |
3632 and tnb: "tmbound0 t" |
3632 and tnb: "tmbound0 t" |
3633 shows "bound0 (msubstneg p c t)" |
3633 shows "bound0 (msubstneg p c t)" |
3634 using lp tnb |
3634 using lp tnb |
3635 by (induct p c t rule: msubstneg.induct) |
3635 by (induct p c t rule: msubstneg.induct) |
3636 (auto simp add: msubsteq2_nb msubstltneg_nb msubstleneg_nb) |
3636 (auto simp add: msubsteq2_nb msubstltneg_nb msubstleneg_nb) |
3637 |
3637 |
3638 lemma msubst2_nb: |
3638 lemma msubst2_nb: |
3639 assumes "SORT_CONSTRAINT('a::{field_char_0,field})" |
3639 assumes "SORT_CONSTRAINT('a::field_char_0)" |
3640 and lp: "islin p" |
3640 and lp: "islin p" |
3641 and tnb: "tmbound0 t" |
3641 and tnb: "tmbound0 t" |
3642 shows "bound0 (msubst2 p c t)" |
3642 shows "bound0 (msubst2 p c t)" |
3643 using lp tnb |
3643 using lp tnb |
3644 by (simp add: msubst2_def msubstneg_nb msubstpos_nb lt_nb simpfm_bound0) |
3644 by (simp add: msubst2_def msubstneg_nb msubstpos_nb lt_nb simpfm_bound0) |