[STATEMENT]
lemma relabel_vars_add:
  assumes "g \<in> I \<rightarrow> J"
  assumes "P \<in> carrier (Pring R I)"
  assumes "Q \<in> carrier (Pring R I)"
  shows "relabel_vars I J g (P \<oplus>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<oplus>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relabel_vars I J g (P \<oplus>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<oplus>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q
[PROOF STEP]
using assms relabel_vars_is_morphism(1)[of g I J] ring_hom_ring.homh ring_hom_add
[PROOF STATE]
proof (prove)
using this:
g \<in> I \<rightarrow> J
P \<in> carrier (Pring R I)
Q \<in> carrier (Pring R I)
g \<in> I \<rightarrow> J \<Longrightarrow> ring_hom_ring (Pring R I) (Pring R J) (relabel_vars I J g)
ring_hom_ring ?R ?S ?h \<Longrightarrow> ?h \<in> ring_hom ?R ?S
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<oplus>\<^bsub>?R\<^esub> ?y) = ?h ?x \<oplus>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. relabel_vars I J g (P \<oplus>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<oplus>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q
[PROOF STEP]
by (metis (no_types, lifting))


[STATEMENT]
lemma disjointvars_empty_iff: "disjointvars Q Qeq = {} \<longleftrightarrow> (\<forall>V\<in>classes Qeq. V \<inter> fv Q \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (disjointvars Q Qeq = {}) = (\<forall>V\<in>classes Qeq. V \<inter> fv Q \<noteq> {})
[PROOF STEP]
unfolding disjointvars_def UNION_empty_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>classes Qeq. (if x \<inter> fv Q = {} then x else {}) = {}) = (\<forall>V\<in>classes Qeq. V \<inter> fv Q \<noteq> {})
[PROOF STEP]
using classes_nonempty
[PROOF STATE]
proof (prove)
using this:
{} \<notin> classes ?Qeq

goal (1 subgoal):
 1. (\<forall>x\<in>classes Qeq. (if x \<inter> fv Q = {} then x else {}) = {}) = (\<forall>V\<in>classes Qeq. V \<inter> fv Q \<noteq> {})
[PROOF STEP]
by auto


[STATEMENT]
lemma cx_leq_bx_in_creating_opt:
  assumes "create_optimal_solutions A b c = Sat X"
  assumes "(x, y) = split_n_m_x (dim_vec c) (dim_vec b) X"
  shows "c \<bullet> x \<le> b \<bullet> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<bullet> x \<le> b \<bullet> y
[PROOF STEP]
using weak_duality_aux[of "c \<bullet> x" "b \<bullet> y"]  create_optim_in_sols[of X x y, OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>c \<bullet> x \<in> {c \<bullet> x |x. x \<in> sat_primal A b}; b \<bullet> y \<in> {b \<bullet> y |y. y \<in> sat_dual A c}\<rbrakk> \<Longrightarrow> c \<bullet> x \<le> b \<bullet> y
c \<bullet> x \<in> {c \<bullet> x |x. [A*\<^sub>vx]\<le>b}
b \<bullet> y \<in> {b \<bullet> y |y. [y\<^sub>v*A]=c \<and> (\<forall>i<dim_vec y. 0 \<le> y $ i)}

goal (1 subgoal):
 1. c \<bullet> x \<le> b \<bullet> y
[PROOF STEP]
by auto


[STATEMENT]
lemma iprop9b: "Fr_1b \<F> \<Longrightarrow> Fr_2 \<F> \<Longrightarrow> Fr_3 \<F> \<Longrightarrow> \<forall>a b c. ((a \<^bold>\<Rightarrow> b) \<^bold>\<and> (c \<^bold>\<Rightarrow> b)) \<^bold>\<Leftarrow> ((a \<^bold>\<or> c) \<^bold>\<Rightarrow> b) \<^bold>\<approx> \<^bold>\<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Fr_1b \<F>; Fr_2 \<F>; Fr_3 \<F>\<rbrakk> \<Longrightarrow> \<forall>a b c w. (((\<^bold>\<Rightarrow>) a \<^bold>\<sqinter> (\<^bold>\<Rightarrow>) c) b \<^bold>\<Leftarrow> (b \<^bold>\<Leftarrow> a \<^bold>\<or> c)) w = \<^bold>\<top> w
[PROOF STEP]
by (simp add: DTw2 iprop9b')


[STATEMENT]
lemma sets_image_in_sets:
  assumes N: "space N = X"
  assumes f: "f \<in> measurable N M"
  shows "sets (vimage_algebra X f M) \<subseteq> sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (vimage_algebra X f M) \<subseteq> sets N
[PROOF STEP]
unfolding sets_vimage_algebra N[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets (space N) {f -` A \<inter> space N |A. A \<in> sets M} \<subseteq> sets N
[PROOF STEP]
by (rule sets.sigma_sets_subset) (auto intro!: measurable_sets f)


[STATEMENT]
theorem tertium_non_datur2: "A \<or> \<not> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<or> \<not> A
[PROOF STEP]
apply (subgoal_tac
      "(((SOME x. x = False \<or> x = True \<and> A) = False) \<or>
      ((SOME x. x = False \<or> x = True \<and> A) = True) \<and> A) \<and>
      (((SOME x. x = False \<and> A \<or> x = True) = False) \<and> A \<or>
      ((SOME x. x = False \<and> A \<or> x = True) = True))")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
 2. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True)
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True)
 2. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A
 2. (SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True
 3. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule someI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ?x4 = False \<or> ?x4 = True \<and> A
 2. (SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True
 3. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule disjI1)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. ?x4 = False
 2. (SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True
 3. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True
 2. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule someI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ?x9 = False \<and> A \<or> ?x9 = True
 2. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ?x9 = True
 2. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A) \<and> ((SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True) \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False \<or> (SOME x. x = False \<or> x = True \<and> A) = True \<and> A; (SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = False\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = False \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 3. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = False; A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 3. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule disjI1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True \<and> A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = False \<and> A \<or> (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True; A\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule disjI1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (subgoal_tac
      "(\<lambda>x. (x = False) \<or> (x = True) \<and> A) \<noteq>
      (\<lambda>x. (x = False) \<and> A \<or> (x = True))")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True\<rbrakk> \<Longrightarrow> (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule notI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) = (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (drule_tac f = "\<lambda>y. SOME x. y x" in arg_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = (SOME x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (drule trans, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (drule sym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True; False = (SOME x. x = False \<or> x = True \<and> A)\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (drule trans, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(SOME x. x = False \<and> A \<or> x = True) = True; (SOME x. x = False \<or> x = True \<and> A) = True; False = True\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (erule False_neq_True)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> A \<or> \<not> A
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True)\<rbrakk> \<Longrightarrow> \<not> A
[PROOF STEP]
apply (rule notI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; (\<lambda>x. x = False \<or> x = True \<and> A) \<noteq> (\<lambda>x. x = False \<and> A \<or> x = True); A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (erule notE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A\<rbrakk> \<Longrightarrow> (\<lambda>x. x = False \<or> x = True \<and> A) = (\<lambda>x. x = False \<and> A \<or> x = True)
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A\<rbrakk> \<Longrightarrow> (x = False \<or> x = True \<and> A) = (x = False \<and> A \<or> x = True)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<or> x = True \<and> A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True \<and> A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 3. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (rule disjI1)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False\<rbrakk> \<Longrightarrow> x = False \<and> A
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True \<and> A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 3. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A\<rbrakk> \<Longrightarrow> A
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True \<and> A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 3. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True \<and> A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True; A\<rbrakk> \<Longrightarrow> x = False \<and> A \<or> x = True
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A \<or> x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False \<and> A\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = False; A\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
 2. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (erule disjI1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True\<rbrakk> \<Longrightarrow> x = False \<or> x = True \<and> A
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A; x = True\<rbrakk> \<Longrightarrow> x = True \<and> A
[PROOF STEP]
apply (erule conjI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(SOME x. x = False \<or> x = True \<and> A) = False; (SOME x. x = False \<and> A \<or> x = True) = True; A\<rbrakk> \<Longrightarrow> A
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma EVEN[import_const "EVEN" : even]:
  "even (id 0::nat) = True \<and> (\<forall>n. even (Suc n) = (\<not> even n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HOL_Light_Maps.even (id 0) = True \<and> (\<forall>n. HOL_Light_Maps.even (Suc n) = (\<not> HOL_Light_Maps.even n))
[PROOF STEP]
by (simp add: even_def)


[STATEMENT]
theorem F1set2_natural: "F1set2 o F1map f1 f2 = image f2 o F1set2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F2set \<circ> F1map f1 f2 = (`) f2 \<circ> F2set
[PROOF STEP]
by (rule F.set_map0(3))


[STATEMENT]
lemma uint_neg_numeral: "uint (- numeral b :: 'a::len word) = - numeral b mod 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uint (- numeral b) = - numeral b mod 2 ^ LENGTH('a)
[PROOF STEP]
by (simp flip: take_bit_eq_mod add: of_nat_take_bit)


[STATEMENT]
lemma ang_vec_opposite_opposite':
  assumes "z1 \<noteq> z" and "z2 \<noteq> z"
  shows "\<angle> (z - z1) (z - z2) = \<angle> (z1 - z) (z2 - z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<angle> (z - z1) (z - z2) = \<angle> (z1 - z) (z2 - z)
[PROOF STEP]
using ang_vec_opposite_opposite[of "z - z1" "z - z2"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>z - z1 \<noteq> 0; z - z2 \<noteq> 0\<rbrakk> \<Longrightarrow> \<angle> (- (z - z1)) (- (z - z2)) = \<angle> (z - z1) (z - z2)
z1 \<noteq> z
z2 \<noteq> z

goal (1 subgoal):
 1. \<angle> (z - z1) (z - z2) = \<angle> (z1 - z) (z2 - z)
[PROOF STEP]
by (simp add: field_simps del: ang_vec_def)


[STATEMENT]
lemma alt_group_is_group: "group (alt_group n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (alt_group n)
[PROOF STEP]
using group.subgroup_imp_group[OF sym_group_is_group alt_group_is_subgroup]
[PROOF STATE]
proof (prove)
using this:
Group.group (sym_group ?n1\<lparr>carrier := carrier (alt_group ?n1)\<rparr>)

goal (1 subgoal):
 1. Group.group (alt_group n)
[PROOF STEP]
by (simp add: alt_group_def)


[STATEMENT]
lemma par_strict_not_col_3:
  assumes "A B ParStrict C D"
  shows "\<not> Col C D A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Col C D A
[PROOF STEP]
using Col_perm ParStrict_def assms col_trivial_1
[PROOF STATE]
proof (prove)
using this:
Col ?A ?B ?C \<Longrightarrow> Col ?A ?B ?C \<and> Col ?A ?C ?B \<and> Col ?B ?A ?C \<and> Col ?B ?C ?A \<and> Col ?C ?A ?B \<and> Col ?C ?B ?A
?A ?B ParStrict ?C ?D \<equiv> Coplanar ?A ?B ?C ?D \<and> (\<nexists>X. Col X ?A ?B \<and> Col X ?C ?D)
A B ParStrict C D
Col ?A ?A ?B

goal (1 subgoal):
 1. \<not> Col C D A
[PROOF STEP]
by blast


[STATEMENT]
lemma eqd_spref_ssuf_iff: assumes "x \<cdot> y = u \<cdot> v" shows "x <p u \<longleftrightarrow> v <s y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x <p u) = (v <s y)
[PROOF STEP]
using eqd_pref_suf_iff[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
(x \<le>p u) = (v \<le>s y)
x \<cdot> y = u \<cdot> v

goal (1 subgoal):
 1. (x <p u) = (v <s y)
[PROOF STEP]
by force


[STATEMENT]
lemma monomial_pmdl_field:
  assumes "is_monomial_set B" and "p \<in> pmdl B" and "v \<in> keys (p::_ \<Rightarrow>\<^sub>0 'b::field)"
  shows "monomial c v \<in> pmdl B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c v \<in> pmdl B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monomial c v \<in> pmdl B
[PROOF STEP]
from assms(1, 2)
[PROOF STATE]
proof (chain)
picking this:
is_monomial_set B
p \<in> pmdl B
[PROOF STEP]
have "monomial (lookup p v) v \<in> pmdl B"
[PROOF STATE]
proof (prove)
using this:
is_monomial_set B
p \<in> pmdl B

goal (1 subgoal):
 1. monomial (lookup p v) v \<in> pmdl B
[PROOF STEP]
by (rule monomial_pmdl)
[PROOF STATE]
proof (state)
this:
monomial (lookup p v) v \<in> pmdl B

goal (1 subgoal):
 1. monomial c v \<in> pmdl B
[PROOF STEP]
hence "monom_mult (c / lookup p v) 0 (monomial (lookup p v) v) \<in> pmdl B"
[PROOF STATE]
proof (prove)
using this:
monomial (lookup p v) v \<in> pmdl B

goal (1 subgoal):
 1. monom_mult (c / lookup p v) (0::'a) (monomial (lookup p v) v) \<in> pmdl B
[PROOF STEP]
by (rule pmdl_closed_monom_mult)
[PROOF STATE]
proof (state)
this:
monom_mult (c / lookup p v) (0::'a) (monomial (lookup p v) v) \<in> pmdl B

goal (1 subgoal):
 1. monomial c v \<in> pmdl B
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
v \<in> keys p
monom_mult (c / lookup p v) (0::'a) (monomial (lookup p v) v) \<in> pmdl B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<in> keys p
monom_mult (c / lookup p v) (0::'a) (monomial (lookup p v) v) \<in> pmdl B

goal (1 subgoal):
 1. monomial c v \<in> pmdl B
[PROOF STEP]
by (simp add: monom_mult_monomial splus_zero in_keys_iff)
[PROOF STATE]
proof (state)
this:
monomial c v \<in> pmdl B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_in_carrier: "\<lbrakk> set p \<subseteq> carrier R; x \<in> carrier R \<rbrakk> \<Longrightarrow> (eval p) x \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set p \<subseteq> carrier R; x \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval p x \<in> carrier R
[PROOF STEP]
by (induction p) (auto)


[STATEMENT]
lemma single_is_union: "{#a#} = M + N \<longleftrightarrow> {#a#} = M \<and> N = {#} \<or> M = {#} \<and> {#a#} = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#a#} = M + N) = ({#a#} = M \<and> N = {#} \<or> M = {#} \<and> {#a#} = N)
[PROOF STEP]
by (auto simp add: eq_commute [of "{#a#}" "M + N"] union_is_single)


[STATEMENT]
lemma Max_nat_plus:
  "Max (((+) n) ` S) = (n :: nat) + Max S" if "finite S" "S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max ((+) n ` S) = n + Max S
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite S
S \<noteq> {}

goal (1 subgoal):
 1. Max ((+) n ` S) = n + Max S
[PROOF STEP]
by (auto intro!: Max_ge Max_in Max_eqI)


[STATEMENT]
theorem (in mersenne_prime) lucas_lehmer_necessary:
  "(2 ^ p - 1) dvd gen_lucas_lehmer_sequence 4 (p - 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
write lucas_lehmer_ring ("R")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
define S where "S = lucas_lehmer_ring_mod M"
[PROOF STATE]
proof (state)
this:
S = lucas_lehmer_ring_mod M

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
define S' where "S' = units_of S"
[PROOF STATE]
proof (state)
this:
S' = units_of S

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
define \<phi> where "\<phi> = lucas_lehmer_hom M"
[PROOF STATE]
proof (state)
this:
\<phi> = lucas_lehmer_hom M

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
interpret R: cring R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring R
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
interpret S: cring S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring S
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (lucas_lehmer_ring_mod M)
[PROOF STEP]
by (rule cring_lucas_lehmer_ring_mod) (use M_gt_6 in auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
interpret S': comm_group S'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_group S'
[PROOF STEP]
unfolding S'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_group (units_of S)
[PROOF STEP]
by (rule S.units_comm_group)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have "\<phi> \<in> ring_hom R S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> \<in> ring_hom R S
[PROOF STEP]
unfolding \<phi>_def S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M \<in> ring_hom R (lucas_lehmer_ring_mod M)
[PROOF STEP]
by (rule ring_hom_lucas_lehmer_hom) (use M_gt_6 in auto)
[PROOF STATE]
proof (state)
this:
\<phi> \<in> ring_hom R S

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
interpret \<phi>: ring_hom_cring R S \<phi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring R S \<phi>
[PROOF STEP]
by standard fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have R_pow_int: "(n, 0) [^]\<^bsub>R\<^esub> m = (n ^ m, 0)" for n :: int and m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n, 0) [^]\<^bsub>R\<^esub> m = (n ^ m, 0)
[PROOF STEP]
by (induction m; simp; simp add: lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
(?n1, 0) [^]\<^bsub>R\<^esub> ?m1 = (?n1 ^ ?m1, 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have "add_pow R n \<one>\<^bsub>R\<^esub> = (int n, 0)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [n] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int n, 0)
[PROOF STEP]
by (induction n; simp; simp add: lucas_lehmer_ring_def lucas_lehmer_add'_def)
[PROOF STATE]
proof (state)
this:
[?n1] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int ?n1, 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
hence "add_pow R M \<one>\<^bsub>R\<^esub> = (int M, 0)"
[PROOF STATE]
proof (prove)
using this:
[?n1] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int ?n1, 0)

goal (1 subgoal):
 1. [M] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int M, 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[M] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int M, 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[M] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> = (int M, 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have "\<phi> \<dots> = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (int M, 0) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (simp add: \<phi>_def S_def lucas_lehmer_ring_mod_def lucas_lehmer_hom_def)
[PROOF STATE]
proof (state)
this:
\<phi> (int M, 0) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> ([M] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "add_pow S M \<one>\<^bsub>S\<^esub> = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
using this:
\<phi> ([M] \<cdot>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. [M] \<cdot>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (simp add: \<phi>.hom_add_pow_nat)
[PROOF STATE]
proof (state)
this:
[M] \<cdot>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
define \<sigma> :: "int \<times> int" where "\<sigma> = (0, 2)"
[PROOF STATE]
proof (state)
this:
\<sigma> = (0, 2)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have eq1: "\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, -2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(6, 2) = (6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (6, 2) = (6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>
[PROOF STEP]
by (simp add: lucas_lehmer_ring_def \<sigma>_def lucas_lehmer_add'_def)
[PROOF STATE]
proof (state)
this:
(6, 2) = (6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(6, 2) = (6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<phi> (\<dots> [^]\<^bsub>R\<^esub> M) = \<phi> ((6, 0) [^]\<^bsub>R\<^esub> M) \<oplus>\<^bsub>S\<^esub> \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (((6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>) [^]\<^bsub>R\<^esub> M) = \<phi> ((6, 0) [^]\<^bsub>R\<^esub> M) \<oplus>\<^bsub>S\<^esub> \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M)
[PROOF STEP]
using prime and \<open>add_pow S M \<one>\<^bsub>S\<^esub> = \<zero>\<^bsub>S\<^esub>\<close>
[PROOF STATE]
proof (prove)
using this:
prime M
[M] \<cdot>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (((6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>) [^]\<^bsub>R\<^esub> M) = \<phi> ((6, 0) [^]\<^bsub>R\<^esub> M) \<oplus>\<^bsub>S\<^esub> \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M)
[PROOF STEP]
by (simp add: S.binomial_finite_char)
[PROOF STATE]
proof (state)
this:
\<phi> (((6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>) [^]\<^bsub>R\<^esub> M) = \<phi> ((6, 0) [^]\<^bsub>R\<^esub> M) \<oplus>\<^bsub>S\<^esub> \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (((6, 0) \<oplus>\<^bsub>R\<^esub> \<sigma>) [^]\<^bsub>R\<^esub> M) = \<phi> ((6, 0) [^]\<^bsub>R\<^esub> M) \<oplus>\<^bsub>S\<^esub> \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(6, 0) [^]\<^bsub>R\<^esub> M = (6 ^ M, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (6, 0) [^]\<^bsub>R\<^esub> M = (6 ^ M, 0)
[PROOF STEP]
by (simp add: R_pow_int)
[PROOF STATE]
proof (state)
this:
(6, 0) [^]\<^bsub>R\<^esub> M = (6 ^ M, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(6, 0) [^]\<^bsub>R\<^esub> M = (6 ^ M, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "[6 ^ M = 6] (mod (int M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [6 ^ M = 6] (mod int M)
[PROOF STEP]
using M_gt_6
[PROOF STATE]
proof (prove)
using this:
6 < M

goal (1 subgoal):
 1. [6 ^ M = 6] (mod int M)
[PROOF STEP]
by (intro little_Fermat_int) (use prime in \<open>auto simp flip: dvd_nat_abs_iff\<close>)
[PROOF STATE]
proof (state)
this:
[6 ^ M = 6] (mod int M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
hence "\<phi> (6 ^ M, 0) = \<phi> (6, 0)"
[PROOF STATE]
proof (prove)
using this:
[6 ^ M = 6] (mod int M)

goal (1 subgoal):
 1. \<phi> (6 ^ M, 0) = \<phi> (6, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
using this:
[6 ^ M = 6] (mod int M)

goal (1 subgoal):
 1. lucas_lehmer_hom M (6 ^ M, 0) = lucas_lehmer_hom M (6, 0)
[PROOF STEP]
by (intro lucas_lehmer_hom_cong) auto
[PROOF STATE]
proof (state)
this:
\<phi> (6 ^ M, 0) = \<phi> (6, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (6 ^ M, 0) = \<phi> (6, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<sigma> = (2, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> = (2, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)
[PROOF STEP]
by (simp add: \<sigma>_def lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
\<sigma> = (2, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
hence "\<phi> (\<sigma> [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M)"
[PROOF STATE]
proof (prove)
using this:
\<sigma> = (2, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)

goal (1 subgoal):
 1. \<phi> (\<sigma> [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M)
[PROOF STEP]
by (subst R.nat_pow_distrib [symmetric]) auto
[PROOF STATE]
proof (state)
this:
\<phi> (\<sigma> [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<sigma> [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<dots> = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M) \<otimes>\<^bsub>S\<^esub> \<phi> ((0, 1) [^]\<^bsub>R\<^esub> M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M) \<otimes>\<^bsub>S\<^esub> \<phi> ((0, 1) [^]\<^bsub>R\<^esub> M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M) \<otimes>\<^bsub>S\<^esub> \<phi> ((0, 1) [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ((2, 0) [^]\<^bsub>R\<^esub> M \<otimes>\<^bsub>R\<^esub> (0, 1) [^]\<^bsub>R\<^esub> M) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> M) \<otimes>\<^bsub>S\<^esub> \<phi> ((0, 1) [^]\<^bsub>R\<^esub> M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(2, 0) [^]\<^bsub>R\<^esub> M = (2 ^ M, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2, 0) [^]\<^bsub>R\<^esub> M = (2 ^ M, 0)
[PROOF STEP]
by (simp add: R_pow_int)
[PROOF STATE]
proof (state)
this:
(2, 0) [^]\<^bsub>R\<^esub> M = (2 ^ M, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2, 0) [^]\<^bsub>R\<^esub> M = (2 ^ M, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "[2 ^ M = 2] (mod int M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [2 ^ M = 2] (mod int M)
[PROOF STEP]
using M_gt_6 prime
[PROOF STATE]
proof (prove)
using this:
6 < M
prime M

goal (1 subgoal):
 1. [2 ^ M = 2] (mod int M)
[PROOF STEP]
by (intro little_Fermat_int) (auto simp flip: dvd_nat_abs_iff dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
[2 ^ M = 2] (mod int M)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
hence "\<phi> (2 ^ M, 0) = \<phi> (2, 0)"
[PROOF STATE]
proof (prove)
using this:
[2 ^ M = 2] (mod int M)

goal (1 subgoal):
 1. \<phi> (2 ^ M, 0) = \<phi> (2, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
using this:
[2 ^ M = 2] (mod int M)

goal (1 subgoal):
 1. lucas_lehmer_hom M (2 ^ M, 0) = lucas_lehmer_hom M (2, 0)
[PROOF STEP]
by (intro lucas_lehmer_hom_cong) auto
[PROOF STATE]
proof (state)
this:
\<phi> (2 ^ M, 0) = \<phi> (2, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (2 ^ M, 0) = \<phi> (2, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have M_eq: "M = Suc (2 * ((M - 1) div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = Suc (2 * ((M - 1) div 2))
[PROOF STEP]
using M_odd
[PROOF STATE]
proof (prove)
using this:
odd M

goal (1 subgoal):
 1. M = Suc (2 * ((M - 1) div 2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M = Suc (2 * ((M - 1) div 2))

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(0, 1) [^]\<^bsub>R\<^esub> M = (0, 1) \<otimes>\<^bsub>R\<^esub> ((0, 1) [^]\<^bsub>R\<^esub> (2::nat)) [^]\<^bsub>R\<^esub> ((M - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0, 1) [^]\<^bsub>R\<^esub> M = (0, 1) \<otimes>\<^bsub>R\<^esub> ((0, 1) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>R\<^esub> ((M - 1) div 2)
[PROOF STEP]
by (subst M_eq) (auto simp: R.nat_pow_mult R.nat_pow_pow R.cring_simprules)
[PROOF STATE]
proof (state)
this:
(0, 1) [^]\<^bsub>R\<^esub> M = (0, 1) \<otimes>\<^bsub>R\<^esub> ((0, 1) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>R\<^esub> ((M - 1) div 2)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0, 1) [^]\<^bsub>R\<^esub> M = (0, 1) \<otimes>\<^bsub>R\<^esub> ((0, 1) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>R\<^esub> ((M - 1) div 2)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(0, 1) [^]\<^bsub>R\<^esub> (2::nat) = (3, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0, 1) [^]\<^bsub>R\<^esub> 2 = (3, 0)
[PROOF STEP]
by (simp add: eval_nat_numeral) (simp add: lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
(0, 1) [^]\<^bsub>R\<^esub> 2 = (3, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0, 1) [^]\<^bsub>R\<^esub> 2 = (3, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<phi> ((0, 1) \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) =
                 \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((0, 1) \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)
[PROOF STEP]
by (simp add: S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> ((0, 1) \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ((0, 1) \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)
[PROOF STEP]
by (simp add: R_pow_int)
[PROOF STATE]
proof (state)
this:
(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (-1, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M (3 ^ ((M - 1) div 2), 0) = lucas_lehmer_hom M (- 1, 0)
[PROOF STEP]
proof (intro lucas_lehmer_hom_cong')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
have "[3 ^ ((M - 1) div 2) = Legendre 3 M] (mod int M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)
[PROOF STEP]
by (rule cong_sym, rule euler_criterion) (use prime M_gt_6 in auto)
[PROOF STATE]
proof (state)
this:
[3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)

goal (2 subgoals):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
thus "[3 ^ ((M - 1) div 2) = -1] (mod int M)"
[PROOF STATE]
proof (prove)
using this:
[3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)

goal (1 subgoal):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
[PROOF STEP]
by (simp add: Legendre_3_M)
[PROOF STATE]
proof (state)
this:
[3 ^ ((M - 1) div 2) = - 1] (mod int M)

goal (1 subgoal):
 1. [0 = 0] (mod int M)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<phi> (2, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (- 1, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)) = \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (-1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (2, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (- 1, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)) = \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))
[PROOF STEP]
by (simp add: R.cring_simprules S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (2, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (- 1, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)) = \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (2, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (- 1, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (0, 1)) = \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<phi> (6, 0) \<oplus>\<^bsub>S\<^esub> \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) =
                 \<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (6, 0) \<oplus>\<^bsub>S\<^esub> \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = \<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> (6, 0) \<oplus>\<^bsub>S\<^esub> \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = \<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (6, 0) \<oplus>\<^bsub>S\<^esub> \<phi> ((2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = \<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1))

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
have "\<dots> = \<phi> (6, -2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = \<phi> (6, - 2)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = lucas_lehmer_hom M (6, - 2)
[PROOF STEP]
by (intro lucas_lehmer_hom_cong)
         (auto simp: lucas_lehmer_ring_def lucas_lehmer_mult'_def lucas_lehmer_add'_def)
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 0) \<oplus>\<^bsub>R\<^esub> (2, 0) \<otimes>\<^bsub>R\<^esub> (- 1, 0) \<otimes>\<^bsub>R\<^esub> (0, 1)) = \<phi> (6, - 2)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
show "\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, -2)"
[PROOF STATE]
proof (prove)
using this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)

goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
by (simp add: R.cring_simprules S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have eq2: "\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(24, 0) = (2, 0) [^]\<^bsub>R\<^esub> (3::nat) \<otimes>\<^bsub>R\<^esub> (3, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (24, 0) = (2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)
[PROOF STEP]
by (simp add: eval_nat_numeral) (auto simp: lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
(24, 0) = (2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(24, 0) = (2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<dots> [^]\<^bsub>R\<^esub> ((M - 1) div 2) =
                 ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> (3::nat) \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)
[PROOF STEP]
by (simp add: R.cring_simprules R.nat_pow_distrib R.nat_pow_pow mult_ac)
[PROOF STATE]
proof (state)
this:
((2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((2, 0) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0)) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> \<dots> = (\<phi> ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))) [^]\<^bsub>S\<^esub> (3::nat) \<otimes>\<^bsub>S\<^esub>
                      \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>S\<^esub> 3 \<otimes>\<^bsub>S\<^esub> \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> (((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>S\<^esub> 3 \<otimes>\<^bsub>S\<^esub> \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>R\<^esub> 3 \<otimes>\<^bsub>R\<^esub> (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> ((2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) [^]\<^bsub>S\<^esub> 3 \<otimes>\<^bsub>S\<^esub> \<phi> ((3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (2 ^ ((M - 1) div 2), 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (2 ^ ((M - 1) div 2), 0)
[PROOF STEP]
by (simp add: R_pow_int)
[PROOF STATE]
proof (state)
this:
(2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (2 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (2 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> \<dots> = \<phi> (1, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (2 ^ ((M - 1) div 2), 0) = \<phi> (1, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M (2 ^ ((M - 1) div 2), 0) = lucas_lehmer_hom M (1, 0)
[PROOF STEP]
proof (intro lucas_lehmer_hom_cong')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [2 ^ ((M - 1) div 2) = 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
have "[2 ^ ((M - 1) div 2) = Legendre 2 M] (mod int M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [2 ^ ((M - 1) div 2) = Legendre 2 (int M)] (mod int M)
[PROOF STEP]
by (rule cong_sym, rule euler_criterion) (use prime M_gt_6 in auto)
[PROOF STATE]
proof (state)
this:
[2 ^ ((M - 1) div 2) = Legendre 2 (int M)] (mod int M)

goal (2 subgoals):
 1. [2 ^ ((M - 1) div 2) = 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
thus "[2 ^ ((M - 1) div 2) = 1] (mod int M)"
[PROOF STATE]
proof (prove)
using this:
[2 ^ ((M - 1) div 2) = Legendre 2 (int M)] (mod int M)

goal (1 subgoal):
 1. [2 ^ ((M - 1) div 2) = 1] (mod int M)
[PROOF STEP]
using Legendre_2_M
[PROOF STATE]
proof (prove)
using this:
[2 ^ ((M - 1) div 2) = Legendre 2 (int M)] (mod int M)
Legendre 2 (int M) = 1

goal (1 subgoal):
 1. [2 ^ ((M - 1) div 2) = 1] (mod int M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[2 ^ ((M - 1) div 2) = 1] (mod int M)

goal (1 subgoal):
 1. [0 = 0] (mod int M)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<phi> (2 ^ ((M - 1) div 2), 0) = \<phi> (1, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (2 ^ ((M - 1) div 2), 0) = \<phi> (1, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(1, 0) = \<one>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1, 0) = \<one>\<^bsub>R\<^esub>
[PROOF STEP]
by (simp add: lucas_lehmer_ring_def)
[PROOF STATE]
proof (state)
this:
(1, 0) = \<one>\<^bsub>R\<^esub>

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1, 0) = \<one>\<^bsub>R\<^esub>

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)
[PROOF STEP]
by (simp add: R_pow_int)
[PROOF STATE]
proof (state)
this:
(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(3, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2) = (3 ^ ((M - 1) div 2), 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> \<dots> = \<phi> (-1, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M (3 ^ ((M - 1) div 2), 0) = lucas_lehmer_hom M (- 1, 0)
[PROOF STEP]
proof  (intro lucas_lehmer_hom_cong')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
have "[3 ^ ((M - 1) div 2) = Legendre 3 M] (mod int M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)
[PROOF STEP]
by (rule cong_sym, rule euler_criterion) (use prime M_gt_6 in auto)
[PROOF STATE]
proof (state)
this:
[3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)

goal (2 subgoals):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
 2. [0 = 0] (mod int M)
[PROOF STEP]
thus "[3 ^ ((M - 1) div 2) = -1] (mod int M)"
[PROOF STATE]
proof (prove)
using this:
[3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)

goal (1 subgoal):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
[PROOF STEP]
using Legendre_3_M
[PROOF STATE]
proof (prove)
using this:
[3 ^ ((M - 1) div 2) = Legendre 3 (int M)] (mod int M)
Legendre 3 (int M) = - 1

goal (1 subgoal):
 1. [3 ^ ((M - 1) div 2) = - 1] (mod int M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[3 ^ ((M - 1) div 2) = - 1] (mod int M)

goal (1 subgoal):
 1. [0 = 0] (mod int M)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (3 ^ ((M - 1) div 2), 0) = \<phi> (- 1, 0)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(-1, 0) = \<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1, 0) = \<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>
[PROOF STEP]
using minus_lucas_lehmer_ring
[PROOF STATE]
proof (prove)
using this:
\<ominus>\<^bsub>R\<^esub> ?x = (case ?x of (a, b) \<Rightarrow> (- a, - b))

goal (1 subgoal):
 1. (- 1, 0) = \<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>
[PROOF STEP]
by (simp add: lucas_lehmer_ring_def)
[PROOF STATE]
proof (state)
this:
(- 1, 0) = \<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> \<one>\<^bsub>R\<^esub> [^]\<^bsub>S\<^esub> 3 \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
[PROOF STEP]
show "\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
using this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<phi> \<one>\<^bsub>R\<^esub> [^]\<^bsub>S\<^esub> 3 \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
define \<omega> \<omega>' :: "int \<times> int" where "\<omega> = (2, 1)" and "\<omega>' = (2, -1)"
[PROOF STATE]
proof (state)
this:
\<omega> = (2, 1)
\<omega>' = (2, - 1)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have eq3: "\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(M + 1) div 2 = Suc ((M - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M + 1) div 2 = Suc ((M - 1) div 2)
[PROOF STEP]
using M_odd M_gt_6
[PROOF STATE]
proof (prove)
using this:
odd M
6 < M

goal (1 subgoal):
 1. (M + 1) div 2 = Suc ((M - 1) div 2)
[PROOF STEP]
by (auto elim!: oddE)
[PROOF STATE]
proof (state)
this:
(M + 1) div 2 = Suc ((M - 1) div 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have *: "\<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) = \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 :: nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) = \<phi> ((6, 2) [^]\<^bsub>R\<^esub> 2)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) = lucas_lehmer_hom M ((6, 2) [^]\<^bsub>R\<^esub> 2)
[PROOF STEP]
by (intro lucas_lehmer_hom_cong)
         (simp_all add: eval_nat_numeral,
          auto simp: lucas_lehmer_ring_def lucas_lehmer_mult'_def \<omega>_def)
[PROOF STATE]
proof (state)
this:
\<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) = \<phi> ((6, 2) [^]\<^bsub>R\<^esub> 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) [^]\<^bsub>S\<^esub> ((M + 1) div 2) =
            \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 :: nat)) [^]\<^bsub>S\<^esub> ((M + 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) [^]\<^bsub>S\<^esub> ((M + 1) div 2) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>S\<^esub> ((M + 1) div 2)
[PROOF STEP]
by (subst *) auto
[PROOF STATE]
proof (state)
this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) [^]\<^bsub>S\<^esub> ((M + 1) div 2) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>S\<^esub> ((M + 1) div 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
hence "\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) =
            \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 * ((M + 1) div 2)))"
[PROOF STATE]
proof (prove)
using this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) \<otimes>\<^bsub>R\<^esub> \<omega>) [^]\<^bsub>S\<^esub> ((M + 1) div 2) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> 2) [^]\<^bsub>S\<^esub> ((M + 1) div 2)

goal (1 subgoal):
 1. \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 * ((M + 1) div 2)))
[PROOF STEP]
by (simp add: R.nat_pow_distrib S.nat_pow_distrib R.nat_pow_pow
                    S.nat_pow_pow R.cring_simprules S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 * ((M + 1) div 2)))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (2 * ((M + 1) div 2)))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "2 * ((M + 1) div 2) = M + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ((M + 1) div 2) = M + 1
[PROOF STEP]
using M_odd
[PROOF STATE]
proof (prove)
using this:
odd M

goal (1 subgoal):
 1. 2 * ((M + 1) div 2) = M + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * ((M + 1) div 2) = M + 1

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (M + 1))
[PROOF STEP]
have "\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))) \<otimes>\<^bsub>S\<^esub>
                    \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) =
                  \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> (\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M))"
[PROOF STATE]
proof (prove)
using this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> (M + 1))

goal (1 subgoal):
 1. \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> (\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M))
[PROOF STEP]
by (subst (asm) \<open>(M + 1) div 2 = _\<close>) (simp add: S.cring_simprules R.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> (\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2))) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> (\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
by (subst eq2) auto
[PROOF STATE]
proof (state)
this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ((24, 0) [^]\<^bsub>R\<^esub> ((M - 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>) = \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<one>\<^bsub>S\<^esub>
[PROOF STEP]
by (simp add: S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> = \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, -2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)
[PROOF STEP]
by (subst eq1) auto
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 2) [^]\<^bsub>R\<^esub> M) = \<phi> (6, - 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> (6, -2) = \<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, -2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> (6, - 2) = \<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> (6, - 2) = \<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (6, 2) \<otimes>\<^bsub>S\<^esub> \<phi> (6, - 2) = \<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<dots> = \<phi> (24, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2)) = \<phi> (24, 0)
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2)) = lucas_lehmer_hom M (24, 0)
[PROOF STEP]
by (intro lucas_lehmer_hom_cong) (auto simp: lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
\<phi> ((6, 2) \<otimes>\<^bsub>R\<^esub> (6, - 2)) = \<phi> (24, 0)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> (24, 0)
[PROOF STEP]
have "\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2))) =
                  \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub> \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>) \<otimes>\<^bsub>S\<^esub> \<phi> (24, 0)

goal (1 subgoal):
 1. \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
[PROOF STEP]
by (simp add: S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<phi> (24, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (24, 0) = (24 mod M, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (24, 0) = (24 mod M, 0)
[PROOF STEP]
by (simp add: \<phi>_def lucas_lehmer_hom_def nat_mod_as_int)
[PROOF STATE]
proof (state)
this:
\<phi> (24, 0) = (24 mod M, 0)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
[PROOF STEP]
have "(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> (\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2))) =
                  (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
have "(24 mod M, 0) \<in> Units S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (24 mod M, 0) \<in> Units S
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (24 mod M, 0) \<in> Units (lucas_lehmer_ring_mod M)
[PROOF STEP]
using M_gt_6 prime M_not_dvd_24
[PROOF STATE]
proof (prove)
using this:
6 < M
prime M
\<not> M dvd 24

goal (1 subgoal):
 1. (24 mod M, 0) \<in> Units (lucas_lehmer_ring_mod M)
[PROOF STEP]
by (intro int_in_Units_lucas_lehmer_ring_mod) (auto simp: dvd_mod_iff intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
(24 mod M, 0) \<in> Units S

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
(24 mod M, 0) \<in> Units S
[PROOF STEP]
show "\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
using this:
(24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = (24 mod M, 0) \<otimes>\<^bsub>S\<^esub> \<phi> (\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>)
(24 mod M, 0) \<in> Units S

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>
[PROOF STEP]
by (subst (asm) S.Units_l_cancel) auto
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) = \<ominus>\<^bsub>S\<^esub> \<one>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have eq4: "\<phi> (\<omega> [^]\<^bsub>R\<^esub> (2 ^ (p - 2) :: nat) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> (2 ^ (p - 2) :: nat)) = \<zero>\<^bsub>S\<^esub>"
    (is "\<phi> ?lhs = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) \<oplus>\<^bsub>S\<^esub>
            \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) \<oplus>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (subst eq3) (auto simp: S.cring_simprules)
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) \<oplus>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 2)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) \<oplus>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "2 ^ 2 dvd (2 ^ p :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2\<^sup>2 dvd 2 ^ p
[PROOF STEP]
by (intro le_imp_power_dvd) (use p_gt_2 in auto)
[PROOF STATE]
proof (state)
this:
2\<^sup>2 dvd 2 ^ p

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
hence "4 dvd (M + 1)"
[PROOF STATE]
proof (prove)
using this:
2\<^sup>2 dvd 2 ^ p

goal (1 subgoal):
 1. 4 dvd M + 1
[PROOF STEP]
by (auto simp: M_def)
[PROOF STATE]
proof (state)
this:
4 dvd M + 1

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
hence "(M + 1) div 2 = (M + 1) div 4 + (M + 1) div 4"
[PROOF STATE]
proof (prove)
using this:
4 dvd M + 1

goal (1 subgoal):
 1. (M + 1) div 2 = (M + 1) div 4 + (M + 1) div 4
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(M + 1) div 2 = (M + 1) div 4 + (M + 1) div 4

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(M + 1) div 2 = (M + 1) div 4 + (M + 1) div 4

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (\<omega> [^]\<^bsub>R\<^esub> \<dots>) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) =
               \<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') [^]\<^bsub>S\<^esub> ((M + 1) div 4) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4 + (M + 1) div 4)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') [^]\<^bsub>S\<^esub> ((M + 1) div 4) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4))
[PROOF STEP]
by (simp add: S.cring_simprules S.nat_pow_distrib flip: S.nat_pow_mult)
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4 + (M + 1) div 4)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') [^]\<^bsub>S\<^esub> ((M + 1) div 4) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4 + (M + 1) div 4)) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> ((M + 1) div 4)) = \<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') [^]\<^bsub>S\<^esub> ((M + 1) div 4) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> ((M + 1) div 4))

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "\<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') = \<phi> \<one>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') = \<phi> \<one>\<^bsub>R\<^esub>
[PROOF STEP]
unfolding \<phi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_hom M (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') = lucas_lehmer_hom M \<one>\<^bsub>R\<^esub>
[PROOF STEP]
by (intro lucas_lehmer_hom_cong)
         (auto simp: \<omega>_def \<omega>'_def lucas_lehmer_ring_def lucas_lehmer_mult'_def)
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') = \<phi> \<one>\<^bsub>R\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> \<otimes>\<^bsub>R\<^esub> \<omega>') = \<phi> \<one>\<^bsub>R\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "(M + 1) div 4 = 2 ^ (p - 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M + 1) div 4 = 2 ^ (p - 2)
[PROOF STEP]
using p_gt_2
[PROOF STATE]
proof (prove)
using this:
2 < p

goal (1 subgoal):
 1. (M + 1) div 4 = 2 ^ (p - 2)
[PROOF STEP]
by (auto simp: M_def power_diff)
[PROOF STATE]
proof (state)
this:
(M + 1) div 4 = 2 ^ (p - 2)

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> \<one>\<^bsub>R\<^esub> [^]\<^bsub>S\<^esub> 2 ^ (p - 2) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) \<oplus>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
show eq4: "\<phi> (\<omega> [^]\<^bsub>R\<^esub> (2 ^ (p - 2) :: nat) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> (2 ^ (p - 2) :: nat)) = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
using this:
\<phi> \<one>\<^bsub>R\<^esub> [^]\<^bsub>S\<^esub> 2 ^ (p - 2) \<otimes>\<^bsub>S\<^esub> \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) \<oplus>\<^bsub>S\<^esub> \<phi> (\<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have "\<phi> ?lhs = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (rule eq4)
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
have "lucas_lehmer_to_real ?lhs =
             lucas_lehmer_to_real (gen_lucas_lehmer_sequence 4 (p - 2), 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_to_real (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = lucas_lehmer_to_real (gen_lucas_lehmer_sequence 4 (p - 2), 0)
[PROOF STEP]
by (simp add: \<omega>_def \<omega>'_def lucas_lehmer_to_real_simps gen_lucas_lehmer_sequence_4_closed_form1)
[PROOF STATE]
proof (state)
this:
lucas_lehmer_to_real (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = lucas_lehmer_to_real (gen_lucas_lehmer_sequence 4 (p - 2), 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
hence "?lhs = (gen_lucas_lehmer_sequence 4 (p - 2), 0)"
[PROOF STATE]
proof (prove)
using this:
lucas_lehmer_to_real (\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2)) = lucas_lehmer_to_real (gen_lucas_lehmer_sequence 4 (p - 2), 0)

goal (1 subgoal):
 1. \<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2) = (gen_lucas_lehmer_sequence 4 (p - 2), 0)
[PROOF STEP]
by (rule injD[OF lucas_lehmer_to_real_inj])
[PROOF STATE]
proof (state)
this:
\<omega> [^]\<^bsub>R\<^esub> 2 ^ (p - 2) \<oplus>\<^bsub>R\<^esub> \<omega>' [^]\<^bsub>R\<^esub> 2 ^ (p - 2) = (gen_lucas_lehmer_sequence 4 (p - 2), 0)

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> (gen_lucas_lehmer_sequence 4 (p - 2), 0) = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "gen_lucas_lehmer_sequence 4 (p - 2) mod M = 0"
[PROOF STATE]
proof (prove)
using this:
\<phi> (gen_lucas_lehmer_sequence 4 (p - 2), 0) = \<zero>\<^bsub>S\<^esub>

goal (1 subgoal):
 1. gen_lucas_lehmer_sequence 4 (p - 2) mod int M = 0
[PROOF STEP]
using M_gt_6
[PROOF STATE]
proof (prove)
using this:
\<phi> (gen_lucas_lehmer_sequence 4 (p - 2), 0) = \<zero>\<^bsub>S\<^esub>
6 < M

goal (1 subgoal):
 1. gen_lucas_lehmer_sequence 4 (p - 2) mod int M = 0
[PROOF STEP]
by (auto simp: \<phi>_def lucas_lehmer_hom_def S_def lucas_lehmer_ring_mod_def)
[PROOF STATE]
proof (state)
this:
gen_lucas_lehmer_sequence 4 (p - 2) mod int M = 0

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
thus "(2 ^ p - 1) dvd gen_lucas_lehmer_sequence 4 (p - 2)"
[PROOF STATE]
proof (prove)
using this:
gen_lucas_lehmer_sequence 4 (p - 2) mod int M = 0

goal (1 subgoal):
 1. 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)
[PROOF STEP]
by (simp add: M_def mod_eq_0_iff_dvd of_nat_diff)
[PROOF STATE]
proof (state)
this:
2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Prefixes_conc [simp]: "B \<noteq> {} \<Longrightarrow> Prefixes (A @@ B) = Prefixes A \<union> (A @@ Prefixes B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> Prefixes (A @@ B) = Prefixes A \<union> A @@ Prefixes B
[PROOF STEP]
unfolding Prefixes_altdef conc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> (\<Union>w\<in>{xs @ ys |xs ys. xs \<in> A \<and> ys \<in> B}. set (prefixes w)) = (\<Union>w\<in>A. set (prefixes w)) \<union> {xs @ ys |xs ys. xs \<in> A \<and> ys \<in> (\<Union>w\<in>B. set (prefixes w))}
[PROOF STEP]
by (force simp: prefix_append)


[STATEMENT]
lemma prv_neg_imp_imp_trans:
  assumes "\<phi> \<in> fmla" "\<chi> \<in> fmla"  "\<psi> \<in> fmla"
    and "prv (neg \<phi>)"
    and "prv (imp \<chi> (imp \<psi> \<phi>))"
  shows "prv (imp \<chi> (neg \<psi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<chi> (neg \<psi>))
[PROOF STEP]
unfolding neg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<chi> (imp \<psi> fls))
[PROOF STEP]
by (metis assms cnj fls neg_def prv_cnj_imp prv_cnj_imp_monoR2 prv_prv_imp_trans)


[STATEMENT]
lemma int_emp[simp]:
assumes "i > 0"
shows "{..<i} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<i} \<noteq> {}
[PROOF STEP]
by (metis assms emptyE lessThan_iff)


[STATEMENT]
lemma finite_cases [consumes 1, case_names empty insert]:
  "\<lbrakk>finite F; F = {} \<Longrightarrow> P; \<And>A x. \<lbrakk>F = insert x A; x \<notin> A; finite A\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite F; F = {} \<Longrightarrow> P; \<And>A x. \<lbrakk>F = insert x A; x \<notin> A; finite A\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (induct F rule: finite_induct, simp_all)