[STATEMENT]
lemma hyperdual_power:
  fixes x :: "('a :: comm_ring_1) hyperdual"
  shows "x ^ n = Hyperdual ((Base x) ^ n)
                           (Eps1 x * of_nat n * (Base x) ^ (n - 1))
                           (Eps2 x * of_nat n * (Base x) ^ (n - 1))
                           (Eps12 x * of_nat n * (Base x) ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * (Base x) ^ (n - 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))
[PROOF STEP]
proof (induction n rule: nat_induct01Suc)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x ^ 0 = Hyperdual (Base x ^ 0) (Eps1 x * of_nat 0 * Base x ^ (0 - 1)) (Eps2 x * of_nat 0 * Base x ^ (0 - 1)) (Eps12 x * of_nat 0 * Base x ^ (0 - 1) + Eps1 x * Eps2 x * of_nat 0 * of_nat (0 - 1) * Base x ^ (0 - 2))
 2. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
 3. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. x ^ 0 = Hyperdual (Base x ^ 0) (Eps1 x * of_nat 0 * Base x ^ (0 - 1)) (Eps2 x * of_nat 0 * Base x ^ (0 - 1)) (Eps12 x * of_nat 0 * Base x ^ (0 - 1) + Eps1 x * Eps2 x * of_nat 0 * of_nat (0 - 1) * Base x ^ (0 - 2))
 2. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
 3. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 0 = Hyperdual (Base x ^ 0) (Eps1 x * of_nat 0 * Base x ^ (0 - 1)) (Eps2 x * of_nat 0 * Base x ^ (0 - 1)) (Eps12 x * of_nat 0 * Base x ^ (0 - 1) + Eps1 x * Eps2 x * of_nat 0 * of_nat (0 - 1) * Base x ^ (0 - 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x ^ 0 = Hyperdual (Base x ^ 0) (Eps1 x * of_nat 0 * Base x ^ (0 - 1)) (Eps2 x * of_nat 0 * Base x ^ (0 - 1)) (Eps12 x * of_nat 0 * Base x ^ (0 - 1) + Eps1 x * Eps2 x * of_nat 0 * of_nat (0 - 1) * Base x ^ (0 - 2))

goal (2 subgoals):
 1. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
 2. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
 2. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
 2. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x ^ 1 = Hyperdual (Base x ^ 1) (Eps1 x * of_nat 1 * Base x ^ (1 - 1)) (Eps2 x * of_nat 1 * Base x ^ (1 - 1)) (Eps12 x * of_nat 1 * Base x ^ (1 - 1) + Eps1 x * Eps2 x * of_nat 1 * of_nat (1 - 1) * Base x ^ (1 - 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
case hyp: (Suc n)
[PROOF STATE]
proof (state)
this:
0 < n
x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n; x ^ n = Hyperdual (Base x ^ n) (Eps1 x * of_nat n * Base x ^ (n - 1)) (Eps2 x * of_nat n * Base x ^ (n - 1)) (Eps12 x * of_nat n * Base x ^ (n - 1) + Eps1 x * Eps2 x * of_nat n * of_nat (n - 1) * Base x ^ (n - 2))\<rbrakk> \<Longrightarrow> x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))
[PROOF STEP]
proof (simp add: hyp, intro conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. Base x * (Eps1 x * of_nat n * Base x ^ (n - Suc 0)) + Eps1 x * Base x ^ n = Eps1 x * ((1::'a) + of_nat n) * Base x ^ n
 2. Base x * (Eps2 x * of_nat n * Base x ^ (n - Suc 0)) + Eps2 x * Base x ^ n = Eps2 x * ((1::'a) + of_nat n) * Base x ^ n
 3. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
show "Base x * (Eps1 x * of_nat n * Base x ^ (n - Suc 0)) + Eps1 x * Base x ^ n = Eps1 x * (1 + of_nat n) * Base x ^ n"
     and "Base x * (Eps2 x * of_nat n * Base x ^ (n - Suc 0)) + Eps2 x * Base x ^ n = Eps2 x * (1 + of_nat n) * Base x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Base x * (Eps1 x * of_nat n * Base x ^ (n - Suc 0)) + Eps1 x * Base x ^ n = Eps1 x * ((1::'a) + of_nat n) * Base x ^ n &&& Base x * (Eps2 x * of_nat n * Base x ^ (n - Suc 0)) + Eps2 x * Base x ^ n = Eps2 x * ((1::'a) + of_nat n) * Base x ^ n
[PROOF STEP]
by (simp_all add: distrib_left distrib_right power_eq_if)
[PROOF STATE]
proof (state)
this:
Base x * (Eps1 x * of_nat n * Base x ^ (n - Suc 0)) + Eps1 x * Base x ^ n = Eps1 x * ((1::'a) + of_nat n) * Base x ^ n
Base x * (Eps2 x * of_nat n * Base x ^ (n - Suc 0)) + Eps2 x * Base x ^ n = Eps2 x * ((1::'a) + of_nat n) * Base x ^ n

goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
show
      "2 * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) +
       Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) +
       Eps12 x * Base x ^ n =
       Eps12 x * (1 + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * (1 + of_nat n) * of_nat n * Base x ^ (n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
have
        "2 * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) +
         Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) +
         Eps12 x * Base x ^ n =
         2 * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) +
         Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = (2::'a) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) + Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0)
[PROOF STEP]
by (simp add: field_simps power_eq_if)
[PROOF STATE]
proof (state)
this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = (2::'a) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) + Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0)

goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = (2::'a) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) + Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0)

goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
have "... = Eps12 x * of_nat (n + 1) * Base x ^ n + of_nat (n - 1 + 2) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) + Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0) = Eps12 x * of_nat (n + 1) * Base x ^ n + of_nat (n - 1 + 2) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
by (simp add: distrib_left mult.commute)
[PROOF STATE]
proof (state)
this:
(2::'a) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0) + Eps12 x * of_nat (n + 1) * Base x ^ n + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - Suc 0) = Eps12 x * of_nat (n + 1) * Base x ^ n + of_nat (n - 1 + 2) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0)

goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * of_nat (n + 1) * Base x ^ n + of_nat (n - 1 + 2) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * of_nat (n + 1) * Base x ^ n + of_nat (n - 1 + 2) * Eps1 x * Eps2 x * of_nat n * Base x ^ (n - Suc 0)

goal (1 subgoal):
 1. (2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)
[PROOF STEP]
by (simp add: hyp.hyps)
[PROOF STATE]
proof (state)
this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(2::'a) * (Eps1 x * (Eps2 x * (of_nat n * Base x ^ (n - Suc 0)))) + Base x * (Eps12 x * of_nat n * Base x ^ (n - Suc 0) + Eps1 x * Eps2 x * of_nat n * of_nat (n - Suc 0) * Base x ^ (n - 2)) + Eps12 x * Base x ^ n = Eps12 x * ((1::'a) + of_nat n) * Base x ^ n + Eps1 x * Eps2 x * ((1::'a) + of_nat n) * of_nat n * Base x ^ (n - Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x ^ Suc n = Hyperdual (Base x ^ Suc n) (Eps1 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps2 x * of_nat (Suc n) * Base x ^ (Suc n - 1)) (Eps12 x * of_nat (Suc n) * Base x ^ (Suc n - 1) + Eps1 x * Eps2 x * of_nat (Suc n) * of_nat (Suc n - 1) * Base x ^ (Suc n - 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lfp_Fix:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'a"
  shows "mono f \<Longrightarrow> lfp f = \<Sqinter>(Fix f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> lfp f = \<Sqinter> Fix f
[PROOF STEP]
unfolding lfp_def Fix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> \<Sqinter> {u. f u \<le> u} = \<Sqinter> {x. f x = x}
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mono f \<Longrightarrow> \<Sqinter> {u. f u \<le> u} \<le> \<Sqinter> {x. f x = x}
 2. mono f \<Longrightarrow> \<Sqinter> {x. f x = x} \<le> \<Sqinter> {u. f u \<le> u}
[PROOF STEP]
apply (simp add: Collect_mono Inf_superset_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> \<Sqinter> {x. f x = x} \<le> \<Sqinter> {u. f u \<le> u}
[PROOF STEP]
by (metis (mono_tags) Inf_lower lfp_def lfp_unfold mem_Collect_eq)


[STATEMENT]
lemma "IArray.list_of (IArray.of_fun (%n. n*n) 5) = [0,1,4,9,16]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.list_of (IArray.of_fun (\<lambda>n. n * n) 5) = [0, 1, 4, 9, 16]
[PROOF STEP]
by eval


[STATEMENT]
lemma (in Ring) n_prod_idealTr:
     "(\<forall>k \<le> n. ideal R (J k)) \<longrightarrow> ideal R (ideal_n_prod R n J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>k\<le>0. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,0\<^esub> J)
 2. \<And>n. (\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J) \<Longrightarrow> (\<forall>k\<le>Suc n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,Suc n\<^esub> J)
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>k\<le>0. ideal R (J k) \<Longrightarrow> ideal R (i\<Pi>\<^bsub>R,0\<^esub> J)
 2. \<And>n. (\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J) \<Longrightarrow> (\<forall>k\<le>Suc n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,Suc n\<^esub> J)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J) \<Longrightarrow> (\<forall>k\<le>Suc n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,Suc n\<^esub> J)
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J); \<forall>k\<le>Suc n. ideal R (J k)\<rbrakk> \<Longrightarrow> ideal R (i\<Pi>\<^bsub>R,Suc n\<^esub> J)
[PROOF STEP]
apply (simp only:ideal_n_prodSn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>k\<le>n. ideal R (J k)) \<longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J); \<forall>k\<le>Suc n. ideal R (J k)\<rbrakk> \<Longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J \<diamondsuit>\<^sub>r J (Suc n))
[PROOF STEP]
apply (cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R (i\<Pi>\<^bsub>R,n\<^esub> J); \<forall>k\<le>Suc n. ideal R (J k)\<rbrakk> \<Longrightarrow> ideal R (i\<Pi>\<^bsub>R,n\<^esub> J \<diamondsuit>\<^sub>r J (Suc n))
[PROOF STEP]
apply (rule ideal_prod_ideal, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R (i\<Pi>\<^bsub>R,n\<^esub> J); \<forall>k\<le>Suc n. ideal R (J k)\<rbrakk> \<Longrightarrow> ideal R (J (Suc n))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_interval_measure_Ioc:
  assumes "a \<le> b" and "\<And>x y. x \<le> y \<Longrightarrow> F x \<le> F y" and "\<And>a. continuous (at_right a) F"
  shows "measure (interval_measure F) {a <.. b} = F b - F a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (interval_measure F) {a<..b} = F b - F a
[PROOF STEP]
unfolding measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (emeasure (interval_measure F) {a<..b}) = F b - F a
[PROOF STEP]
by (simp add: assms emeasure_interval_measure_Ioc)


[STATEMENT]
lemma nn_integral_lookup_default:
  fixes m :: "('a, real) mapping"
  assumes "finite (Mapping.keys m)" "All_mapping m (\<lambda>_ x. x \<ge> 0)"
  shows   "nn_integral (count_space UNIV) (\<lambda>k. ennreal (Mapping.lookup_default 0 m k)) =
             ennreal (\<Sum>k\<in>Mapping.keys m. Mapping.lookup_default 0 m k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
have "nn_integral (count_space UNIV) (\<lambda>k. ennreal (Mapping.lookup_default 0 m k)) =
          (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (Mapping.keys m)
All_mapping m (\<lambda>_. (\<le>) 0)

goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x))
[PROOF STEP]
by (subst nn_integral_count_space'[of "Mapping.keys m"])
       (auto simp: Mapping.lookup_default_def keys_is_none_rep Option.is_none_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (Mapping.keys m)
All_mapping m (\<lambda>_. (\<le>) 0)
[PROOF STEP]
have "\<dots> = ennreal (\<Sum>k\<in>Mapping.keys m. Mapping.lookup_default 0 m k)"
[PROOF STATE]
proof (prove)
using this:
finite (Mapping.keys m)
All_mapping m (\<lambda>_. (\<le>) 0)

goal (1 subgoal):
 1. (\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x)) = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
by (intro sum_ennreal)
       (auto simp: Mapping.lookup_default_def All_mapping_def split: option.splits)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>Mapping.keys m. ennreal (Mapping.lookup_default 0 m x)) = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))

goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))

goal (1 subgoal):
 1. \<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ k. ennreal (Mapping.lookup_default 0 m k) \<partial>count_space UNIV = ennreal (sum (Mapping.lookup_default 0 m) (Mapping.keys m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Least_eq_0_enat: "P 0 \<Longrightarrow> (LEAST x :: enat. P x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P 0 \<Longrightarrow> (LEAST x. P x) = 0
[PROOF STEP]
by (simp add: Least_equality)


[STATEMENT]
theorem ln_lower_15_eq: "0<x \<Longrightarrow>
    ln_lower_15 x = (1/280)*(35 + 9411*x + 141123*x^2 + 547235*x^3 + 718735*x^4 + 334575*x^5 + 49199*x^6 + 1487*x^7)*(x - 1) /
                    (x*(8 + 196*x + 1176*x^2 + 2450*x^3 + 1960*x^4 + 588*x^5 + 56*x^6 + x^7))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_lower_15 x = 1 / 280 * (35 + 9411 * x + 141123 * x\<^sup>2 + 547235 * x ^ 3 + 718735 * x ^ 4 + 334575 * x ^ 5 + 49199 * x ^ 6 + 1487 * x ^ 7) * (x - 1) / (x * (8 + 196 * x + 1176 * x\<^sup>2 + 2450 * x ^ 3 + 1960 * x ^ 4 + 588 * x ^ 5 + 56 * x ^ 6 + x ^ 7))
[PROOF STEP]
unfolding ln_lower_15_def ln_upper_15_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> - ((1487 + 49199 * inverse x + 547235 * inverse x ^ 4 + 718735 * inverse x ^ 3 + 334575 * (inverse x)\<^sup>2 + 141123 * inverse x ^ 5 + 35 * inverse x ^ 7 + 9411 * inverse x ^ 6) * (inverse x - 1) / (280 * (1 + 56 * inverse x + 2450 * inverse x ^ 4 + 1960 * inverse x ^ 3 + 588 * (inverse x)\<^sup>2 + 1176 * inverse x ^ 5 + 8 * inverse x ^ 7 + 196 * inverse x ^ 6))) = 1 / 280 * (35 + 9411 * x + 141123 * x\<^sup>2 + 547235 * x ^ 3 + 718735 * x ^ 4 + 334575 * x ^ 5 + 49199 * x ^ 6 + 1487 * x ^ 7) * (x - 1) / (x * (8 + 196 * x + 1176 * x\<^sup>2 + 2450 * x ^ 3 + 1960 * x ^ 4 + 588 * x ^ 5 + 56 * x ^ 6 + x ^ 7))
[PROOF STEP]
by (simp add: zero_less_mult_iff add_pos_pos dual_order.strict_implies_not_eq
              divide_simps) algebra


[STATEMENT]
lemma Poly_ntt_coeffs_mult:
"Poly (ntt_coeffs (f * g)) = Poly (map2 (*)
  (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)])
  (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly (ntt_coeffs (f * g)) = Poly (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)]))
[PROOF STEP]
apply (intro poly_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. poly.coeff (Poly (ntt_coeffs (f * g))) na = poly.coeff (Poly (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)]))) na
[PROOF STEP]
apply (unfold coeff_Poly)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. nth_default 0 (ntt_coeffs (f * g)) na = nth_default 0 (map2 (*) (map (nth_default 0 (ntt_coeffs f)) [0..<nat (int n)]) (map (nth_default 0 (ntt_coeffs g)) [0..<nat (int n)])) na
[PROOF STEP]
using nth_default_ntt_coeff_mult[of f g]
[PROOF STATE]
proof (prove)
using this:
nth_default 0 (ntt_coeffs (f * g)) ?i = nth_default 0 (map2 (*) (map (poly.coeff (Poly (ntt_coeffs f))) [0..<nat (int n)]) (map (poly.coeff (Poly (ntt_coeffs g))) [0..<nat (int n)])) ?i

goal (1 subgoal):
 1. \<And>na. nth_default 0 (ntt_coeffs (f * g)) na = nth_default 0 (map2 (*) (map (nth_default 0 (ntt_coeffs f)) [0..<nat (int n)]) (map (nth_default 0 (ntt_coeffs g)) [0..<nat (int n)])) na
[PROOF STEP]
by auto


[STATEMENT]
lemma padic_add_assoc0:
assumes "prime p"
shows  "padic_add p (padic_add p x y) z = padic_add p x (padic_add p y z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_add p (padic_add p x y) z = padic_add p x (padic_add p y z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. padic_add p (padic_add p x y) z = padic_add p x (padic_add p y z)
[PROOF STEP]
unfolding padic_add_def
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (\<lambda>n. x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> y n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> z n) = (\<lambda>n. x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> (y n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> z n))
[PROOF STEP]
by (simp add: padic_integers.residue_add_assoc padic_integers_def)


[STATEMENT]
lemma card_length_sum_set: "card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n-i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
have "card (length_sum_set (Suc r) n) = card (Sigma {..n} (\<lambda>i. length_sum_set r (n-i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = card (SIGMA i:{..n}. length_sum_set r (n - i))
[PROOF STEP]
by (metis eqpoll_finite_iff eqpoll_iff_card finite_length_sum_set length_sum_set_Suc_eqpoll)
[PROOF STATE]
proof (state)
this:
card (length_sum_set (Suc r) n) = card (SIGMA i:{..n}. length_sum_set r (n - i))

goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (length_sum_set (Suc r) n) = card (SIGMA i:{..n}. length_sum_set r (n - i))

goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. card (length_sum_set r (n-i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (SIGMA i:{..n}. length_sum_set r (n - i)) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
by (simp add: finite_length_sum_set)
[PROOF STATE]
proof (state)
this:
card (SIGMA i:{..n}. length_sum_set r (n - i)) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))

goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))

goal (1 subgoal):
 1. card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (length_sum_set (Suc r) n) = (\<Sum>i\<le>n. card (length_sum_set r (n - i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_1_singleton_conv: "(card A = Suc 0) = (\<exists>a. A = {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card A = Suc 0) = (\<exists>a. A = {a})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. card A = Suc 0 \<Longrightarrow> \<exists>a. A = {a}
 2. \<exists>a. A = {a} \<Longrightarrow> card A = Suc 0
[PROOF STEP]
apply (simp add: card_1_imp_singleton)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. A = {a} \<Longrightarrow> card A = Suc 0
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hnorm_mult_ineq: "\<And>x y::'a::real_normed_algebra star. hnorm (x * y) \<le> hnorm x * hnorm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. hnorm (x * y) \<le> hnorm x * hnorm y
[PROOF STEP]
by transfer (rule norm_mult_ineq)


[STATEMENT]
lemma Complex_gcard: "gcard (UNIV::complex set) = C_continuum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard UNIV = C_continuum
[PROOF STEP]
by (metis Complex_vcard V_of_Complex_set bij_betw_def gcard_eq_vcard gcard_image)


[STATEMENT]
lemma norm_rotate_eq[simp]:
  fixes x :: "'a:: {banach,real_normed_field}"
  shows "(x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2"
    and "(x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2 &&& (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
 2. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
have "(x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - 2 * (x * cos t) * (y * sin t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - (2::'a) * (x * cos t) * (y * sin t)
[PROOF STEP]
by(simp add: power2_diff power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - (2::'a) * (x * cos t) * (y * sin t)

goal (2 subgoals):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
 2. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - (2::'a) * (x * cos t) * (y * sin t)

goal (2 subgoals):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
 2. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
have "(x * sin t + y * cos t)\<^sup>2 = y\<^sup>2 * (cos t)\<^sup>2 + x\<^sup>2 * (sin t)\<^sup>2 + 2 * (x * cos t) * (y * sin t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * sin t + y * cos t)\<^sup>2 = y\<^sup>2 * (cos t)\<^sup>2 + x\<^sup>2 * (sin t)\<^sup>2 + (2::'a) * (x * cos t) * (y * sin t)
[PROOF STEP]
by(simp add: power2_sum power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(x * sin t + y * cos t)\<^sup>2 = y\<^sup>2 * (cos t)\<^sup>2 + x\<^sup>2 * (sin t)\<^sup>2 + (2::'a) * (x * cos t) * (y * sin t)

goal (2 subgoals):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
 2. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - (2::'a) * (x * cos t) * (y * sin t)
(x * sin t + y * cos t)\<^sup>2 = y\<^sup>2 * (cos t)\<^sup>2 + x\<^sup>2 * (sin t)\<^sup>2 + (2::'a) * (x * cos t) * (y * sin t)
[PROOF STEP]
show "(x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(x * cos t - y * sin t)\<^sup>2 = x\<^sup>2 * (cos t)\<^sup>2 + y\<^sup>2 * (sin t)\<^sup>2 - (2::'a) * (x * cos t) * (y * sin t)
(x * sin t + y * cos t)\<^sup>2 = y\<^sup>2 * (cos t)\<^sup>2 + x\<^sup>2 * (sin t)\<^sup>2 + (2::'a) * (x * cos t) * (y * sin t)

goal (1 subgoal):
 1. (x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
by (simp add: Groups.mult_ac(2) Groups.mult_ac(3) right_diff_distrib sin_squared_eq)
[PROOF STATE]
proof (state)
this:
(x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2

goal (1 subgoal):
 1. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
thus "(x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(x * cos t - y * sin t)\<^sup>2 + (x * sin t + y * cos t)\<^sup>2 = x\<^sup>2 + y\<^sup>2

goal (1 subgoal):
 1. (x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2
[PROOF STEP]
by (simp add: add.commute add.left_commute power2_diff power2_sum)
[PROOF STATE]
proof (state)
this:
(x * cos t + y * sin t)\<^sup>2 + (y * cos t - x * sin t)\<^sup>2 = x\<^sup>2 + y\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in strategic_space_2p) U\<^sub>A_times_U\<^sub>A_cnj:
  shows "U\<^sub>A * (U\<^sub>A\<^sup>\<dagger>) = 1\<^sub>m 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger> = 1\<^sub>m 2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
assume a0:"i < dim_row (1\<^sub>m 2)" and a1:"j < dim_col (1\<^sub>m 2)"
[PROOF STATE]
proof (state)
this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)
[PROOF STEP]
show "(U\<^sub>A * (U\<^sub>A\<^sup>\<dagger>)) $$ (i,j) = 1\<^sub>m 2 $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
have "i\<in>{0,1} \<and> j\<in>{0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> {0, 1} \<and> j \<in> {0, 1}
[PROOF STEP]
using a0 a1 mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. i \<in> {0, 1} \<and> j \<in> {0, 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<in> {0, 1} \<and> j \<in> {0, 1}

goal (1 subgoal):
 1. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<in> {0, 1} \<and> j \<in> {0, 1}

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
using mat_of_cols_list_def cos_sin_squared_add_cpx hermite_cnj_of_U\<^sub>A exp_sin_cos_squared_add[of "\<phi>\<^sub>A" "\<theta>\<^sub>A / 2"]
[PROOF STATE]
proof (prove)
using this:
i \<in> {0, 1} \<and> j \<in> {0, 1}
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)
complex_of_real (cos (?\<gamma> / 2)) * complex_of_real (cos (?\<gamma> / 2)) - \<i> * complex_of_real (sin (?\<gamma> / 2)) * (\<i> * complex_of_real (sin (?\<gamma> / 2))) = 1
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger> = Tensor.mat_of_cols_list 2 [exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [sin (\<theta>\<^sub>A / 2)], [complex_of_real (- sin (\<theta>\<^sub>A / 2)), exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]
exp (- (\<i> * complex_of_real \<phi>\<^sub>A)) * complex_of_real (cos (\<theta>\<^sub>A / 2)) * (exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))) + complex_of_real (sin (\<theta>\<^sub>A / 2) * sin (\<theta>\<^sub>A / 2)) = 1

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
by (auto simp add: set_2 algebra_simps)
[PROOF STATE]
proof (state)
this:
(Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)

goal (2 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
 2. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
 2. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
show "dim_row (U\<^sub>A * (U\<^sub>A\<^sup>\<dagger>)) = dim_row (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_row (1\<^sub>m 2)

goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
show "dim_col (U\<^sub>A * (U\<^sub>A\<^sup>\<dagger>)) = dim_col (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]\<^sup>\<dagger>) = dim_col (1\<^sub>m 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homologous_rel_add:
   "\<lbrakk>homologous_rel p X S a a'; homologous_rel p X S b b'\<rbrakk>
        \<Longrightarrow> homologous_rel p X S (a+b) (a'+b')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>homologous_rel p X S a a'; homologous_rel p X S b b'\<rbrakk> \<Longrightarrow> homologous_rel p X S (a + b) (a' + b')
[PROOF STEP]
unfolding homologous_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_relboundary p X S (a - a'); singular_relboundary p X S (b - b')\<rbrakk> \<Longrightarrow> singular_relboundary p X S (a + b - (a' + b'))
[PROOF STEP]
by (simp add: add_diff_add singular_relboundary_add)


[STATEMENT]
lemma gbinomial_mult_1':
  "(a gchoose k) * a = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose (Suc k))"
  for a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose k) * a = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)
[PROOF STEP]
by (simp add: mult.commute gbinomial_mult_1)


[STATEMENT]
lemma eval_fps_add:
  fixes f g :: "'a :: {banach, real_normed_div_algebra} fps"
  assumes "norm z < fps_conv_radius f" "norm z < fps_conv_radius g"
  shows   "eval_fps (f + g) z = eval_fps f z + eval_fps g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (f + g) z = eval_fps f z + eval_fps g z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f
ereal (norm z) < fps_conv_radius g

goal (1 subgoal):
 1. eval_fps (f + g) z = eval_fps f z + eval_fps g z
[PROOF STEP]
unfolding eval_fps_def
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f
ereal (norm z) < fps_conv_radius g

goal (1 subgoal):
 1. (\<Sum>n. fps_nth (f + g) n * z ^ n) = (\<Sum>n. fps_nth f n * z ^ n) + (\<Sum>n. fps_nth g n * z ^ n)
[PROOF STEP]
by (subst suminf_add) (auto simp: ring_distribs intro!: summable_fps)


[STATEMENT]
lemma similar_implies_exist_matrix':
  fixes A B::"'a::{field}^'n^'n"
  assumes similar: "similar_matrices A B"
  shows "\<exists>X Y f. linear ((*s)) ((*s)) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B
    \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
obtain P where inv_P: "invertible P" and B_PAP: "B=(matrix_inv P)**A**P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. \<lbrakk>invertible P; B = matrix_inv P ** A ** P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using similar
[PROOF STATE]
proof (prove)
using this:
similar_matrices A B

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>invertible P; B = matrix_inv P ** A ** P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding similar_matrices_def
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> B = matrix_inv P ** A ** P

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>invertible P; B = matrix_inv P ** A ** P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invertible P
B = matrix_inv P ** A ** P

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
obtain X::"'a^'n^'n" where X: "is_basis (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. is_basis (set_of_vector X) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_basis
[PROOF STATE]
proof (prove)
using this:
\<exists>X. is_basis (set_of_vector X)

goal (1 subgoal):
 1. (\<And>X. is_basis (set_of_vector X) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector X)

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
obtain f where linear_f: "linear ((*s)) ((*s)) f" and A: "matrix' X X f = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>linear (*s) (*s) f; matrix' X X f = A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_linear_eq_matrix'[OF X X]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. matrix' X X f = ?A \<and> linear (*s) (*s) f

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>linear (*s) (*s) f; matrix' X X f = A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear (*s) (*s) f
matrix' X X f = A

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
obtain Y::"'a^'n^'n" where Y: "is_basis (set_of_vector Y)" and P: "P = matrix_change_of_basis Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using invertible_matrix_is_change_of_basis[OF inv_P X]
[PROOF STATE]
proof (prove)
using this:
\<exists>!Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector Y)
P = matrix_change_of_basis Y X

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
have P': "matrix_inv P = matrix_change_of_basis X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv P = matrix_change_of_basis X Y
[PROOF STEP]
by (metis (lifting) P X Y matrix_inv_matrix_change_of_basis)
[PROOF STATE]
proof (state)
this:
matrix_inv P = matrix_change_of_basis X Y

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
have "B = (matrix_inv P)**A**P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = matrix_inv P ** A ** P
[PROOF STEP]
using B_PAP
[PROOF STATE]
proof (prove)
using this:
B = matrix_inv P ** A ** P

goal (1 subgoal):
 1. B = matrix_inv P ** A ** P
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B = matrix_inv P ** A ** P

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B = matrix_inv P ** A ** P

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
have "... =  matrix_change_of_basis X Y ** matrix' X X f ** P "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv P ** A ** P = matrix_change_of_basis X Y ** matrix' X X f ** P
[PROOF STEP]
unfolding P' A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis X Y ** A ** P = matrix_change_of_basis X Y ** A ** P
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_inv P ** A ** P = matrix_change_of_basis X Y ** matrix' X X f ** P

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_inv P ** A ** P = matrix_change_of_basis X Y ** matrix' X X f ** P

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
have "... = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis X Y ** matrix' X X f ** P = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X
[PROOF STEP]
unfolding P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis X Y ** matrix' X X f ** P = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis X Y ** matrix' X X f ** P = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
have "... = matrix' Y Y f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X = matrix' Y Y f
[PROOF STEP]
using matrix'_matrix_change_of_basis[OF X Y X Y linear_f]
[PROOF STATE]
proof (prove)
using this:
matrix' Y Y f = matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X

goal (1 subgoal):
 1. matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X = matrix' Y Y f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis X Y ** matrix' X X f ** matrix_change_of_basis Y X = matrix' Y Y f

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B = matrix' Y Y f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B = matrix' Y Y f

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
using X Y A linear_f
[PROOF STATE]
proof (prove)
using this:
B = matrix' Y Y f
is_basis (set_of_vector X)
is_basis (set_of_vector Y)
matrix' X X f = A
linear (*s) (*s) f

goal (1 subgoal):
 1. \<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>X Y f. linear (*s) (*s) f \<and> matrix' X X f = A \<and> matrix' Y Y f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powa_le_cancel:
   "\<lbrakk> a powa r \<le> a powa s; a > 1 \<rbrakk> \<Longrightarrow> r \<le> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a powa r \<le> a powa s; 1 < a\<rbrakk> \<Longrightarrow> r \<le> s
[PROOF STEP]
by (metis not_le powa_less_mono)


[STATEMENT]
lemma not_disj_deMorgans: "(\<not> ((P::'\<alpha> predicate) \<or> Q)) = ((\<not> P) \<and> (\<not> Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (P \<or> Q)) = (\<not> P \<and> \<not> Q)
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma sum_drop_zero: "(\<Sum>k = 0..Suc n. if 0<k then (f (k - 1)) else 0) = (\<Sum>j = 0..n. f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..Suc n. if 0 < k then f (k - 1) else (0::'a)) = sum f {0..n}
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma inverse_le_iff_le_neg [simp]:
  "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < (0::'a); b < (0::'a)\<rbrakk> \<Longrightarrow> (inverse a \<le> inverse b) = (b \<le> a)
[PROOF STEP]
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg)


[STATEMENT]
lemma filterlim_tendsto_neg_mult_at_top_iff:
  fixes f::"'a \<Rightarrow> real"
  assumes "(f \<longlongrightarrow> c) F" and "c < 0"
  shows "(LIM x F. (f x * g x) :> at_top) \<longleftrightarrow> (LIM x F. g x :> at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
have "(LIM x F. f x * g x :> at_top) = (LIM x F. - g x :> at_top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = (LIM x F. - g x :> at_top)
[PROOF STEP]
apply (rule filterlim_tendsto_pos_mult_at_top_iff[of "\<lambda>x. - f x" "-c" F "\<lambda>x. - g x", simplified])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. - f x) \<longlongrightarrow> - c) F
 2. c < 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> c) F
c < 0

goal (2 subgoals):
 1. ((\<lambda>x. - f x) \<longlongrightarrow> - c) F
 2. c < 0
[PROOF STEP]
by (auto intro: tendsto_intros )
[PROOF STATE]
proof (state)
this:
(LIM x F. f x * g x :> at_top) = (LIM x F. - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LIM x F. f x * g x :> at_top) = (LIM x F. - g x :> at_top)

goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
have "... = (LIM x F. g x :> at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. - g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
using filterlim_uminus_at_bot[symmetric]
[PROOF STATE]
proof (prove)
using this:
(LIM x ?F. - ?f x :> at_top) = filterlim ?f at_bot ?F

goal (1 subgoal):
 1. (LIM x F. - g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LIM x F. - g x :> at_top) = filterlim g at_bot F

goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(LIM x F. f x * g x :> at_top) = filterlim g at_bot F

goal (1 subgoal):
 1. (LIM x F. f x * g x :> at_top) = filterlim g at_bot F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(LIM x F. f x * g x :> at_top) = filterlim g at_bot F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma biexp01_well_formedE:
  assumes "biexp01_well_formed a"
  shows "(\<forall>n. a n \<in> {0,1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
biexp01_well_formed a

goal (1 subgoal):
 1. (\<forall>n. a n \<in> {0, 1}) \<and> (\<forall>n. \<exists>m\<ge>n. a m = 0)
[PROOF STEP]
by(simp add: biexp01_well_formed_def)


[STATEMENT]
lemma (in -) INF_absorb_args: "(\<Sqinter>i j. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j)) = (\<Sqinter>k. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) = \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
proof (rule order_class.order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
 2. \<Sqinter> range f \<le> (\<Sqinter>(i::nat) j::nat. f (i + j))
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
show "(\<Sqinter>k. f k) \<le> (\<Sqinter>i j. f (i + j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> range f \<le> (\<Sqinter>(i::nat) j::nat. f (i + j))
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
by (simp add: complete_lattice_class.INF_lower complete_lattice_class.le_INF_iff)
[PROOF STATE]
proof (state)
this:
\<Sqinter> range (f::nat \<Rightarrow> 'c::complete_lattice) \<le> (\<Sqinter>(i::nat) j::nat. f (i + j))

goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
have "\<And>k. \<exists>i j. f (i + j) \<le> f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k::nat. \<exists>(i::nat) j::nat. f (i + j) \<le> f k
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
by (metis Nat.add_0_right order_refl)
[PROOF STATE]
proof (state)
this:
\<exists>(i::nat) j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j) \<le> f (?k::nat)

goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>(i::nat) j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j) \<le> f (?k::nat)
[PROOF STEP]
have "\<And>k. \<exists>i. (\<Sqinter>j. f (i + j)) \<le> f k"
[PROOF STATE]
proof (prove)
using this:
\<exists>(i::nat) j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j) \<le> f (?k::nat)

goal (1 subgoal):
 1. \<And>k::nat. \<exists>i::nat. (\<Sqinter>j::nat. f (i + j)) \<le> f k
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
by (meson UNIV_I complete_lattice_class.INF_lower2)
[PROOF STATE]
proof (state)
this:
\<exists>i::nat. (\<Sqinter>j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j)) \<le> f (?k::nat)

goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i::nat. (\<Sqinter>j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j)) \<le> f (?k::nat)
[PROOF STEP]
show "(\<Sqinter>i j. f (i + j)) \<le> (\<Sqinter>k. f k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>i::nat. (\<Sqinter>j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j)) \<le> f (?k::nat)

goal (1 subgoal):
 1. (\<Sqinter>(i::nat) j::nat. f (i + j)) \<le> \<Sqinter> range f
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
by (simp add: complete_lattice_class.INF_mono)
[PROOF STATE]
proof (state)
this:
(\<Sqinter>(i::nat) j::nat. (f::nat \<Rightarrow> 'c::complete_lattice) (i + j)) \<le> \<Sqinter> range f

goal:
No subgoals!
variables:
f :: nat \<Rightarrow> 'c
type variables:
'c :: complete_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma sqr_geq_nat :
  shows "(n::nat) \<le> n\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> n\<^sup>2
[PROOF STEP]
using power2_nat_le_imp_le
[PROOF STATE]
proof (prove)
using this:
?m\<^sup>2 \<le> ?n \<Longrightarrow> ?m \<le> ?n

goal (1 subgoal):
 1. n \<le> n\<^sup>2
[PROOF STEP]
by simp


[STATEMENT]
lemma interleavings_length:
  assumes "interleavings xs ys zs"
  shows "length xs + length ys = length zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs + length ys = length zs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
interleavings xs ys zs

goal (1 subgoal):
 1. length xs + length ys = length zs
[PROOF STEP]
by (induct xs ys zs rule: interleavings.induct) auto


[STATEMENT]
lemma pm_of_poly_minus: "pm_of_poly x (p - q) = pm_of_poly x p - pm_of_poly x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pm_of_poly x (p - q) = pm_of_poly x p - pm_of_poly x q
[PROOF STEP]
by (rule poly_mapping_eqI) (simp add: pm_of_poly.rep_eq lookup_minus when_diff_distrib)


[STATEMENT]
lemma fourpow_gt_central_binomial:
  assumes "n > 0"
  shows   "4 ^ n > ((2 * n) choose n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
have "(\<Sum>i\<in>{..2*n}-{n}. ((2 * n) choose i)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sum ((choose) (2 * n)) ({..2 * n} - {n})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. 0 < sum ((choose) (2 * n)) ({..2 * n} - {n})
[PROOF STEP]
by (intro sum_pos) (auto simp: subset_iff)
[PROOF STATE]
proof (state)
this:
0 < sum ((choose) (2 * n)) ({..2 * n} - {n})

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
hence "((2 * n) choose n) < (\<Sum>i\<in>{..2*n}-{n}. ((2 * n) choose i)) + ((2 * n) choose n)"
[PROOF STATE]
proof (prove)
using this:
0 < sum ((choose) (2 * n)) ({..2 * n} - {n})

goal (1 subgoal):
 1. 2 * n choose n < sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * n choose n < sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n)

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * n choose n < sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n)

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
have "\<dots> = (\<Sum>i \<in> insert n ({..2*n} - {n}). ((2 * n) choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n) = sum ((choose) (2 * n)) (insert n ({..2 * n} - {n}))
[PROOF STEP]
by (subst sum.insert) auto
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n) = sum ((choose) (2 * n)) (insert n ({..2 * n} - {n}))

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * n)) ({..2 * n} - {n}) + (2 * n choose n) = sum ((choose) (2 * n)) (insert n ({..2 * n} - {n}))

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
have "insert n ({..2*n} - {n}) = {..2*n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert n ({..2 * n} - {n}) = {..2 * n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert n ({..2 * n} - {n}) = {..2 * n}

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insert n ({..2 * n} - {n}) = {..2 * n}

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
have "(\<Sum>i\<le>2*n. ((2 * n) choose i)) = (1 + 1) ^ (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * n)) {..2 * n} = (1 + 1) ^ (2 * n)
[PROOF STEP]
by (subst binomial) simp_all
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * n)) {..2 * n} = (1 + 1) ^ (2 * n)

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * n)) {..2 * n} = (1 + 1) ^ (2 * n)

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
have "\<dots> = 4 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + 1) ^ (2 * n) = 4 ^ n
[PROOF STEP]
by (subst power_mult) (simp add: eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
(1 + 1) ^ (2 * n) = 4 ^ n

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * n choose n < 4 ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * n choose n < 4 ^ n

goal (1 subgoal):
 1. 2 * n choose n < 4 ^ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 * n choose n < 4 ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arsinh_sinh_real: "arsinh (sinh x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arsinh (sinh x) = x
[PROOF STEP]
by (simp add: arsinh_real_def powr_def sinh_square_eq sinh_plus_cosh)


[STATEMENT]
lemma numeral_5_eq_5: "5 = Suc(Suc( Suc (Suc (Suc 0))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 = Suc (Suc (Suc (Suc (Suc 0))))
[PROOF STEP]
by (simp add: eval_nat_numeral)


[STATEMENT]
lemma homeomorphic_space_imp_isomorphic_homology_groups:
   "X homeomorphic_space Y \<Longrightarrow> homology_group p X \<cong> homology_group p Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X homeomorphic_space Y \<Longrightarrow> homology_group p X \<cong> homology_group p Y
[PROOF STEP]
by (simp add: homeomorphic_imp_homotopy_equivalent_space homotopy_equivalent_space_imp_isomorphic_homology_groups)


[STATEMENT]
lemma set_integral_reflect:
  fixes S and f :: "real \<Rightarrow> 'a :: {banach, second_countable_topology}"
  shows "(LBINT x : S. f x) = (LBINT x : {x. - x \<in> S}. f (- x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral lborel S f = LBINT x:{x. - x \<in> S}. f (- x)
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x. indicat_real S x *\<^sub>R f x = LBINT x. indicat_real {x. - x \<in> S} x *\<^sub>R f (- x)
[PROOF STEP]
by (subst lborel_integral_real_affine[where c="-1" and t=0])
     (auto intro!: Bochner_Integration.integral_cong split: split_indicator)


[STATEMENT]
lemma ccos_add:
  "ccos (x + y) = ccos x * ccos y - csin x * csin y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (cos (x + y)) = complex_of_real (cos x) * complex_of_real (cos y) - complex_of_real (sin x) * complex_of_real (sin y)
[PROOF STEP]
using cos_add[of x y]
[PROOF STATE]
proof (prove)
using this:
cos (x + y) = cos x * cos y - sin x * sin y

goal (1 subgoal):
 1. complex_of_real (cos (x + y)) = complex_of_real (cos x) * complex_of_real (cos y) - complex_of_real (sin x) * complex_of_real (sin y)
[PROOF STEP]
by simp


[STATEMENT]
lemma continuous_map_closure_preimage_subset:
   "continuous_map X Y f
        \<Longrightarrow> X closure_of {x \<in> topspace X. f x \<in> T}
            \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y f \<Longrightarrow> X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}
[PROOF STEP]
unfolding continuous_map_closedin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. f x \<in> topspace Y) \<and> (\<forall>C. closedin Y C \<longrightarrow> closedin X {x \<in> topspace X. f x \<in> C}) \<Longrightarrow> X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}
[PROOF STEP]
by (rule closure_of_minimal) (use in_closure_of in \<open>fastforce+\<close>)


[STATEMENT]
lemma card_surjective_functions_domain_and_range_permutation:
  assumes "finite A" "finite B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
have "bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
by (rule bij_betw_number_partition_of)
[PROOF STATE]
proof (state)
this:
bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
have "card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = card {N. number_partition (card A) N \<and> size N = card B}"
[PROOF STATE]
proof (prove)
using this:
bij_betw (number_partition_of A B) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) {N. number_partition (card A) N \<and> size N = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = card {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = card {N. number_partition (card A) N \<and> size N = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = card {N. number_partition (card A) N \<and> size N = card B}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
have "card {N. number_partition (card A) N \<and> size N = card B} = Partition (card A) (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {N. number_partition (card A) N \<and> size N = card B} = Partition (card A) (card B)
[PROOF STEP]
by (rule card_partitions_with_k_parts)
[PROOF STATE]
proof (state)
this:
card {N. number_partition (card A) N \<and> size N = card B} = Partition (card A) (card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B) = Partition (card A) (card B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem perron_frobenius_non_neg: fixes A :: "real ^ 'n ^ 'n"
  assumes pos: "non_neg_mat A"
  shows "\<exists> sr ks f.
    sr \<ge> 0 \<and>
    0 \<notin> set ks \<and> ks \<noteq> [] \<and>
    charpoly A = prod_list (map (\<lambda> k. monom 1 k - [:sr ^ k:]) ks) * f \<and>
    (\<forall> x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> charpoly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
using pos
[PROOF STATE]
proof (prove)
using this:
non_neg_mat A

goal (1 subgoal):
 1. \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> charpoly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
proof (transfer, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat CARD('n) CARD('n); nonneg_mat A\<rbrakk> \<Longrightarrow> \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
case (1 A)
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat CARD('n) CARD('n)
nonneg_mat A

goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> carrier_mat CARD('n) CARD('n); nonneg_mat A\<rbrakk> \<Longrightarrow> \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
from perron_frobenius_nonneg[OF 1]
[PROOF STATE]
proof (chain)
picking this:
CARD('n) \<noteq> 0 \<Longrightarrow> \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
CARD('n) \<noteq> 0 \<Longrightarrow> \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)

goal (1 subgoal):
 1. \<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>sr ks f. 0 \<le> sr \<and> 0 \<notin> set ks \<and> ks \<noteq> [] \<and> char_poly A = (\<Prod>k\<leftarrow>ks. monom 1 k - [:sr ^ k:]) * f \<and> (\<forall>x. poly (map_poly complex_of_real f) x = 0 \<longrightarrow> cmod x < sr)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) trivial_group_subgroup_generated_eq:
  "trivial_group(subgroup_generated G s) \<longleftrightarrow> carrier G \<inter> s \<subseteq> {one G}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial_group (subgroup_generated G s) = (carrier G \<inter> s \<subseteq> {\<one>})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. trivial_group (subgroup_generated G s) \<Longrightarrow> carrier G \<inter> s \<subseteq> {\<one>}
 2. carrier G \<inter> s \<subseteq> {\<one>} \<Longrightarrow> trivial_group (subgroup_generated G s)
[PROOF STEP]
apply (force simp: trivial_group_def carrier_subgroup_generated generate.incl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G \<inter> s \<subseteq> {\<one>} \<Longrightarrow> trivial_group (subgroup_generated G s)
[PROOF STEP]
by (metis subgroup_generated_restrict trivial_group_subgroup_generated)


[STATEMENT]
theorem dual_inf [iff?]:
    "is_inf (dual x) (dual y) (dual sup) = is_sup x y sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_inf (dual x) (dual y) (dual sup) = is_sup x y sup
[PROOF STEP]
by (simp add: is_inf_def is_sup_def dual_all [symmetric] dual_leq)


[STATEMENT]
lemma gcd_right_idem: "gcd (gcd a b) b = gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (gcd a b) b = gcd a b
[PROOF STEP]
by (fact gcd.right_idem)


[STATEMENT]
lemma index_zero_mat[simp]: "i < nr \<Longrightarrow> j < nc \<Longrightarrow> 0\<^sub>m nr nc $$ (i,j) = 0"
  "dim_row (0\<^sub>m nr nc) = nr" "dim_col (0\<^sub>m nr nc) = nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < nr; j < nc\<rbrakk> \<Longrightarrow> 0\<^sub>m nr nc $$ (i, j) = (0::'a)) &&& dim_row (0\<^sub>m nr nc) = nr &&& dim_col (0\<^sub>m nr nc) = nc
[PROOF STEP]
unfolding zero_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < nr; j < nc\<rbrakk> \<Longrightarrow> mat nr nc (\<lambda>ij. 0::'a) $$ (i, j) = (0::'a)) &&& dim_row (mat nr nc (\<lambda>ij. 0::'b)) = nr &&& dim_col (mat nr nc (\<lambda>ij. 0::'c)) = nc
[PROOF STEP]
by auto