[STATEMENT]
lemma psi_l_Suc_l_derive:
  "2 * (alpha_l l * ccos (\<theta> / 2) - beta_l l * csin (\<theta> / 2)) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
let ?l = "2 * ((alpha_l l) * ccos (\<theta> / 2) - (beta_l l) * csin (\<theta> / 2))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
have "?l \<cdot>\<^sub>v \<psi> = ?l \<cdot>\<^sub>v (ccos (\<theta> / 2) \<cdot>\<^sub>v \<alpha> + csin (\<theta> / 2) \<cdot>\<^sub>v \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
unfolding \<psi>_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
have "\<dots> = ?l \<cdot>\<^sub>v (ccos (\<theta> / 2) \<cdot>\<^sub>v \<alpha>) + ?l \<cdot>\<^sub>v (csin (\<theta> / 2) \<cdot>\<^sub>v \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
apply (subst smult_add_distrib_vec[of _ N])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> \<in> carrier_vec N
 2. complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> \<in> carrier_vec N
 3. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
using \<alpha>_dim \<beta>_dim
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> carrier_vec N
dim_vec \<alpha> = N
\<beta> \<in> carrier_vec N
dim_vec \<beta> = N

goal (3 subgoals):
 1. complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> \<in> carrier_vec N
 2. complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> \<in> carrier_vec N
 3. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
have "\<dots> = (?l * ccos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + (?l * csin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha>) + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v (complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
have "?l \<cdot>\<^sub>v \<psi>  = (?l * ccos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + (?l * csin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
have "?l \<cdot>\<^sub>v \<psi> - (psi'_l l) = ((?l * ccos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - (alpha_l l) \<cdot>\<^sub>v \<alpha>) + ((?l * csin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + (beta_l l) \<cdot>\<^sub>v \<beta>)"
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
unfolding psi'_l_def
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - (alpha_l l \<cdot>\<^sub>v \<alpha> - beta_l l \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>)

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
have "\<dots> = (?l * ccos (\<theta> / 2) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (?l * csin (\<theta> / 2) + beta_l l) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>) = (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
apply (subst minus_smult_vec_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
apply (subst add_smult_distrib_vec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>) = 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>) = (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> - alpha_l l \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta> + beta_l l \<cdot>\<^sub>v \<beta>) = (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
have "\<dots> = (alpha_l (l + 1)) \<cdot>\<^sub>v \<alpha> + (beta_l (l + 1)) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta> = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
using alpha_l_Suc_l_derive beta_l_Suc_l_derive
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l ?l * complex_of_real (cos (\<theta> / 2)) - beta_l ?l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l ?l = alpha_l (?l + 1)
2 * (alpha_l ?l * complex_of_real (cos (\<theta> / 2)) - beta_l ?l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l ?l = beta_l (?l + 1)

goal (1 subgoal):
 1. (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta> = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (cos (\<theta> / 2)) - alpha_l l) \<cdot>\<^sub>v \<alpha> + (2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) * complex_of_real (sin (\<theta> / 2)) + beta_l l) \<cdot>\<^sub>v \<beta> = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
have "?l \<cdot>\<^sub>v \<psi> - (psi'_l l) = (alpha_l (l + 1)) \<cdot>\<^sub>v \<alpha> + (beta_l (l + 1)) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)
[PROOF STEP]
unfolding psi_l_def
[PROOF STATE]
proof (prove)
using this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>

goal (1 subgoal):
 1. 2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = alpha_l (l + 1) \<cdot>\<^sub>v \<alpha> + beta_l (l + 1) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (alpha_l l * complex_of_real (cos (\<theta> / 2)) - beta_l l * complex_of_real (sin (\<theta> / 2))) \<cdot>\<^sub>v \<psi> - psi'_l l = psi_l (l + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diff_right: "prod a (b - b') = prod a b - prod a b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ** (b - b') = a ** b - a ** b'
[PROOF STEP]
by (rule additive.diff [OF additive_right])


[STATEMENT]
lemma nat_of_natural_max [simp]:
  "nat_of_natural (max k l) = max (nat_of_natural k) (nat_of_natural l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_natural (max k l) = max (nat_of_natural k) (nat_of_natural l)
[PROOF STEP]
by transfer rule


[STATEMENT]
lemma ss_rewrite:
  assumes "e' < e"
    and "e < order \<G>"
    and a_mem:"a  \<in> carrier \<G>"
    and h_mem: "h \<in> carrier \<G>"
    and a: "a \<otimes> h [^] e = \<^bold>g [^] z"
    and a': "a \<otimes> h [^] e' = \<^bold>g [^] z'"
  shows  "h = \<^bold>g [^] ((int z - int z') * inverse ((e - e')) (order \<G>) mod int (order \<G>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have gcd: "gcd (nat (int e - int e') mod (order \<G>)) (order \<G>) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (nat (int e - int e') mod order \<G>) (order \<G>) = 1
[PROOF STEP]
using prime_field
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime ?q; ?a < ?q; ?a \<noteq> 0\<rbrakk> \<Longrightarrow> coprime ?a ?q

goal (1 subgoal):
 1. gcd (nat (int e - int e') mod order \<G>) (order \<G>) = 1
[PROOF STEP]
by (metis Primes.prime_nat_def assms(1) assms(2) coprime_imp_gcd_eq_1 diff_is_0_eq less_imp_diff_less
            mod_less nat_minus_as_int not_less schnorr_base.prime_order schnorr_base_axioms)
[PROOF STATE]
proof (state)
this:
gcd (nat (int e - int e') mod order \<G>) (order \<G>) = 1

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have "a = \<^bold>g [^] z \<otimes> inv (h [^] e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = \<^bold>g [^] z \<otimes> inv (h [^] e)
[PROOF STEP]
using a a_mem
[PROOF STATE]
proof (prove)
using this:
a \<otimes> h [^] e = \<^bold>g [^] z
a \<in> carrier \<G>

goal (1 subgoal):
 1. a = \<^bold>g [^] z \<otimes> inv (h [^] e)
[PROOF STEP]
by (simp add: h_mem group.inv_solve_right)
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z \<otimes> inv (h [^] e)

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z \<otimes> inv (h [^] e)

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
have "a = \<^bold>g [^] z' \<otimes> inv (h [^] e')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = \<^bold>g [^] z' \<otimes> inv (h [^] e')
[PROOF STEP]
using a' a_mem
[PROOF STATE]
proof (prove)
using this:
a \<otimes> h [^] e' = \<^bold>g [^] z'
a \<in> carrier \<G>

goal (1 subgoal):
 1. a = \<^bold>g [^] z' \<otimes> inv (h [^] e')
[PROOF STEP]
by (simp add: h_mem group.inv_solve_right)
[PROOF STATE]
proof (state)
this:
a = \<^bold>g [^] z' \<otimes> inv (h [^] e')

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a = \<^bold>g [^] z \<otimes> inv (h [^] e)
a = \<^bold>g [^] z' \<otimes> inv (h [^] e')
[PROOF STEP]
have "\<^bold>g [^] z \<otimes> h [^] e'  = \<^bold>g [^] z' \<otimes> h [^] e"
[PROOF STATE]
proof (prove)
using this:
a = \<^bold>g [^] z \<otimes> inv (h [^] e)
a = \<^bold>g [^] z' \<otimes> inv (h [^] e')

goal (1 subgoal):
 1. \<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e
[PROOF STEP]
using h_mem
[PROOF STATE]
proof (prove)
using this:
a = \<^bold>g [^] z \<otimes> inv (h [^] e)
a = \<^bold>g [^] z' \<otimes> inv (h [^] e')
h \<in> carrier \<G>

goal (1 subgoal):
 1. \<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e
[PROOF STEP]
by (metis (no_types, lifting) a a' h_mem a_mem cyclic_group_assoc cyclic_group_commute nat_pow_closed)
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
obtain t :: nat where  t: "h = \<^bold>g  [^] t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. h = \<^bold>g [^] t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using h_mem generatorE
[PROOF STATE]
proof (prove)
using this:
h \<in> carrier \<G>
\<lbrakk>?x \<in> carrier \<G>; \<And>n. ?x = \<^bold>g [^] n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>t. h = \<^bold>g [^] t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
h = \<^bold>g [^] t

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e
h = \<^bold>g [^] t
[PROOF STEP]
have "\<^bold>g [^] (z + t * e')  = \<^bold>g [^] (z' +  t * e) "
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] z \<otimes> h [^] e' = \<^bold>g [^] z' \<otimes> h [^] e
h = \<^bold>g [^] t

goal (1 subgoal):
 1. \<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)
[PROOF STEP]
by (simp add: monoid.nat_pow_mult nat_pow_pow)
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[z + t * e' = z' +  t * e] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)

goal (1 subgoal):
 1. [z + t * e' = z' + t * e] (mod order \<G>)
[PROOF STEP]
using group_eq_pow_eq_mod order_gt_0
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] (z + t * e') = \<^bold>g [^] (z' + t * e)
\<lbrakk>\<^bold>g [^] ?a = \<^bold>g [^] ?b; 0 < order \<G>\<rbrakk> \<Longrightarrow> [?a = ?b] (mod order \<G>)
0 < order \<G>

goal (1 subgoal):
 1. [z + t * e' = z' + t * e] (mod order \<G>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[z + t * e' = z' + t * e] (mod order \<G>)

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z + int t * int e' = int z' +  int t * int e] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[z + t * e' = z' + t * e] (mod order \<G>)

goal (1 subgoal):
 1. [int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))
[PROOF STEP]
using cong_int_iff
[PROOF STATE]
proof (prove)
using this:
[z + t * e' = z' + t * e] (mod order \<G>)
[int ?m = int ?q] (mod int ?n) = [?m = ?q] (mod ?n)

goal (1 subgoal):
 1. [int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
[int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * int e - int t * int e'] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z + int t * int e' = int z' + int t * int e] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))
[PROOF STEP]
by (smt cong_iff_lin)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * (int e - int e')] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
[PROOF STEP]
by (simp add: \<open>[int z - int z' = int t * int e - int t * int e'] (mod int (order \<G>))\<close> right_diff_distrib)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * (int e - int e')] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
[PROOF STEP]
by (meson cong_diff cong_mod_left cong_mult cong_refl cong_trans)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence *: "[int z - int z' = int t * (int e - int e')] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
e' < e
e < order \<G>
a \<in> carrier \<G>
h \<in> carrier \<G>
a \<otimes> h [^] e = \<^bold>g [^] z
a \<otimes> h [^] e' = \<^bold>g [^] z'

goal (1 subgoal):
 1. [int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
[PROOF STEP]
by (simp add: int_ops(9) of_nat_diff)
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[int z - int z' = int t * nat (int e - int e')] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))

goal (1 subgoal):
 1. [int z - int z' = int t * int (nat (int e - int e'))] (mod int (order \<G>))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))
e' < e
e < order \<G>
a \<in> carrier \<G>
h \<in> carrier \<G>
a \<otimes> h [^] e = \<^bold>g [^] z
a \<otimes> h [^] e' = \<^bold>g [^] z'

goal (1 subgoal):
 1. [int z - int z' = int t * int (nat (int e - int e'))] (mod int (order \<G>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[int z - int z' = int t * int (nat (int e - int e'))] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence **: "[(int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>))
              = int t * (nat (int e - int e')
                  * fst (bezw ((nat (int e - int e'))) (order \<G>)))] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[int z - int z' = int t * int (nat (int e - int e'))] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * (int (nat (int e - int e')) * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>))] (mod int (order \<G>))
[PROOF STEP]
by (smt \<open>[int z - int z' = int t * (int e - int e')] (mod int (order \<G>))\<close> assms(1) assms(2)
          cong_scalar_right int_nat_eq less_imp_of_nat_less mod_less more_arith_simps(11) nat_less_iff of_nat_0_le_iff)
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * (int (nat (int e - int e')) * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>))] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>)) = int t * 1] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * (int (nat (int e - int e')) * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>))] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * 1] (mod int (order \<G>))
[PROOF STEP]
by (metis (no_types, opaque_lifting) gcd inverse assms(2) cong_scalar_left cong_trans less_imp_diff_less mod_less mult.comm_neutral nat_minus_as_int)
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * 1] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[(int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>))
              = t] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t * 1] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t] (mod int (order \<G>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "[ ((int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>)))mod order \<G>
              = t] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))
[PROOF STEP]
using cong_mod_left
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) = int t] (mod int (order \<G>))
[?b mod ?a = ?c] (mod ?a) = [?b = ?c] (mod ?a)

goal (1 subgoal):
 1. [(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence  **: "[nat (((int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>)))mod order \<G>)
              = t] (mod  order \<G>)"
[PROOF STATE]
proof (prove)
using this:
[(int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>) = int t] (mod int (order \<G>))

goal (1 subgoal):
 1. [nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)
[PROOF STEP]
by (metis Euclidean_Division.pos_mod_sign cong_int_iff int_nat_eq of_nat_0_less_iff order_gt_0)
[PROOF STATE]
proof (state)
this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
hence "\<^bold>g [^] (nat (((int z - int z') * fst (bezw ((nat (int e - int e'))) (order \<G>)))mod order \<G>)) = \<^bold>g [^] t"
[PROOF STATE]
proof (prove)
using this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)

goal (1 subgoal):
 1. \<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
[PROOF STEP]
using cyclic_group.pow_generator_eq_iff_cong cyclic_group_axioms order_gt_0 order_gt_0_iff_finite
[PROOF STATE]
proof (prove)
using this:
[nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = t] (mod order \<G>)
\<lbrakk>Cyclic_Group.cyclic_group ?G; finite (carrier ?G)\<rbrakk> \<Longrightarrow> (\<^bold>g\<^bsub>?G\<^esub> [^]\<^bsub>?G\<^esub> ?x = \<^bold>g\<^bsub>?G\<^esub> [^]\<^bsub>?G\<^esub> ?y) = [?x = ?y] (mod order ?G)
Cyclic_Group.cyclic_group \<G>
0 < order \<G>
(0 < order \<G>) = finite (carrier \<G>)

goal (1 subgoal):
 1. \<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] nat ((int z - int z') * Number_Theory_Aux.inverse (nat (int e - int e')) (order \<G>) mod int (order \<G>)) = \<^bold>g [^] t
h = \<^bold>g [^] t

goal (1 subgoal):
 1. h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))
[PROOF STEP]
by (smt Euclidean_Division.pos_mod_sign discrete_log.order_gt_0 int_pow_def2 nat_minus_as_int of_nat_0_less_iff)
[PROOF STATE]
proof (state)
this:
h = \<^bold>g [^] ((int z - int z') * Number_Theory_Aux.inverse (e - e') (order \<G>) mod int (order \<G>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diff_left: "prod (a - a') b = prod a b - prod a' b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - a') ** b = a ** b - a' ** b
[PROOF STEP]
by (rule additive.diff [OF additive_left])


[STATEMENT]
lemma (in fixed_carrier_mat) sum_mat_carrier:
  shows "(\<And>i. i \<in> I \<Longrightarrow> (A i)\<in> fc_mats) \<Longrightarrow> sum_mat A I \<in> carrier_mat dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> local.sum_mat A I \<in> carrier_mat dimR dimC
[PROOF STEP]
unfolding sum_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> sum_with (+) (0\<^sub>m dimR dimC) A I \<in> carrier_mat dimR dimC
[PROOF STEP]
using sum_with_mem[of A I] fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
A ` I \<subseteq> fc_mats \<Longrightarrow> sum_with (+) (0\<^sub>m dimR dimC) A I \<in> fc_mats
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> A i \<in> fc_mats) \<Longrightarrow> sum_with (+) (0\<^sub>m dimR dimC) A I \<in> carrier_mat dimR dimC
[PROOF STEP]
by auto


[STATEMENT]
lemma fls_mult_left_inverse_base_factor:
  fixes   f :: "'a::ring_1 fls"
  assumes "x * (f $$ fls_subdegree f) = 1"
  shows   "fls_left_inverse (fls_base_factor f) x * f = fls_X_intpow (fls_subdegree f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_left_inverse (fls_base_factor f) x * f = fls_X_intpow (fls_subdegree f)
[PROOF STEP]
using   assms fls_base_factor_to_fps_base_factor[of f] fls_base_factor_subdegree[of f]
          fls_shifted_times_simps(2)[of "-fls_subdegree f" "fls_left_inverse f x" f]
          fls_left_inverse[of x f]
[PROOF STATE]
proof (prove)
using this:
x * f $$ fls_subdegree f = (1::'a)
fls_base_factor_to_fps (fls_base_factor f) = fls_base_factor_to_fps f
fls_subdegree (fls_base_factor f) = 0
fls_shift (- fls_subdegree f) (fls_left_inverse f x) * f = fls_shift (- fls_subdegree f) (fls_left_inverse f x * f)
x * f $$ fls_subdegree f = (1::'a) \<Longrightarrow> fls_left_inverse f x * f = 1

goal (1 subgoal):
 1. fls_left_inverse (fls_base_factor f) x * f = fls_X_intpow (fls_subdegree f)
[PROOF STEP]
by      simp


[STATEMENT]
lemma EmptyNotInEquivSet: "{} \<notin> calM // RelM"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<notin> calM // RelM
[PROOF STEP]
by (blast elim!: quotientE dest: RelM_equiv [THEN equiv_class_self])


[STATEMENT]
lemma eval_Mn_total:
  assumes "recfn (length xs) (Mn n f)" and "total f"
  shows "eval (Mn n f) xs =
    (if (\<exists>z. eval f (z # xs) \<down>= 0)
     then Some (LEAST z. eval f (z # xs) \<down>= 0)
     else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 then Some (LEAST z. eval f (z # xs) \<down>= 0) else None)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
recfn (length xs) (Mn n f)
Partial_Recursive.total f

goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 then Some (LEAST z. eval f (z # xs) \<down>= 0) else None)
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_sum_add:
  fixes f :: "nat \<Rightarrow> 'b::semiring_1 mat" and  g :: "nat \<Rightarrow> 'b::semiring_1 mat" and  h :: "nat \<Rightarrow> 'b::semiring_1 mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> (\<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d) \<Longrightarrow> (\<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d) \<Longrightarrow>
     (\<And>k. k < n \<Longrightarrow> f k = g k + h k) \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f 0 = matrix_sum d g 0 + matrix_sum d h 0
 2. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> f ?k = g ?k + h ?k

goal (2 subgoals):
 1. \<lbrakk>\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < 0 \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f 0 = matrix_sum d g 0 + matrix_sum d h 0
 2. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> f ?k = g ?k + h ?k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < 0 \<Longrightarrow> f ?k = g ?k + h ?k

goal (1 subgoal):
 1. matrix_sum d f 0 = matrix_sum d g 0 + matrix_sum d h 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f 0 = matrix_sum d g 0 + matrix_sum d h 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k = g ?k + h ?k

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k = g ?k + h ?k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k = g ?k + h ?k

goal (1 subgoal):
 1. matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
have gh: "matrix_sum d g n \<in> carrier_mat d d \<and> matrix_sum d h n \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d g n \<in> carrier_mat d d \<and> matrix_sum d h n \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim Suc(3, 4)
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < ?n \<Longrightarrow> ?f k \<in> carrier_mat ?d ?d) \<Longrightarrow> matrix_sum ?d ?f ?n \<in> carrier_mat ?d ?d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d g n \<in> carrier_mat d d \<and> matrix_sum d h n \<in> carrier_mat d d
[PROOF STEP]
by (simp add: matrix_sum_dim)
[PROOF STATE]
proof (state)
this:
matrix_sum d g n \<in> carrier_mat d d \<and> matrix_sum d h n \<in> carrier_mat d d

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
have nSuc: "n < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < Suc n

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
have sumf: "matrix_sum d f n = matrix_sum d g n + matrix_sum d h n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k = g ?k + h ?k

goal (1 subgoal):
 1. matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f n = matrix_sum d g n + matrix_sum d h n

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
have "matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
unfolding matrix_sum.simps Suc(5)[OF nSuc] sumf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g n + h n + (matrix_sum d g n + matrix_sum d h n) = g n + matrix_sum d g n + (h n + matrix_sum d h n)
[PROOF STEP]
apply (mat_assoc d)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. matrix_sum d h n \<in> carrier_mat d d
 2. matrix_sum d g n \<in> carrier_mat d d
 3. h n \<in> carrier_mat d d
 4. g n \<in> carrier_mat d d
[PROOF STEP]
using gh Suc
[PROOF STATE]
proof (prove)
using this:
matrix_sum d g n \<in> carrier_mat d d \<and> matrix_sum d h n \<in> carrier_mat d d
\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> g ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> h ?k \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k = g ?k + h ?k

goal (4 subgoals):
 1. matrix_sum d h n \<in> carrier_mat d d
 2. matrix_sum d g n \<in> carrier_mat d d
 3. h n \<in> carrier_mat d d
 4. g n \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f n = matrix_sum d g n + matrix_sum d h n; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> g k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> h k \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k = g k + h k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)

goal (1 subgoal):
 1. matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc n) = matrix_sum d g (Suc n) + matrix_sum d h (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtranclp_eqvt[eqvt]: "\<pi> \<bullet> rtranclp P v\<^sub>1 v\<^sub>2 = rtranclp (\<pi> \<bullet> P) (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> \<bullet> P\<^sup>*\<^sup>* v\<^sub>1 v\<^sub>2 = (\<pi> \<bullet> P)\<^sup>*\<^sup>* (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)
[PROOF STEP]
unfolding rtranclp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> \<bullet> lfp (\<lambda>p x1 x2. (\<exists>a. x1 = a \<and> x2 = a) \<or> (\<exists>a b c. x1 = a \<and> x2 = c \<and> p a b \<and> P b c)) v\<^sub>1 v\<^sub>2 = lfp (\<lambda>p x1 x2. (\<exists>a. x1 = a \<and> x2 = a) \<or> (\<exists>a b c. x1 = a \<and> x2 = c \<and> p a b \<and> (\<pi> \<bullet> P) b c)) (\<pi> \<bullet> v\<^sub>1) (\<pi> \<bullet> v\<^sub>2)
[PROOF STEP]
by perm_simp rule


[STATEMENT]
lemma useful: "(\<forall>x. \<phi> x \<longrightarrow> \<psi>) \<Longrightarrow> ((\<exists>x. \<phi> x) \<longrightarrow> \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<phi> x \<longrightarrow> \<psi> \<Longrightarrow> (\<exists>x. \<phi> x) \<longrightarrow> \<psi>
[PROOF STEP]
by simp


[STATEMENT]
lemma boundedByUn: "boundedBy N (A Un B) = (boundedBy N A & boundedBy N B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boundedBy N (A \<union> B) = (boundedBy N A \<and> boundedBy N B)
[PROOF STEP]
by(auto simp add: boundedBy_def)


[STATEMENT]
lemma prod_2_Rel_is_cat_Set_iso_arr'[cat_rel_par_Set_cs_intros]:
  assumes "S : A \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> B"
    and "T : C \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> D"
    and "AC = A \<times>\<^sub>\<circ> C"
    and "BD = B \<times>\<^sub>\<circ> D"
    and "\<CC>' = cat_Set \<alpha>"
  shows "S \<^sub>A\<times>\<^sub>S\<^sub>e\<^sub>t T : AC \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>'\<^esub> BD"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<^sub>A\<times>\<^sub>R\<^sub>e\<^sub>l T : AC \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>'\<^esub> BD
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
S : A \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> B
T : C \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> D

goal (1 subgoal):
 1. S \<^sub>A\<times>\<^sub>R\<^sub>e\<^sub>l T : AC \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>'\<^esub> BD
[PROOF STEP]
unfolding assms(3-5)
[PROOF STATE]
proof (prove)
using this:
S : A \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> B
T : C \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> D

goal (1 subgoal):
 1. S \<^sub>A\<times>\<^sub>R\<^sub>e\<^sub>l T : A \<times>\<^sub>\<circ> C \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>cat_Set \<alpha>\<^esub> B \<times>\<^sub>\<circ> D
[PROOF STEP]
by (rule prod_2_Rel_is_cat_Set_iso_arr)


[STATEMENT]
lemma congruence_mult:
  fixes m :: nat
  assumes "b>2"
  shows "n>m ==> mat_pow (nat(int n- int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m < 0 \<Longrightarrow> mat_pow (nat (int 0 - int m)) (B b) = mat_mul (mat_pow 0 (B b)) (mat_pow m (B_inv b))
 2. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
m < 0

goal (2 subgoals):
 1. m < 0 \<Longrightarrow> mat_pow (nat (int 0 - int m)) (B b) = mat_mul (mat_pow 0 (B b)) (mat_pow m (B_inv b))
 2. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
m < 0

goal (1 subgoal):
 1. mat_pow (nat (int 0 - int m)) (B b) = mat_mul (mat_pow 0 (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int 0 - int m)) (B b) = mat_mul (mat_pow 0 (B b)) (mat_pow m (B_inv b))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))
m < Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
consider (eqm) "n == m" | (gm) "n < m" | (lm) "n>m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<equiv> m \<Longrightarrow> thesis; n < m \<Longrightarrow> thesis; m < n \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>n \<equiv> m \<Longrightarrow> ?thesis; n < m \<Longrightarrow> ?thesis; m < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>n. \<lbrakk>m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)); m < Suc n\<rbrakk> \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n \<equiv> m \<Longrightarrow> ?thesis; n < m \<Longrightarrow> ?thesis; m < n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. n < m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 3. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
case gm
[PROOF STATE]
proof (state)
this:
n < m

goal (3 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. n < m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 3. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from Suc.prems gm not_less_eq
[PROOF STATE]
proof (chain)
picking this:
m < Suc n
n < m
(\<not> ?m < ?n) = (?n < Suc ?m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m < Suc n
n < m
(\<not> ?m < ?n) = (?n < Suc ?m)

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))

goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
case lm
[PROOF STATE]
proof (state)
this:
m < n

goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
have S1: "mat_pow (nat(int (Suc(n)) - int m)) (B b) = mat_mul (B b) (mat_pow (nat(int n - int m)) (B b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_pow (nat (int n - int m)) (B b))
[PROOF STEP]
by (metis Suc.prems Suc_diff_Suc diff_Suc_1 diff_Suc_Suc mat_pow.simps(2) nat_minus_as_int)
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_pow (nat (int n - int m)) (B b))

goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from lm S1 Suc.IH
[PROOF STATE]
proof (chain)
picking this:
m < n
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_pow (nat (int n - int m)) (B b))
m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
have S2: "mat_pow (nat(int (Suc(n)) - int m)) (B b) = mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)))"
[PROOF STATE]
proof (prove)
using this:
m < n
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_pow (nat (int n - int m)) (B b))
m < n \<Longrightarrow> mat_pow (nat (int n - int m)) (B b) = mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)))

goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S2 mat_associativity mat2.exhaust
[PROOF STATE]
proof (chain)
picking this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)))
mat_mul (mat_mul ?D ?B) ?C = mat_mul ?D (mat_mul ?B ?C)
(\<And>x1 x2 x3 x4. ?y = mat x1 x2 x3 x4 \<Longrightarrow> ?P) \<Longrightarrow> ?P
[PROOF STEP]
have S3: "mat_pow (nat(int (Suc(n)) - int m)) (B b) = mat_mul (mat_mul (B b) (mat_pow n (B b))) (mat_pow m (B_inv b))"
[PROOF STATE]
proof (prove)
using this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)))
mat_mul (mat_mul ?D ?B) ?C = mat_mul ?D (mat_mul ?B ?C)
(\<And>x1 x2 x3 x4. ?y = mat x1 x2 x3 x4 \<Longrightarrow> ?P) \<Longrightarrow> ?P

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_mul (B b) (mat_pow n (B b))) (mat_pow m (B_inv b))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_mul (B b) (mat_pow n (B b))) (mat_pow m (B_inv b))

goal (2 subgoals):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
 2. m < n \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_mul (B b) (mat_pow n (B b))) (mat_pow m (B_inv b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_mul (B b) (mat_pow n (B b))) (mat_pow m (B_inv b))

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
case eqm
[PROOF STATE]
proof (state)
this:
n \<equiv> m

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from eqm
[PROOF STATE]
proof (chain)
picking this:
n \<equiv> m
[PROOF STEP]
have S1: "nat(int (Suc(n))- int m) = 1"
[PROOF STATE]
proof (prove)
using this:
n \<equiv> m

goal (1 subgoal):
 1. nat (int (Suc n) - int m) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat (int (Suc n) - int m) = 1

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S1
[PROOF STATE]
proof (chain)
picking this:
nat (int (Suc n) - int m) = 1
[PROOF STEP]
have S2: "mat_pow (nat(int (Suc(n))- int m)) (B b) == B b"
[PROOF STATE]
proof (prove)
using this:
nat (int (Suc n) - int m) = 1

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) \<equiv> B b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) \<equiv> B b

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from eqm
[PROOF STATE]
proof (chain)
picking this:
n \<equiv> m
[PROOF STEP]
have S3: "(mat_pow (Suc(n)) (B b)) = mat_mul (B b) (mat_pow m (B b))"
[PROOF STATE]
proof (prove)
using this:
n \<equiv> m

goal (1 subgoal):
 1. mat_pow (Suc n) (B b) = mat_mul (B b) (mat_pow m (B b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (Suc n) (B b) = mat_mul (B b) (mat_pow m (B b))

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
mat_pow (Suc n) (B b) = mat_mul (B b) (mat_pow m (B b))
[PROOF STEP]
have S35: "mat_mul (mat_pow (Suc(n)) (B b)) (mat_pow m (B_inv b)) = mat_mul (mat_mul (B b) (mat_pow m (B b))) (mat_pow m (B_inv b))"
[PROOF STATE]
proof (prove)
using this:
mat_pow (Suc n) (B b) = mat_mul (B b) (mat_pow m (B b))

goal (1 subgoal):
 1. mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (mat_mul (B b) (mat_pow m (B b))) (mat_pow m (B_inv b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (mat_mul (B b) (mat_pow m (B b))) (mat_pow m (B_inv b))

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from mat2.exhaust S35 mat_associativity
[PROOF STATE]
proof (chain)
picking this:
(\<And>x1 x2 x3 x4. ?y = mat x1 x2 x3 x4 \<Longrightarrow> ?P) \<Longrightarrow> ?P
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (mat_mul (B b) (mat_pow m (B b))) (mat_pow m (B_inv b))
mat_mul (mat_mul ?D ?B) ?C = mat_mul ?D (mat_mul ?B ?C)
[PROOF STEP]
have S4: "mat_mul (mat_pow (Suc(n)) (B b)) (mat_pow m (B_inv b))
      = mat_mul (B b) (mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)))"
[PROOF STATE]
proof (prove)
using this:
(\<And>x1 x2 x3 x4. ?y = mat x1 x2 x3 x4 \<Longrightarrow> ?P) \<Longrightarrow> ?P
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (mat_mul (B b) (mat_pow m (B b))) (mat_pow m (B_inv b))
mat_mul (mat_mul ?D ?B) ?C = mat_mul ?D (mat_mul ?B ?C)

goal (1 subgoal):
 1. mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (B b) (mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)))
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (B b) (mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)))

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from congruence_inverse2 assms
[PROOF STATE]
proof (chain)
picking this:
2 < ?b \<Longrightarrow> mat_mul (mat_pow ?n (B ?b)) (mat_pow ?n (B_inv ?b)) = mat 1 0 0 1
2 < b
[PROOF STEP]
have S5: "mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)) =  mat 1 0 0 1"
[PROOF STATE]
proof (prove)
using this:
2 < ?b \<Longrightarrow> mat_mul (mat_pow ?n (B ?b)) (mat_pow ?n (B_inv ?b)) = mat 1 0 0 1
2 < b

goal (1 subgoal):
 1. mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
have S6: "mat_mul (B b) (B_inv b) = mat 1 0 0 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mul (B b) (B_inv b) = mat 1 0 0 1
[PROOF STEP]
using ID_def B_inverse
[PROOF STATE]
proof (prove)
using this:
ID = mat 1 0 0 1
mat_mul (B ?b) (B_inv ?b) = ID

goal (1 subgoal):
 1. mat_mul (B b) (B_inv b) = mat 1 0 0 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_mul (B b) (B_inv b) = mat 1 0 0 1

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S5 S6 eqm
[PROOF STATE]
proof (chain)
picking this:
mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1
mat_mul (B b) (B_inv b) = mat 1 0 0 1
n \<equiv> m
[PROOF STEP]
have S7: "mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1"
[PROOF STATE]
proof (prove)
using this:
mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1
mat_mul (B b) (B_inv b) = mat 1 0 0 1
n \<equiv> m

goal (1 subgoal):
 1. mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from S7
[PROOF STATE]
proof (chain)
picking this:
mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1
[PROOF STEP]
have S8: "mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))) == B b"
[PROOF STATE]
proof (prove)
using this:
mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b)) = mat 1 0 0 1

goal (1 subgoal):
 1. mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))) \<equiv> B b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))) \<equiv> B b

goal (1 subgoal):
 1. n \<equiv> m \<Longrightarrow> mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
from eqm S2 S4 S8
[PROOF STATE]
proof (chain)
picking this:
n \<equiv> m
mat_pow (nat (int (Suc n) - int m)) (B b) \<equiv> B b
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (B b) (mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)))
mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))) \<equiv> B b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<equiv> m
mat_pow (nat (int (Suc n) - int m)) (B b) \<equiv> B b
mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b)) = mat_mul (B b) (mat_mul (mat_pow m (B b)) (mat_pow m (B_inv b)))
mat_mul (B b) (mat_mul (mat_pow n (B b)) (mat_pow m (B_inv b))) \<equiv> B b

goal (1 subgoal):
 1. mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_pow (nat (int (Suc n) - int m)) (B b) = mat_mul (mat_pow (Suc n) (B b)) (mat_pow m (B_inv b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma octo_inner_1 [simp]: "inner 1 x = Ree x"
 and octo_inner_1_right [simp]: "inner x 1 = Ree x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<bullet> x = Ree x &&& x \<bullet> 1 = Ree x
[PROOF STEP]
unfolding inner_octo_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ree 1 * Ree x + Im1 1 * Im1 x + Im2 1 * Im2 x + Im3 1 * Im3 x + Im4 1 * Im4 x + Im5 1 * Im5 x + Im6 1 * Im6 x + Im7 1 * Im7 x = Ree x &&& Ree x * Ree 1 + Im1 x * Im1 1 + Im2 x * Im2 1 + Im3 x * Im3 1 + Im4 x * Im4 1 + Im5 x * Im5 1 + Im6 x * Im6 1 + Im7 x * Im7 1 = Ree x
[PROOF STEP]
by simp_all


[STATEMENT]
lemma max_add_distrib_right: "x + max y z = max (x+y) (x+z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + max y z = max (x + y) (x + z)
[PROOF STEP]
by (metis add_left_mono max.absorb1 max.cobounded2 max_def)


[STATEMENT]
lemma point_minus [simp]:
  "- (Point xA yA) = Point (- xA) (- yA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Point xA yA = Point (- xA) (- yA)
[PROOF STEP]
by (simp add: point_minus_def)


[STATEMENT]
lemma size_Iff [simp]: "size (A IFF B) = 2*(size A + size B) + 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A IFF B) = 2 * (size A + size B) + 8
[PROOF STEP]
by (simp add: Iff_def)


[STATEMENT]
lemma total_correctness: "\<lbrakk>test p; test q\<rbrakk> \<Longrightarrow> p\<cdot>x\<cdot>!q = 0 \<longleftrightarrow> x\<cdot>!q \<le> !p\<cdot>\<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test p; test q\<rbrakk> \<Longrightarrow> (p \<cdot> x \<cdot> !q = (0::'a)) = (x \<cdot> !q \<le> !p \<cdot> \<top>)
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>test p; test q; p \<cdot> x \<cdot> !q = (0::'a)\<rbrakk> \<Longrightarrow> x \<cdot> !q \<le> !p \<cdot> \<top>
 2. \<lbrakk>test p; test q; x \<cdot> !q \<le> !p \<cdot> \<top>\<rbrakk> \<Longrightarrow> p \<cdot> x \<cdot> !q = (0::'a)
[PROOF STEP]
apply (metis local.test_eq4 local.top_elim mult_assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test p; test q; x \<cdot> !q \<le> !p \<cdot> \<top>\<rbrakk> \<Longrightarrow> p \<cdot> x \<cdot> !q = (0::'a)
[PROOF STEP]
by (metis annil order.antisym test_comp_mult2 join.bot_least mult_assoc mult_isol)


[STATEMENT]
lemma nat_power_le_imp_le_base: "\<lbrakk> n \<noteq> 0; a^n \<le> b^n \<rbrakk> \<Longrightarrow> (a::nat) \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n \<le> b ^ n\<rbrakk> \<Longrightarrow> a \<le> b
[PROOF STEP]
by simp


[STATEMENT]
lemma dverts_children_count_ge2:
  assumes "(t1,e1) \<in> fset xs" and "(t2,e2) \<in> fset xs" and "(t1,e1) \<noteq> (t2,e2)"
      and "x \<in> dverts t1" and "x \<in> dverts t2"
    shows "count (dverts_mset (Node r xs)) x \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> count (dverts_mset (Node r xs)) x
[PROOF STEP]
using dverts_children_count_ge2_aux[OF assms] dverts_mset_count_sum_ge le_trans
[PROOF STATE]
proof (prove)
using this:
2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (dverts_mset t1) x)
(\<Sum>(t1, e1)\<in>fset ?xs. count (dverts_mset t1) ?x) \<le> count (dverts_mset (Node ?r ?xs)) ?x
\<lbrakk>?i \<le> ?j; ?j \<le> ?k\<rbrakk> \<Longrightarrow> ?i \<le> ?k

goal (1 subgoal):
 1. 2 \<le> count (dverts_mset (Node r xs)) x
[PROOF STEP]
by fast


[STATEMENT]
lemma single_vote_to_RPR_iff:
  "\<lbrakk> a \<in> A; x \<in> A; a \<noteq> x \<rbrakk> \<Longrightarrow> (a \<^bsub>(single_vote_to_RPR A b)\<^esub>\<prec> x) \<longleftrightarrow> (b = a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; x \<in> A; a \<noteq> x\<rbrakk> \<Longrightarrow> (a \<^bsub>(single_vote_to_RPR A b)\<^esub>\<prec> x) = (b = a)
[PROOF STEP]
unfolding single_vote_to_RPR_def strict_pref_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; x \<in> A; a \<noteq> x\<rbrakk> \<Longrightarrow> (a \<^bsub>({(b, x) |x. x \<in> A} \<union> (A - {b}) \<times> (A - {b}))\<^esub>\<preceq> x \<and> (x, a) \<notin> {(b, x) |x. x \<in> A} \<union> (A - {b}) \<times> (A - {b})) = (b = a)
[PROOF STEP]
by auto


[STATEMENT]
lemma injectivity_union:
  assumes "A \<union> B = C \<union> D"
  assumes "P A" "P C"
  assumes "Q B" "Q D"
    "\<And>S T. P S \<Longrightarrow> Q T \<Longrightarrow> S \<inter> T = {}"
  shows "A = C \<and> B = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = C \<and> B = D
[PROOF STEP]
using assms Int_Un_distrib Int_commute inf_sup_absorb
[PROOF STATE]
proof (prove)
using this:
A \<union> B = C \<union> D
P A
P C
Q B
Q D
\<lbrakk>P ?S; Q ?T\<rbrakk> \<Longrightarrow> ?S \<inter> ?T = {}
?A \<inter> (?B \<union> ?C) = ?A \<inter> ?B \<union> ?A \<inter> ?C
?A \<inter> ?B = ?B \<inter> ?A
inf ?x (sup ?x ?y) = ?x

goal (1 subgoal):
 1. A = C \<and> B = D
[PROOF STEP]
by blast+


[STATEMENT]
lemma i_mult_i_eq [simp]:
  \<open>\<i> * \<i> = - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> * \<i> = - 1
[PROOF STEP]
by (simp add: gauss_eq_iff)


[STATEMENT]
lemma cnj_add_mult_eq_Re:
  \<open>z * cnj w + cnj z * w = of_int (2 * Re (z * cnj w))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * cnj w + cnj z * w = of_int (2 * Re (z * cnj w))
[PROOF STEP]
by (simp add: gauss_eq_iff)


[STATEMENT]
lemma pairwise_imp_mult:
  assumes "N \<noteq> {#}" and "\<forall>x \<in> set_mset M. \<exists>y \<in> set_mset N. (x, y) \<in> r"
  shows "(M, N) \<in> mult r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M, N) \<in> mult r
[PROOF STEP]
using assms one_step_implies_mult[of _ _ _ "{#}"]
[PROOF STATE]
proof (prove)
using this:
N \<noteq> {#}
\<forall>x\<in>#M. \<exists>y\<in>#N. (x, y) \<in> r
\<lbrakk>?J \<noteq> {#}; \<forall>k\<in>#?K. \<exists>j\<in>#?J. (k, j) \<in> ?r\<rbrakk> \<Longrightarrow> ({#} + ?K, {#} + ?J) \<in> mult ?r

goal (1 subgoal):
 1. (M, N) \<in> mult r
[PROOF STEP]
by auto


[STATEMENT]
lemma "((\<lambda>x::real. exp (exp x) * (exp (sin (1/x + exp (-exp x))) - exp (sin (1/x)))) \<longlongrightarrow> 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (exp x) * (exp (sin (1 / x + exp (- exp x))) - exp (sin (1 / x)))) \<longlongrightarrow> 1) at_top
[PROOF STEP]
by real_asymp