[STATEMENT]
lemma homeomorphism_scaleR:
  "homeomorphism UNIV UNIV (\<lambda>x. c *\<^sub>R x::_::real_normed_vector) (\<lambda>x. x /\<^sub>R c)"
  if "c \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism UNIV UNIV ((*\<^sub>R) c) (\<lambda>x. x /\<^sub>R c)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. homeomorphism UNIV UNIV ((*\<^sub>R) c) (\<lambda>x. x /\<^sub>R c)
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. (\<forall>x\<in>UNIV. c *\<^sub>R x /\<^sub>R c = x) \<and> surj ((*\<^sub>R) c) \<and> continuous_on UNIV ((*\<^sub>R) c) \<and> (\<forall>y\<in>UNIV. c *\<^sub>R (y /\<^sub>R c) = y) \<and> surj ((*\<^sub>R) (inverse c)) \<and> continuous_on UNIV ((*\<^sub>R) (inverse c))
[PROOF STEP]
by (auto simp: in_range_scaleR_iff algebra_simps intro!: continuous_intros)


[STATEMENT]
lemma fold_rev:
  "(\<And>x y. x \<in> set xs \<Longrightarrow> y \<in> set xs \<Longrightarrow> f y \<circ> f x = f x \<circ> f y)
  \<Longrightarrow> fold f (rev xs) = fold f xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> f y \<circ> f x = f x \<circ> f y) \<Longrightarrow> fold f (rev xs) = fold f xs
[PROOF STEP]
by (induct xs) (simp_all add: fold_commute_apply fun_eq_iff)


[STATEMENT]
lemma "Collect (boolean_function_from_simplicial_complex K) = (bool_vec_set_from_simplice_set K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Collect (boolean_function_from_simplicial_complex K) = bool_vec_set_from_simplice_set K
[PROOF STEP]
unfolding boolean_function_from_simplicial_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x \<in> bool_vec_set_from_simplice_set K} = bool_vec_set_from_simplice_set K
[PROOF STEP]
by simp


[STATEMENT]
lemma path_component_eq_connected_component_of:
  assumes "locally_path_connected_space X"
  shows "(path_component_of_set X x = connected_component_of_set X x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
proof (cases "x \<in> topspace X")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
 2. x \<notin> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> topspace X

goal (2 subgoals):
 1. x \<in> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
 2. x \<notin> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> topspace X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> topspace X

goal (1 subgoal):
 1. path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
using connectedin_connected_component_of [of X x]
[PROOF STATE]
proof (prove)
using this:
x \<in> topspace X
connectedin X (connected_component_of_set X x)

goal (1 subgoal):
 1. path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
apply (clarsimp simp add: connectedin_def connected_space_clopen_in topspace_subtopology_subset cong: conj_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> topspace X; connected_component_of_set X x \<subseteq> topspace X; \<forall>T. openin (subtopology X (connected_component_of_set X x)) T \<and> closedin (subtopology X (connected_component_of_set X x)) T \<longrightarrow> T = {} \<or> T = topspace X \<inter> connected_component_of_set X x\<rbrakk> \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
apply (drule_tac x="path_component_of_set X x" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> topspace X; connected_component_of_set X x \<subseteq> topspace X; openin (subtopology X (connected_component_of_set X x)) (path_component_of_set X x) \<and> closedin (subtopology X (connected_component_of_set X x)) (path_component_of_set X x) \<longrightarrow> path_component_of_set X x = {} \<or> path_component_of_set X x = topspace X \<inter> connected_component_of_set X x\<rbrakk> \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
by (metis assms closedin_closed_subtopology closedin_connected_component_of closedin_path_component_of_locally_path_connected_space inf.absorb_iff2 inf.orderE openin_path_component_of_locally_path_connected_space openin_subtopology path_component_of_eq_empty path_component_subset_connected_component_of)
[PROOF STATE]
proof (state)
this:
path_component_of_set X x = connected_component_of_set X x

goal (1 subgoal):
 1. x \<notin> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> topspace X

goal (1 subgoal):
 1. x \<notin> topspace X \<Longrightarrow> path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> topspace X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<notin> topspace X

goal (1 subgoal):
 1. path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
using connected_component_of_eq_empty path_component_of_eq_empty
[PROOF STATE]
proof (prove)
using this:
x \<notin> topspace X
(connected_component_of_set ?X ?x = {}) = (?x \<notin> topspace ?X)
(path_component_of_set ?X ?x = {}) = (?x \<notin> topspace ?X)

goal (1 subgoal):
 1. path_component_of_set X x = connected_component_of_set X x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
path_component_of_set X x = connected_component_of_set X x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma outer_measure_empty:
  "positive M f \<Longrightarrow> {} \<in> M \<Longrightarrow> outer_measure M f {} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>positive M f; {} \<in> M\<rbrakk> \<Longrightarrow> outer_measure M f {} = 0
[PROOF STEP]
unfolding outer_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>positive M f; {} \<in> M\<rbrakk> \<Longrightarrow> (INF A\<in>{A. range A \<subseteq> M \<and> disjoint_family A \<and> {} \<subseteq> \<Union> (range A)}. \<Sum>i. f (A i)) = 0
[PROOF STEP]
by (intro antisym INF_lower2[of  "\<lambda>_. {}"]) (auto simp: disjoint_family_on_def positive_def)


[STATEMENT]
lemma Legendre_prod_mset [simp]: "prime p \<Longrightarrow> Legendre (prod_mset M) p = (\<Prod>q\<in>#M. Legendre q p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> Legendre (\<Prod>\<^sub># M) p = (\<Prod>q\<in>#M. Legendre q p)
[PROOF STEP]
by (induction M) simp_all


[STATEMENT]
lemma take_bit_eq_mask_iff_exp_dvd:
  \<open>take_bit n k = mask n \<longleftrightarrow> 2 ^ n dvd k + 1\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take_bit n k = mask n) = (2 ^ n dvd k + 1)
[PROOF STEP]
by (simp add: take_bit_eq_mask_iff flip: take_bit_eq_0_iff)


[STATEMENT]
lemma poly_function_tuple_comp_add:
  assumes "is_function_tuple R n fs"
  assumes "k \<le>length fs"
  assumes "p \<in> carrier (coord_ring R k)"
  assumes "Q \<in> carrier (coord_ring R k)"
  assumes "x \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> Q) x =
          (poly_function_tuple_comp R n fs p x) \<oplus> (poly_function_tuple_comp R n fs Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
have 0: "p \<in> carrier (coord_ring R (length fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
using assms poly_ring_car_mono[of k "length fs"]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
x \<in> carrier (R\<^bsup>n\<^esup>)
k \<le> length fs \<Longrightarrow> carrier (R [\<X>\<^bsub>k\<^esub>]) \<subseteq> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
have 1: "Q \<in> carrier (coord_ring R (length fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
using assms poly_ring_car_mono[of k "length fs"]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
x \<in> carrier (R\<^bsup>n\<^esup>)
k \<le> length fs \<Longrightarrow> carrier (R [\<X>\<^bsub>k\<^esub>]) \<subseteq> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
using assms(1) assms(5) 0 1 R.Pring_add_eq[of ]
        poly_function_tuple_comp_eq
        function_tuple_eval_closed[of R n fs x]
        eval_at_point_add[of "function_tuple_eval R n fs x" "length fs" p Q]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
x \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
(\<oplus>\<^bsub>Pring R ?I\<^esub>) = (\<oplus>\<^bsub>Pring R ?J\<^esub>)
\<lbrakk>is_function_tuple R ?n ?fs; ?f \<in> carrier (R [\<X>\<^bsub>length ?fs\<^esub>]); ?a \<in> carrier (R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> poly_function_tuple_comp R ?n ?fs ?f ?a = eval_at_point R (function_tuple_eval R ?n ?fs ?a) ?f
\<lbrakk>is_function_tuple R n fs; x \<in> carrier (R\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)
\<lbrakk>function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>); p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>]); Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])\<rbrakk> \<Longrightarrow> eval_at_point R (function_tuple_eval R n fs x) (p \<oplus>\<^bsub>R [\<X>\<^bsub>length fs\<^esub>]\<^esub> Q) = eval_at_point R (function_tuple_eval R n fs x) p \<oplus> eval_at_point R (function_tuple_eval R n fs x) Q

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
x \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (Pring R {..<length fs})
Q \<in> carrier (Pring R {..<length fs})
(\<oplus>\<^bsub>Pring R ?I\<^esub>) = (\<oplus>\<^bsub>Pring R ?J\<^esub>)
\<lbrakk>is_function_tuple R ?n ?fs; ?f \<in> carrier (Pring R {..<length ?fs}); ?a \<in> carrier (R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> poly_function_tuple_comp R ?n ?fs ?f ?a = eval_at_point R (function_tuple_eval R ?n ?fs ?a) ?f
\<lbrakk>is_function_tuple R n fs; x \<in> carrier (R\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)
\<lbrakk>function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>); p \<in> carrier (Pring R {..<length fs}); Q \<in> carrier (Pring R {..<length fs})\<rbrakk> \<Longrightarrow> eval_at_point R (function_tuple_eval R n fs x) (p \<oplus>\<^bsub>Pring R {..<length fs}\<^esub> Q) = eval_at_point R (function_tuple_eval R n fs x) p \<oplus> eval_at_point R (function_tuple_eval R n fs x) Q

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>Pring R {..<n}\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
by (metis R.Pring_add_closed)
[PROOF STATE]
proof (state)
this:
poly_function_tuple_comp R n fs (p \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<oplus> poly_function_tuple_comp R n fs Q x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma combine_l_distr:
  "\<lbrakk> set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R \<rbrakk> \<Longrightarrow>
     u \<in> carrier R \<Longrightarrow> (combine Ks Us) \<otimes> u = combine Ks (map (\<lambda>u'. u' \<otimes> u) Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; u \<in> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<otimes> u = combine Ks (map (\<lambda>u'. u' \<otimes> u) Us)
[PROOF STEP]
by (induct Ks Us rule: combine.induct) (auto simp add: m_assoc l_distr)


[STATEMENT]
lemma semigroup_add_on_with_Ball_def: "semigroup_add_on_with S pls \<longleftrightarrow>
  (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>c\<in>S. pls (pls a b) c = pls a (pls b c)) \<and> (\<forall>a\<in>S. \<forall>b\<in>S. pls a b \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semigroup_add_on_with S pls = ((\<forall>a\<in>S. \<forall>b\<in>S. \<forall>c\<in>S. pls (pls a b) c = pls a (pls b c)) \<and> (\<forall>a\<in>S. \<forall>b\<in>S. pls a b \<in> S))
[PROOF STEP]
by (auto simp: semigroup_add_on_with_def)


[STATEMENT]
lemma less_Cons:
  "(x # xs) <\<^sub>v (y # ys) \<longleftrightarrow> length xs = length ys \<and> (x \<le> y \<and> xs <\<^sub>v ys \<or> x < y \<and> xs \<le>\<^sub>v ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs <\<^sub>v y # ys) = (length xs = length ys \<and> (x \<le> y \<and> xs <\<^sub>v ys \<or> x < y \<and> xs \<le>\<^sub>v ys))
[PROOF STEP]
by (simp add: less_def less_eq_def All_less_Suc2) (auto dest: leD)


[STATEMENT]
lemma UNIV_disjoint: "{x. x < dim_vec a \<and> vec_index (a::bool vec) x = True}
  \<inter> {x. x < dim_vec a \<and> vec_index (a::bool vec) x = False} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x < dim_vec a \<and> a $ x = True} \<inter> {x. x < dim_vec a \<and> a $ x = False} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma affine_alg_set_empty_set:
  assumes "as = {}"
  shows " affine_alg_set R n as = carrier (R\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine_alg_set R n as = carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
unfolding affine_alg_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>as. a \<in> V n b} = carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
as = {}

goal (1 subgoal):
 1. {a \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>as. a \<in> V n b} = carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
by blast


[STATEMENT]
lemma transitive:
  "-x \<le> -y \<Longrightarrow> -y \<le> -z \<Longrightarrow> -x \<le> -z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- x \<le> - y; - y \<le> - z\<rbrakk> \<Longrightarrow> - x \<le> - z
[PROOF STEP]
by (metis sub_associative sub_less_eq_def)


[STATEMENT]
lemma closed_Collect_le:
  fixes f g :: "'a :: topological_space \<Rightarrow> 'b::linorder_topology"
  assumes f: "continuous_on UNIV f"
    and g: "continuous_on UNIV g"
  shows "closed {x. f x \<le> g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. f x \<le> g x}
[PROOF STEP]
using open_Collect_less [OF g f]
[PROOF STATE]
proof (prove)
using this:
open {x. g x < f x}

goal (1 subgoal):
 1. closed {x. f x \<le> g x}
[PROOF STEP]
by (simp add: closed_def Collect_neg_eq[symmetric] not_le)


[STATEMENT]
theorem Stirling_fps_altdef: "Stirling_fps m = Abs_fps (\<lambda>n. Stirling n m / fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stirling_fps m = Abs_fps (\<lambda>n. real (Stirling n m) / fact n)
[PROOF STEP]
by (simp add: fps_eq_iff Stirling_fps_nth)


[STATEMENT]
lemma Sup_downset_adj: "(Sup::'a::complete_lattice set \<Rightarrow> 'a) \<stileturn> \<down>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup \<stileturn> \<down>
[PROOF STEP]
unfolding adj_def downset_prop Sup_le_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (\<forall>a\<in>x. a \<le> y) = (x \<subseteq> {ya. ya \<le> y})
[PROOF STEP]
by force


[STATEMENT]
lemma twisted_cartesian_product_memE:
  assumes "a \<in> twisted_cartesian_product S S' A B"
  shows "\<pi>\<^bsub>S\<^esub> a \<in> A" "\<pi>\<^bsub>S'\<^esub> a \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths a S \<in> A &&& nths a S' \<in> B
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> Prod\<^bsub>S, S'\<^esub> A B

goal (1 subgoal):
 1. nths a S \<in> A &&& nths a S' \<in> B
[PROOF STEP]
unfolding twisted_cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
a \<in> {a. length a = card S + card S' \<and> nths a S \<in> A \<and> nths a S' \<in> B}

goal (1 subgoal):
 1. nths a S \<in> A &&& nths a S' \<in> B
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths a S' \<in> B
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> Prod\<^bsub>S, S'\<^esub> A B

goal (1 subgoal):
 1. nths a S' \<in> B
[PROOF STEP]
unfolding twisted_cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
a \<in> {a. length a = card S + card S' \<and> nths a S \<in> A \<and> nths a S' \<in> B}

goal (1 subgoal):
 1. nths a S' \<in> B
[PROOF STEP]
by blast


[STATEMENT]
lemma tendsto_prod [tendsto_intros]:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::{real_normed_algebra,comm_ring_1}"
  shows "(\<And>i. i \<in> S \<Longrightarrow> (f i \<longlongrightarrow> L i) F) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>S. f i x) \<longlongrightarrow> (\<Prod>i\<in>S. L i)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> S \<Longrightarrow> (f i \<longlongrightarrow> L i) F) \<Longrightarrow> ((\<lambda>x. \<Prod>i\<in>S. f i x) \<longlongrightarrow> prod L S) F
[PROOF STEP]
by (induct S rule: infinite_finite_induct) (simp_all add: tendsto_mult)


[STATEMENT]
lemma hom_components_monom_mult:
  "hom_components (punit.monom_mult c t p) = (if c = 0 then {} else punit.monom_mult c t ` hom_components p)"
  for c::"'a::semiring_no_zero_divisors"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_components (punit.monom_mult c t p) = (if c = (0::'a) then {} else punit.monom_mult c t ` hom_components p)
[PROOF STEP]
by (simp add: hom_components_def punit.keys_monom_mult image_image deg_pm_plus hom_component_monom_mult)


[STATEMENT]
lemma centered_cbox_in_cball:
  shows "cbox (- r *\<^sub>R One) (r *\<^sub>R One::'a::euclidean_space) \<subseteq>
    cball 0 (sqrt(DIM('a)) * r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<subseteq> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
fix x::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
have "norm x \<le> sqrt(DIM('a)) * infnorm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x \<le> sqrt (real DIM('a)) * infnorm x
[PROOF STEP]
by (rule norm_le_infnorm)
[PROOF STATE]
proof (state)
this:
norm x \<le> sqrt (real DIM('a)) * infnorm x

goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm x \<le> sqrt (real DIM('a)) * infnorm x

goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
assume "x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One)"
[PROOF STATE]
proof (state)
this:
x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One)

goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
hence "infnorm x \<le> r"
[PROOF STATE]
proof (prove)
using this:
x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One)

goal (1 subgoal):
 1. infnorm x \<le> r
[PROOF STEP]
by (auto simp: infnorm_def mem_box intro!: cSup_least)
[PROOF STATE]
proof (state)
this:
infnorm x \<le> r

goal (1 subgoal):
 1. \<And>x. x \<in> cbox (- r *\<^sub>R One) (r *\<^sub>R One) \<Longrightarrow> x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> sqrt (real DIM('a)) * x \<le> sqrt (real DIM('a)) * y) \<Longrightarrow> norm x \<le> sqrt (real DIM('a)) * r
[PROOF STEP]
show "x \<in> cball 0 (sqrt(DIM('a)) * r)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> sqrt (real DIM('a)) * x \<le> sqrt (real DIM('a)) * y) \<Longrightarrow> norm x \<le> sqrt (real DIM('a)) * r

goal (1 subgoal):
 1. x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)
[PROOF STEP]
by (auto simp: dist_norm mult_left_mono mem_cball)
[PROOF STATE]
proof (state)
this:
x \<in> cball (0::'a) (sqrt (real DIM('a)) * r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_takeWhile_less:
  "\<lbrakk> a \<in> set xs; \<not> P a \<rbrakk> \<Longrightarrow> length (takeWhile P xs) < length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> set xs; \<not> P a\<rbrakk> \<Longrightarrow> length (takeWhile P xs) < length xs
[PROOF STEP]
by (metis in_set_conv_nth length_takeWhile_le nat_neq_iff not_less set_takeWhileD takeWhile_nth)


[STATEMENT]
lemma hsgn_zero [simp]: "hsgn 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hsgn 0 = 0
[PROOF STEP]
by transfer (rule sgn_zero)


[STATEMENT]
theorem bs_insert_correct:
  assumes I: "bs_invar h"
  shows
  "bs_invar (bs_insert e a h)"
  "bs_to_mset (bs_insert e a h) = {#(e,a)#} + bs_to_mset h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs_invar (bs_insert e a h) &&& bs_to_mset (bs_insert e a h) = {#(e, a)#} + bs_to_mset h
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
bs_invar h

goal (1 subgoal):
 1. bs_invar (bs_insert e a h) &&& bs_to_mset (bs_insert e a h) = {#(e, a)#} + bs_to_mset h
[PROOF STEP]
apply (case_tac [!] h)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>aa. \<lbrakk>bs_invar h; h = Inl aa\<rbrakk> \<Longrightarrow> bs_invar (bs_insert e a h)
 2. \<And>b. \<lbrakk>bs_invar h; h = Inr b\<rbrakk> \<Longrightarrow> bs_invar (bs_insert e a h)
 3. \<And>aa. \<lbrakk>bs_invar h; h = Inl aa\<rbrakk> \<Longrightarrow> bs_to_mset (bs_insert e a h) = {#(e, a)#} + bs_to_mset h
 4. \<And>b. \<lbrakk>bs_invar h; h = Inr b\<rbrakk> \<Longrightarrow> bs_to_mset (bs_insert e a h) = {#(e, a)#} + bs_to_mset h
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. \<lbrakk>elem_invar b; h = Inr b\<rbrakk> \<Longrightarrow> elem_invar (meld' (Element e a []) b)
 2. \<And>b. \<lbrakk>elem_invar b; h = Inr b\<rbrakk> \<Longrightarrow> elem_to_mset (meld' (Element e a []) b) = add_mset (e, a) (elem_to_mset b)
[PROOF STEP]
apply (auto simp add: meld_correct')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma multisets_union [simp]:
  "M \<in> multisets A \<Longrightarrow> N \<in> multisets A \<Longrightarrow> M + N \<in> multisets A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<in> multisets A; N \<in> multisets A\<rbrakk> \<Longrightarrow> M + N \<in> multisets A
[PROOF STEP]
by (auto simp add: in_multisets_iff)


[STATEMENT]
lemma projecting_INT:
     "[| !!i. i \<in> I ==> projecting C h F (X' i) (X i) |]
      ==> projecting C h F (\<Inter>i \<in> I. X' i) (\<Inter>i \<in> I. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> projecting C h F (X' i) (X i)) \<Longrightarrow> projecting C h F (\<Inter> (X' ` I)) (\<Inter> (X ` I))
[PROOF STEP]
by (unfold projecting_def, blast)


[STATEMENT]
lemma resultant_zero_iff_common_root_irreducible: fixes f g :: "'a :: field poly"
  assumes irr: "irreducible g"
  and root: "poly g a = 0" (* g has at least some root *)
shows "resultant f g = 0 \<longleftrightarrow> (\<exists> x. poly f x = 0 \<and> poly g x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a))
[PROOF STEP]
from irr root
[PROOF STATE]
proof (chain)
picking this:
irreducible g
poly g a = (0::'a)
[PROOF STEP]
have deg: "degree g \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
irreducible g
poly g a = (0::'a)

goal (1 subgoal):
 1. degree g \<noteq> 0
[PROOF STEP]
using degree0_coeffs[of g]
[PROOF STATE]
proof (prove)
using this:
irreducible g
poly g a = (0::'a)
degree g = 0 \<Longrightarrow> \<exists>a. g = [:a:]

goal (1 subgoal):
 1. degree g \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
degree g \<noteq> 0

goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (resultant f g = (0::'a)) = (\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
 2. \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a) \<Longrightarrow> resultant f g = (0::'a)
[PROOF STEP]
assume "\<exists> x. poly f x = 0 \<and> poly g x = 0"
[PROOF STATE]
proof (state)
this:
\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)

goal (2 subgoals):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
 2. \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a) \<Longrightarrow> resultant f g = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
obtain x where "poly f x = 0" "poly g x = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>poly f x = (0::'a); poly g x = (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly f x = (0::'a)
poly g x = (0::'a)

goal (2 subgoals):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
 2. \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a) \<Longrightarrow> resultant f g = (0::'a)
[PROOF STEP]
from resultant_zero[OF _ this] deg
[PROOF STATE]
proof (chain)
picking this:
0 < degree f \<or> 0 < degree g \<Longrightarrow> resultant f g = (0::'a)
degree g \<noteq> 0
[PROOF STEP]
show "resultant f g = 0"
[PROOF STATE]
proof (prove)
using this:
0 < degree f \<or> 0 < degree g \<Longrightarrow> resultant f g = (0::'a)
degree g \<noteq> 0

goal (1 subgoal):
 1. resultant f g = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
resultant f g = (0::'a)

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
assume "resultant f g = 0"
[PROOF STATE]
proof (state)
this:
resultant f g = (0::'a)

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
from resultant_zero_imp_common_factor[OF _ this] deg
[PROOF STATE]
proof (chain)
picking this:
0 < degree f \<or> 0 < degree g \<Longrightarrow> \<not> comm_monoid_mult_class.coprime f g
degree g \<noteq> 0
[PROOF STEP]
have "\<not> coprime f g"
[PROOF STATE]
proof (prove)
using this:
0 < degree f \<or> 0 < degree g \<Longrightarrow> \<not> comm_monoid_mult_class.coprime f g
degree g \<noteq> 0

goal (1 subgoal):
 1. \<not> comm_monoid_mult_class.coprime f g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> comm_monoid_mult_class.coprime f g

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
from this[unfolded not_coprime_iff_common_factor]
[PROOF STATE]
proof (chain)
picking this:
\<exists>r. r dvd f \<and> r dvd g \<and> \<not> is_unit r
[PROOF STEP]
obtain r where
       rf: "r dvd f" and rg: "r dvd g" and r: "\<not> is_unit r"
[PROOF STATE]
proof (prove)
using this:
\<exists>r. r dvd f \<and> r dvd g \<and> \<not> is_unit r

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>r dvd f; r dvd g; \<not> is_unit r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r dvd f
r dvd g
\<not> is_unit r

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
from rg r irr
[PROOF STATE]
proof (chain)
picking this:
r dvd g
\<not> is_unit r
irreducible g
[PROOF STEP]
have "g dvd r"
[PROOF STATE]
proof (prove)
using this:
r dvd g
\<not> is_unit r
irreducible g

goal (1 subgoal):
 1. g dvd r
[PROOF STEP]
by (meson algebraic_semidom_class.irreducible_altdef)
[PROOF STATE]
proof (state)
this:
g dvd r

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
with rf
[PROOF STATE]
proof (chain)
picking this:
r dvd f
g dvd r
[PROOF STEP]
have "g dvd f"
[PROOF STATE]
proof (prove)
using this:
r dvd f
g dvd r

goal (1 subgoal):
 1. g dvd f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g dvd f

goal (1 subgoal):
 1. resultant f g = (0::'a) \<Longrightarrow> \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
with root
[PROOF STATE]
proof (chain)
picking this:
poly g a = (0::'a)
g dvd f
[PROOF STEP]
show "\<exists> x. poly f x = 0 \<and> poly g x = 0"
[PROOF STATE]
proof (prove)
using this:
poly g a = (0::'a)
g dvd f

goal (1 subgoal):
 1. \<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)
[PROOF STEP]
by (intro exI[of _ a], auto simp: dvd_def)
[PROOF STATE]
proof (state)
this:
\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(resultant f g = (0::'a)) = (\<exists>x. poly f x = (0::'a) \<and> poly g x = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_degree_factorize_main_i:
  "poly_rel F f \<Longrightarrow> poly_rel G g \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) Res res
   \<Longrightarrow> list_all2 (rel_prod (=) poly_rel)
      (dist_degree_factorize_main_i p ff_ops
         (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res)
      (dist_degree_factorize_main f g d res)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>poly_rel F f; poly_rel G g; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main f g d res)
[PROOF STEP]
proof (induct f g d res arbitrary: F G Res rule: dist_degree_factorize_main.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case (1 v w d res V W Res)
[PROOF STATE]
proof (state)
this:
\<lbrakk>v \<noteq> 1; \<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb = 1; poly_rel ?F v; poly_rel ?G ?x; list_all2 (rel_prod (=) poly_rel) ?Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main v ?x ?xa res)
\<lbrakk>v \<noteq> 1; \<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb \<noteq> 1; ?xc = v div ?xb; poly_rel ?F ?xc; poly_rel ?G (?x mod ?xc); list_all2 (rel_prod (=) poly_rel) ?Res ((?xa, ?xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main ?xc (?x mod ?xc) ?xa ((?xa, ?xb) # res))
poly_rel V v
poly_rel W w
list_all2 (rel_prod (=) poly_rel) Res res

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
let ?ze = "arith_ops_record.zero ff_ops"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
let ?on = "arith_ops_record.one ff_ops"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = dist_degree_factorize_main.simps[of v w d]
    dist_degree_factorize_main_i.simps[of p ff_ops ?ze ?on "degree_i V" V W d]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (if v = 1 then ?res else if degree v < d + d then (degree v, v) # ?res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d ?res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d ?res = (if V = [arith_ops_record.one ff_ops] then ?res else if degree_i V < d + d then (degree_i V, V) # ?res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V w d ?res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # ?res))

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have v[transfer_rule]: "poly_rel V v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel V v
[PROOF STEP]
by (rule 1)
[PROOF STATE]
proof (state)
this:
poly_rel V v

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have w[transfer_rule]: "poly_rel W w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel W w
[PROOF STEP]
by (rule 1)
[PROOF STATE]
proof (state)
this:
poly_rel W w

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have res[transfer_rule]: "list_all2 (rel_prod (=) poly_rel) Res res"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) Res res
[PROOF STEP]
by (rule 1)
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) Res res

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have [transfer_rule]: "poly_rel [?on] 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel [arith_ops_record.one ff_ops] 1
[PROOF STEP]
by (simp add: one poly_rel_def)
[PROOF STATE]
proof (state)
this:
poly_rel [arith_ops_record.one ff_ops] 1

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have id1: "(V = [?on]) = (v = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V = [arith_ops_record.one ff_ops]) = (v = 1)
[PROOF STEP]
unfolding finite_field_ops_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V = [arith_ops_record.one ff_ops]) = (v = 1)
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
(V = [arith_ops_record.one ff_ops]) = (v = 1)

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have id2: "degree_i V = degree v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_i V = degree v
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
degree_i V = degree v

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded id1 id2]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (if v = 1 then ?res else if degree v < d + d then (degree v, v) # ?res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d ?res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = (if v = 1 then ?res else if degree v < d + d then (degree v, V) # ?res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d ?res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # ?res))

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note IH = 1(1,2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>v \<noteq> 1; \<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb = 1; poly_rel ?F v; poly_rel ?G ?x; list_all2 (rel_prod (=) poly_rel) ?Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main v ?x ?xa res)
\<lbrakk>v \<noteq> 1; \<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb \<noteq> 1; ?xc = v div ?xb; poly_rel ?F ?xc; poly_rel ?G (?x mod ?xc); list_all2 (rel_prod (=) poly_rel) ?Res ((?xa, ?xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main ?xc (?x mod ?xc) ?xa ((?xa, ?xb) # res))

goal (1 subgoal):
 1. \<And>v w d res F G Res. \<lbrakk>\<And>x xa xb F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb = 1; poly_rel F v; poly_rel G x; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main v x xa res); \<And>x xa xb xc F G Res. \<lbrakk>v \<noteq> 1; \<not> degree v < d + d; x = w ^ CARD('a) mod v; xa = Suc d; xb = gcd (x - monom 1 1) v; xb \<noteq> 1; xc = v div xb; poly_rel F xc; poly_rel G (x mod xc); list_all2 (rel_prod (=) poly_rel) Res ((xa, xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G xa Res) (dist_degree_factorize_main xc (x mod xc) xa ((xa, xb) # res)); poly_rel F v; poly_rel G w; list_all2 (rel_prod (=) poly_rel) Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i F) F G d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
proof (cases "v = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v = 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
v = 1

goal (2 subgoals):
 1. v = 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
with res
[PROOF STATE]
proof (chain)
picking this:
list_all2 (rel_prod (=) poly_rel) Res res
v = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod (=) poly_rel) Res res
v = 1

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
unfolding id2 simp
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod (=) poly_rel) Res res
v = 1

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (if v = 1 then Res else if degree v < d + d then (degree v, V) # Res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d Res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # Res)) (if v = 1 then res else if degree v < d + d then (degree v, v) # res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # res))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
v \<noteq> 1

goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
with id1
[PROOF STATE]
proof (chain)
picking this:
(V = [arith_ops_record.one ff_ops]) = (v = 1)
v \<noteq> 1
[PROOF STEP]
have "(v = 1) = False"
[PROOF STATE]
proof (prove)
using this:
(V = [arith_ops_record.one ff_ops]) = (v = 1)
v \<noteq> 1

goal (1 subgoal):
 1. (v = 1) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(v = 1) = False

goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded this if_False]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (if degree v < d + d then (degree v, v) # ?res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d ?res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = (if degree v < d + d then (degree v, V) # ?res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d ?res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # ?res))

goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note IH = IH[OF False]
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb = 1; poly_rel ?F v; poly_rel ?G ?x; list_all2 (rel_prod (=) poly_rel) ?Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main v ?x ?xa res)
\<lbrakk>\<not> degree v < d + d; ?x = w ^ CARD('a) mod v; ?xa = Suc d; ?xb = gcd (?x - monom 1 1) v; ?xb \<noteq> 1; ?xc = v div ?xb; poly_rel ?F ?xc; poly_rel ?G (?x mod ?xc); list_all2 (rel_prod (=) poly_rel) ?Res ((?xa, ?xb) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G ?xa ?Res) (dist_degree_factorize_main ?xc (?x mod ?xc) ?xa ((?xa, ?xb) # res))

goal (1 subgoal):
 1. v \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
proof (cases "degree v < d + d")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
degree v < d + d

goal (2 subgoals):
 1. degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
degree v < d + d

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
unfolding id2 simp
[PROOF STATE]
proof (prove)
using this:
degree v < d + d

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (if degree v < d + d then (degree v, V) # Res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d Res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # Res)) (if degree v < d + d then (degree v, v) # res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # res))
[PROOF STEP]
using res v
[PROOF STATE]
proof (prove)
using this:
degree v < d + d
list_all2 (rel_prod (=) poly_rel) Res res
poly_rel V v

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (if degree v < d + d then (degree v, V) # Res else let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d Res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # Res)) (if degree v < d + d then (degree v, v) # res else let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # res))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> degree v < d + d

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
hence "(degree v < d + d) = False"
[PROOF STATE]
proof (prove)
using this:
\<not> degree v < d + d

goal (1 subgoal):
 1. (degree v < d + d) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(degree v < d + d) = False

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded this if_False]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (let w = w ^ CARD('a) mod v; d = Suc d; gd = gcd (w - monom 1 1) v in if gd = 1 then dist_degree_factorize_main v w d ?res else let v' = v div gd in dist_degree_factorize_main v' (w mod v') d ((d, gd) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = (let w = power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p); d = Suc d; gd = gcd_poly_i ff_ops (minus_poly_i ff_ops w [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V in if gd = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V w d ?res else let v' = div_field_poly_i ff_ops V gd in dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i v') v' (mod_field_poly_i ff_ops w v') d ((d, gd) # ?res))

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
let ?P = "power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
let ?G = "gcd_poly_i ff_ops (minus_poly_i ff_ops ?P [?ze, ?on]) V"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
let ?g = "gcd (w ^ CARD('a) mod v - monom 1 1) v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
define G where "G = ?G"
[PROOF STATE]
proof (state)
this:
G = gcd_poly_i ff_ops (minus_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
define g where "g = ?g"
[PROOF STATE]
proof (state)
this:
g = gcd (w ^ CARD('a) mod v - monom 1 1) v

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded Let_def, folded G_def g_def]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (if g = 1 then dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) ?res else dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = (if G = [arith_ops_record.one ff_ops] then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) ?res else dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # ?res))

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note IH = IH[OF False refl refl refl]
[PROOF STATE]
proof (state)
this:
\<lbrakk>gcd (w ^ CARD('a) mod v - monom 1 1) v = 1; poly_rel ?F v; poly_rel ?G (w ^ CARD('a) mod v); list_all2 (rel_prod (=) poly_rel) ?Res res\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G (Suc d) ?Res) (dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) res)
\<lbrakk>gcd (w ^ CARD('a) mod v - monom 1 1) v \<noteq> 1; ?xc = v div gcd (w ^ CARD('a) mod v - monom 1 1) v; poly_rel ?F ?xc; poly_rel ?G (w ^ CARD('a) mod v mod ?xc); list_all2 (rel_prod (=) poly_rel) ?Res ((Suc d, gcd (w ^ CARD('a) mod v - monom 1 1) v) # res)\<rbrakk> \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i ?F) ?F ?G (Suc d) ?Res) (dist_degree_factorize_main ?xc (w ^ CARD('a) mod v mod ?xc) (Suc d) ((Suc d, gcd (w ^ CARD('a) mod v - monom 1 1) v) # res))

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have [transfer_rule]: "poly_rel [?ze,?on] (monom 1 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops] (monom 1 1)
[PROOF STEP]
unfolding poly_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 R [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops] (coeffs (monom 1 1))
[PROOF STEP]
by (auto simp: coeffs_monom one zero)
[PROOF STATE]
proof (state)
this:
poly_rel [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops] (monom 1 1)

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have id: "w ^ CARD('a) mod v = power_poly_f_mod v w (nat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w ^ CARD('a) mod v = power_poly_f_mod v w (nat p)
[PROOF STEP]
unfolding power_poly_f_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w ^ CARD('a) mod v = w ^ nat p mod v
[PROOF STEP]
by (simp add: p)
[PROOF STATE]
proof (state)
this:
w ^ CARD('a) mod v = power_poly_f_mod v w (nat p)

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have P[transfer_rule]: "poly_rel ?P (w ^ CARD('a) mod v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (w ^ CARD('a) mod v)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (power_poly_f_mod v w (nat p))
[PROOF STEP]
by (rule power_poly_f_mod_i[OF _ w], transfer_prover)
[PROOF STATE]
proof (state)
this:
poly_rel (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (w ^ CARD('a) mod v)

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have g[transfer_rule]: "poly_rel G g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel G g
[PROOF STEP]
unfolding G_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel (gcd_poly_i ff_ops (minus_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) [arith_ops_record.zero ff_ops, arith_ops_record.one ff_ops]) V) (gcd (w ^ CARD('a) mod v - monom 1 1) v)
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
poly_rel G g

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have id3: "(G = [?on]) = (g = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (G = [arith_ops_record.one ff_ops]) = (g = 1)
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
(G = [arith_ops_record.one ff_ops]) = (g = 1)

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded id3]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = (if g = 1 then dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) ?res else dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # ?res))
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = (if g = 1 then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) ?res else dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # ?res))

goal (1 subgoal):
 1. \<not> degree v < d + d \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
proof (cases "g = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. g = 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
g = 1

goal (2 subgoals):
 1. g = 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
 2. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
from IH(1)[OF this[unfolded g_def] v P res] True
[PROOF STATE]
proof (chain)
picking this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) Res) (dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) res)
g = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) Res) (dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) res)
g = 1

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
unfolding id2 simp
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) Res) (dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) res)
g = 1

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (if g = 1 then dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (Suc d) Res else dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # Res)) (if g = 1 then dist_degree_factorize_main v (w ^ CARD('a) mod v) (Suc d) res else dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
g \<noteq> 1

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have vg: "poly_rel (div_field_poly_i ff_ops V G) (v div g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel (div_field_poly_i ff_ops V G) (v div g)
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
poly_rel (div_field_poly_i ff_ops V G) (v div g)

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have "poly_rel (mod_field_poly_i ff_ops ?P
          (div_field_poly_i ff_ops V G)) (w ^ CARD('a) mod v mod (v div g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_rel (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (w ^ CARD('a) mod v mod (v div g))
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
poly_rel (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (w ^ CARD('a) mod v mod (v div g))

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note IH = IH(2)[OF False[unfolded g_def] refl vg[unfolded G_def g_def] this[unfolded G_def g_def],
            folded g_def G_def]
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) ?Res ((Suc d, g) # res) \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ?Res) (dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
have "list_all2 (rel_prod (=) poly_rel) ((Suc d, G) # Res) ((Suc d, g) # res)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) ((Suc d, G) # Res) ((Suc d, g) # res)
[PROOF STEP]
using g res
[PROOF STATE]
proof (prove)
using this:
poly_rel G g
list_all2 (rel_prod (=) poly_rel) Res res

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) ((Suc d, G) # Res) ((Suc d, g) # res)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) ((Suc d, G) # Res) ((Suc d, g) # res)

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note IH = IH[OF this]
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # Res)) (dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
g \<noteq> 1
[PROOF STEP]
have "(g = 1) = False"
[PROOF STATE]
proof (prove)
using this:
g \<noteq> 1

goal (1 subgoal):
 1. (g = 1) = False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(g = 1) = False

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
note simp = simp[unfolded this if_False]
[PROOF STATE]
proof (state)
this:
dist_degree_factorize_main v w d ?res = dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # ?res)
dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree v) V W d ?res = dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # ?res)

goal (1 subgoal):
 1. g \<noteq> 1 \<Longrightarrow> list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)
[PROOF STEP]
unfolding id2 simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # Res)) (dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # Res)) (dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))

goal (1 subgoal):
 1. list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i (div_field_poly_i ff_ops V G)) (div_field_poly_i ff_ops V G) (mod_field_poly_i ff_ops (power_poly_f_mod_i ff_ops (\<lambda>f. mod_field_poly_i ff_ops f V) W (nat p)) (div_field_poly_i ff_ops V G)) (Suc d) ((Suc d, G) # Res)) (dist_degree_factorize_main (v div g) (w ^ CARD('a) mod v mod (v div g)) (Suc d) ((Suc d, g) # res))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_all2 (rel_prod (=) poly_rel) (dist_degree_factorize_main_i p ff_ops (arith_ops_record.zero ff_ops) (arith_ops_record.one ff_ops) (degree_i V) V W d Res) (dist_degree_factorize_main v w d res)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_bounded2:
  fixes f :: "nat \<Rightarrow> 'a::linorder_topology"
  assumes lim:"f \<longlonglongrightarrow> l" and ge: "\<forall>n\<ge>N. f n \<ge> C"
  shows "l \<ge> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<le> l
[PROOF STEP]
using ge
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. C \<le> f n

goal (1 subgoal):
 1. C \<le> l
[PROOF STEP]
by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const])
     (auto simp: eventually_sequentially)


[STATEMENT]
lemma set_lfp_simps [simp] :
"mono f \<Longrightarrow> f s \<subseteq> s \<Longrightarrow> set_lfp s f = s"
"mono f \<Longrightarrow> \<not>(f s \<subseteq> s) \<Longrightarrow> set_lfp s f = (set_lfp (s \<union> f s) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>mono f; f s \<subseteq> s\<rbrakk> \<Longrightarrow> set_lfp s f = s) &&& (\<lbrakk>mono f; \<not> f s \<subseteq> s\<rbrakk> \<Longrightarrow> set_lfp s f = set_lfp (s \<union> f s) f)
[PROOF STEP]
by (metis set_lfp_tail_rec_def)+


[STATEMENT]
lemma inner_minus_right [simp]: "inner x (- y) = - inner x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x (- y) = - inner x y
[PROOF STEP]
using inner_minus_left [of y x]
[PROOF STATE]
proof (prove)
using this:
inner (- y) x = - inner y x

goal (1 subgoal):
 1. inner x (- y) = - inner x y
[PROOF STEP]
by (simp only: inner_commute)


[STATEMENT]
lemma S_transform_Conj [simp]:
  assumes "finite (supp xset)"
  shows "S_transform (Conj xset) = Conj (map_bset S_transform xset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S_transform (Conj xset) = Conj (map_bset S_transform xset)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (supp xset)

goal (1 subgoal):
 1. S_transform (Conj xset) = Conj (map_bset S_transform xset)
[PROOF STEP]
unfolding S_transform_def
[PROOF STATE]
proof (prove)
using this:
finite (supp xset)

goal (1 subgoal):
 1. Abs_formula (S_transform_formula (Conj xset)) = Conj (map_bset (\<lambda>x. Abs_formula (S_transform_formula x)) xset)
[PROOF STEP]
by (simp, simp add: Conj_def bset.map_comp o_def)