[STATEMENT]
lemma sum_every_even_summand_is_zero:
  fixes n:: nat
  assumes "n \<ge> 1"
  shows "\<forall>f::(nat \<Rightarrow> complex).(\<forall>i. i<2^(n+1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow>
            (\<Sum>k\<in>{0..<2^(n+1)}. f k) = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))
[PROOF STEP]
proof(rule nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>f. (\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
 2. \<And>n. \<lbrakk>1 \<le> n; \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))\<rbrakk> \<Longrightarrow> \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
show "\<forall>f::(nat \<Rightarrow> complex).(\<forall>i. i<2^(1+1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow>
            (\<Sum>k\<in>{0..<2^(1+1)}. f k) = (\<Sum>k\<in>{0..< 2^1}. f (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
proof(rule allI,rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
fix f:: "nat \<Rightarrow>complex"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
assume asm: "(\<forall>i. i<2^(1+1) \<and> even i \<longrightarrow> f i = 0)"
[PROOF STATE]
proof (state)
this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
have "(\<Sum>k\<in>{0..<4}. f k) = f 0 + f 1 + f 2 + f 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<4} = f 0 + f 1 + f 2 + f 3
[PROOF STEP]
by (simp add: add.commute add.left_commute)
[PROOF STATE]
proof (state)
this:
sum f {0..<4} = f 0 + f 1 + f 2 + f 3

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum f {0..<4} = f 0 + f 1 + f 2 + f 3

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
have "f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0

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

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f 0 = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
have "f 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 2 = 0
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0

goal (1 subgoal):
 1. f 2 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f 2 = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f 2 = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
have "(\<Sum>k \<in> {0..< 2^1}. f (2*k+1)) = f 1 + f 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1)) = f 1 + f 3
[PROOF STEP]
using add.commute add.left_commute
[PROOF STATE]
proof (prove)
using this:
?a + ?b = ?b + ?a
?b + (?a + ?c) = ?a + (?b + ?c)

goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1)) = f 1 + f 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ 1. f (2 * k + 1)) = f 1 + f 3

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0
sum f {0..<4} = f 0 + f 1 + f 2 + f 3
f 0 = 0
f 2 = 0
(\<Sum>k = 0..<2 ^ 1. f (2 * k + 1)) = f 1 + f 3
[PROOF STEP]
show "(\<Sum>k\<in>{0..<2^(1+1)}. f k) = (\<Sum>k\<in>{0..< 2^1}. f (2*k+1))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0
sum f {0..<4} = f 0 + f 1 + f 2 + f 3
f 0 = 0
f 2 = 0
(\<Sum>k = 0..<2 ^ 1. f (2 * k + 1)) = f 1 + f 3

goal (1 subgoal):
 1. sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>f. (\<forall>i. i < 2 ^ (1 + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (1 + 1)} = (\<Sum>k = 0..<2 ^ 1. f (2 * k + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))\<rbrakk> \<Longrightarrow> \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))\<rbrakk> \<Longrightarrow> \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
fix n:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))\<rbrakk> \<Longrightarrow> \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
assume "n \<ge> 1"
  and IH: "\<forall>f::(nat \<Rightarrow>complex).(\<forall>i. i<2^(n+1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow>
(\<Sum>k\<in>{0..<2^(n+1)}. f k) = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1))"
[PROOF STATE]
proof (state)
this:
1 \<le> n
\<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))\<rbrakk> \<Longrightarrow> \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
show "\<forall>f::(nat \<Rightarrow>complex).(\<forall>i. i<2^((Suc n)+1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow>
(\<Sum>k\<in>{0..<2^((Suc n)+1)}. f k) = (\<Sum>k\<in>{0..< 2^(Suc n)}. f (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
proof (rule allI,rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
fix f::"nat \<Rightarrow>complex"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
assume asm: "(\<forall>i. i<2^((Suc n)+1) \<and> even i \<longrightarrow> f i = 0)"
[PROOF STATE]
proof (state)
this:
\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have f0: "(\<Sum>k \<in>{0..<2^(n+1)}. f k) = (\<Sum>k \<in> {0..< 2^n}. f (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))
[PROOF STEP]
using asm IH
[PROOF STATE]
proof (prove)
using this:
\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0
\<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))

goal (1 subgoal):
 1. sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have f1: "(\<Sum>k\<in>{0..<2^(n+1)}. (\<lambda>x. f (x+2^(n+1))) k)
              = (\<Sum>k\<in>{0..< 2^n}. (\<lambda>x. f (x+2^(n+1))) (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))
[PROOF STEP]
using asm IH
[PROOF STATE]
proof (prove)
using this:
\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0
\<forall>f. (\<forall>i. i < 2 ^ (n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))

goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "(\<Sum>k\<in>{0..<2^(n+2)}. f k)
               = (\<Sum>k\<in>{0..<2^(n+1)}. f k) + (\<Sum>k\<in>{2^(n+1)..<2^(n+2)}. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<2 ^ (n + 2)} = sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}
[PROOF STEP]
by (simp add: sum.atLeastLessThan_concat)
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (n + 2)} = sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (n + 2)} = sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1)) + (\<Sum>k\<in>{2^(n+1)..<2^(n+2)}. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}
[PROOF STEP]
using f0
[PROOF STATE]
proof (prove)
using this:
sum f {0..<2 ^ (n + 1)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1))

goal (1 subgoal):
 1. sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (n + 1)} + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)}

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1)) + (\<Sum>k\<in>{0..<2^(n+1)}. f (k+(2^(n+1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1)))
[PROOF STEP]
using sum.shift_bounds_nat_ivl[of "f" "0" "2^(n+1)" "2^(n+1)"]
[PROOF STATE]
proof (prove)
using this:
sum f {0 + 2 ^ (n + 1)..<2 ^ (n + 1) + 2 ^ (n + 1)} = (\<Sum>i = 0..<2 ^ (n + 1). f (i + 2 ^ (n + 1)))

goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1)))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + sum f {2 ^ (n + 1)..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1)))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1)) + (\<Sum>k\<in>{0..< 2^n}. (\<lambda>x. f (x+2^(n+1))) (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))

goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ (n + 1). f (k + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1)))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..< 2^n}. f (2*k+1)) + (\<Sum>k\<in>{2^n..< 2^(n+1)}. f (2 *k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1))
[PROOF STEP]
using sum.shift_bounds_nat_ivl[of "\<lambda>x. (f::nat\<Rightarrow>complex) (2*(x-2^n)+1+2^(n+1))" "0" "2^n" "2^n"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x = 0 + 2 ^ n..<2 ^ n + 2 ^ n. f (2 * (x - 2 ^ n) + 1 + 2 ^ (n + 1))) = (\<Sum>i = 0..<2 ^ n. f (2 * (i + 2 ^ n - 2 ^ n) + 1 + 2 ^ (n + 1)))

goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1))
[PROOF STEP]
by (simp add: mult_2)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 0..<2 ^ n. f (2 * k + 1 + 2 ^ (n + 1))) = (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..< 2^(n+1)}. f (2*k+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1)) = (\<Sum>k = 0..<2 ^ (n + 1). f (2 * k + 1))
[PROOF STEP]
by (metis Suc_eq_plus1 lessI less_imp_le_nat one_le_numeral power_increasing sum.atLeastLessThan_concat zero_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<2 ^ n. f (2 * k + 1)) + (\<Sum>k = 2 ^ n..<2 ^ (n + 1). f (2 * k + 1)) = (\<Sum>k = 0..<2 ^ (n + 1). f (2 * k + 1))

goal (1 subgoal):
 1. \<And>f. \<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0 \<Longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {0..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ (n + 1). f (2 * k + 1))
[PROOF STEP]
show "(\<Sum>k\<in>{0..<2^((Suc n)+1)}. f k) = (\<Sum>k\<in>{0..< 2^(Suc n)}. f (2*k+1))"
[PROOF STATE]
proof (prove)
using this:
sum f {0..<2 ^ (n + 2)} = (\<Sum>k = 0..<2 ^ (n + 1). f (2 * k + 1))

goal (1 subgoal):
 1. sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))
[PROOF STEP]
by (metis Suc_eq_plus1 add_2_eq_Suc')
[PROOF STATE]
proof (state)
this:
sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>f. (\<forall>i. i < 2 ^ (Suc n + 1) \<and> even i \<longrightarrow> f i = 0) \<longrightarrow> sum f {0..<2 ^ (Suc n + 1)} = (\<Sum>k = 0..<2 ^ Suc n. f (2 * k + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_enat_eSuc[simp]: "\<Sqinter> (eSuc ` A) = eSuc (\<Sqinter> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> (eSuc ` A) = eSuc (\<Sqinter> A)
[PROOF STEP]
unfolding Inf_enat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if eSuc ` A = {} then \<infinity> else least (eSuc ` A)) = eSuc (if A = {} then \<infinity> else least A)
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_segment_real_eq:
  fixes u::real shows "closed_segment u v = (\<lambda>x. (v - u) * x + u) ` {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment u v = (\<lambda>x. (v - u) * x + u) ` {0..1}
[PROOF STEP]
by (simp add: add.commute [of u] image_affinity_atLeastAtMost [where c=u] closed_segment_eq_real_ivl)


[STATEMENT]
lemma function_of_enum:
  assumes "bij_betw enum {0..<card A} A"
  assumes "length xs = card A"
  assumes "i < card A"
  shows "function_of A enum xs (enum i) = xs ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. function_of A enum xs (enum i) = xs ! i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij_betw enum {0..<card A} A
length xs = card A
i < card A

goal (1 subgoal):
 1. function_of A enum xs (enum i) = xs ! i
[PROOF STEP]
unfolding function_of_def
[PROOF STATE]
proof (prove)
using this:
bij_betw enum {0..<card A} A
length xs = card A
i < card A

goal (1 subgoal):
 1. (if enum i \<in> A then xs ! inv_into {0..<length xs} enum (enum i) else undefined) = xs ! i
[PROOF STEP]
by (auto simp add: bij_betw_inv_into_left bij_betwE)


[STATEMENT]
lemma bit_twiddle_max:
  "(x::'a::len word) XOR (((x::'a::len word) XOR y) AND (if x < y then -1 else 0)) = max x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x XOR (x XOR y) AND (if x < y then - 1 else 0) = max x y
[PROOF STEP]
by (rule bit_eqI) (auto simp add: bit_simps max_def)


[STATEMENT]
lemma skew_product_real_iterates:
  fixes f::"'a \<Rightarrow> real"
  shows "((\<lambda>(x,y). (T x, y + f x))^^n) (x,y) = ((T^^n) x, y + birkhoff_sum f n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>(x, y). (T x, y + f x)) ^^ n) (x, y) = ((T ^^ n) x, y + birkhoff_sum f n x)
[PROOF STEP]
apply (induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>a. case a of (x, y) \<Rightarrow> (T x, y + f x)) ^^ 0) (x, y) = ((T ^^ 0) x, y + birkhoff_sum f 0 x)
 2. \<And>n. ((\<lambda>a. case a of (x, y) \<Rightarrow> (T x, y + f x)) ^^ n) (x, y) = ((T ^^ n) x, y + birkhoff_sum f n x) \<Longrightarrow> ((\<lambda>a. case a of (x, y) \<Rightarrow> (T x, y + f x)) ^^ Suc n) (x, y) = ((T ^^ Suc n) x, y + birkhoff_sum f (Suc n) x)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. ((\<lambda>a. case a of (x, y) \<Rightarrow> (T x, y + f x)) ^^ n) (x, y) = ((T ^^ n) x, y + birkhoff_sum f n x) \<Longrightarrow> birkhoff_sum f n x + f ((T ^^ n) x) = birkhoff_sum f (Suc n) x
[PROOF STEP]
apply (metis (no_types, lifting) Suc_eq_plus1 birkhoff_sum_cocycle qmpt.birkhoff_sum_1(2) qmpt_axioms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem lfp_wf_induction:
  "mono f \<Longrightarrow> (\<forall> w . (p w) \<le> f (Sup_less p w)) \<Longrightarrow> Sup (range p) \<le> lfp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; \<forall>w. p w \<sqsubseteq> f (Sup_less p w)\<rbrakk> \<Longrightarrow> \<Squnion>range p \<sqsubseteq> lfp f
[PROOF STEP]
apply (rule fp_wf_induction, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; \<forall>w. p w \<sqsubseteq> f (Sup_less p w)\<rbrakk> \<Longrightarrow> f (lfp f) = lfp f
[PROOF STEP]
by (drule lfp_unfold, simp)


[STATEMENT]
lemma vector_matrix_row:
  fixes x :: "('a::comm_semiring_1)^'m" and A :: "('a^'n^'m)"
  shows "x v* A = (\<Sum> i\<in>UNIV. (x$i) *s (A$i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x v* A = (\<Sum>i\<in>UNIV. x $ i *s A $ i)
[PROOF STEP]
unfolding vector_matrix_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>j. \<Sum>i\<in>UNIV. A $ i $ j * x $ i) = (\<Sum>i\<in>UNIV. x $ i *s A $ i)
[PROOF STEP]
by (simp add: vec_eq_iff mult.commute)


[STATEMENT]
lemma greaterThanLessThan_eq_ball:
  fixes a b::real
  shows "{a <..< b} = ball ((a + b)/2) ((b - a)/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<..<b} = ball ((a + b) / 2) ((b - a) / 2)
[PROOF STEP]
by (auto simp: dist_real_def field_simps)


[STATEMENT]
lemma rank_take_cols:
  assumes "distinct inds"
  shows "rank (take_cols (1\<^sub>m n) inds) = length (filter ((>) n) inds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (take_cols (1\<^sub>m n) inds) = length (filter (\<lambda>y. y < n) inds)
[PROOF STEP]
apply (subst lin_indpt_full_rank[of _ "length (filter ((>) n) inds)"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. take_cols (1\<^sub>m n) inds \<in> carrier_mat n (length (filter (\<lambda>y. y < n) inds))
 2. distinct (cols (take_cols (1\<^sub>m n) inds))
 3. lin_indpt (set (cols (take_cols (1\<^sub>m n) inds)))
 4. length (filter (\<lambda>y. y < n) inds) = length (filter (\<lambda>y. y < n) inds)
[PROOF STEP]
apply (auto simp add: lin_indpt_take_cols_id)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. take_cols (1\<^sub>m n) inds \<in> carrier_mat n (length (filter (\<lambda>y. y < n) inds))
 2. distinct (cols (take_cols (1\<^sub>m n) inds))
[PROOF STEP]
apply (metis (full_types) index_one_mat(2) index_one_mat(3) length_map mat_of_cols_carrier(1) take_cols_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (cols (take_cols (1\<^sub>m n) inds))
[PROOF STEP]
by (simp add: assms distinct_take_cols_id)


[STATEMENT]
lemma r01_to_r01_r01_measurable:
 "r01_to_r01_r01 \<in> real_borel \<rightarrow>\<^sub>M real_borel \<Otimes>\<^sub>M real_borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01 \<in> real_borel \<rightarrow>\<^sub>M real_borel \<Otimes>\<^sub>M real_borel
[PROOF STEP]
unfolding r01_to_r01_r01_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r. (r01_to_r01_r01_fst r, r01_to_r01_r01_snd r)) \<in> real_borel \<rightarrow>\<^sub>M real_borel \<Otimes>\<^sub>M real_borel
[PROOF STEP]
using borel_measurable_Pair[of r01_to_r01_r01_fst borel r01_to_r01_r01_snd] r01_to_r01_r01_fst_measurable r01_to_r01_r01_snd_measurable
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>r01_to_r01_r01_fst \<in> borel_measurable real_borel; r01_to_r01_r01_snd \<in> borel_measurable real_borel\<rbrakk> \<Longrightarrow> (\<lambda>x. (r01_to_r01_r01_fst x, r01_to_r01_r01_snd x)) \<in> borel_measurable real_borel
r01_to_r01_r01_fst \<in> borel_measurable real_borel
r01_to_r01_r01_snd \<in> borel_measurable real_borel

goal (1 subgoal):
 1. (\<lambda>r. (r01_to_r01_r01_fst r, r01_to_r01_r01_snd r)) \<in> real_borel \<rightarrow>\<^sub>M real_borel \<Otimes>\<^sub>M real_borel
[PROOF STEP]
by(simp add: borel_prod)


[STATEMENT]
lemma surj_on_subset_left: "\<lbrakk> surj_on f A B; A \<subseteq> A' \<rbrakk> \<Longrightarrow> surj_on f A' B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>surj_on f A B; A \<subseteq> A'\<rbrakk> \<Longrightarrow> surj_on f A' B
[PROOF STEP]
unfolding surj_on_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>b\<in>B. \<exists>a\<in>A. b = f a; A \<subseteq> A'\<rbrakk> \<Longrightarrow> \<forall>b\<in>B. \<exists>a\<in>A'. b = f a
[PROOF STEP]
by blast


[STATEMENT]
theorem (in group) inverse_inject:
  assumes eq: "inverse x = inverse y"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "x = x * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x * (1::'a)
[PROOF STEP]
by (simp only: group_right_one)
[PROOF STATE]
proof (state)
this:
x = x * (1::'a)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = x * (1::'a)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "\<dots> = x * (inverse y * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (1::'a) = x * (inverse y * y)
[PROOF STEP]
by (simp only: group_left_inverse)
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse y * y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse y * y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "\<dots> = x * (inverse x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (inverse y * y) = x * (inverse x * y)
[PROOF STEP]
by (simp only: eq)
[PROOF STATE]
proof (state)
this:
x * (inverse y * y) = x * (inverse x * y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (inverse y * y) = x * (inverse x * y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "\<dots> = (x * inverse x) * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (inverse x * y) = x * inverse x * y
[PROOF STEP]
by (simp only: group_assoc)
[PROOF STATE]
proof (state)
this:
x * (inverse x * y) = x * inverse x * y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (inverse x * y) = x * inverse x * y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "\<dots> = 1 * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * inverse x * y = (1::'a) * y
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
x * inverse x * y = (1::'a) * y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * inverse x * y = (1::'a) * y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
have "\<dots> = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) * y = y
[PROOF STEP]
by (simp only: group_left_one)
[PROOF STATE]
proof (state)
this:
(1::'a) * y = y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  outer_prod_tensor_comm:
  fixes a::"complex Matrix.vec"
  fixes u::"complex Matrix.vec"
  assumes "0 < dim_vec a"
  and "0 < dim_vec b"
shows "outer_prod (tensor_vec u v) (tensor_vec a b) = tensor_mat (outer_prod u a) (outer_prod v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
define ot where "ot = outer_prod (tensor_vec u v) (tensor_vec a b)"
[PROOF STATE]
proof (state)
this:
ot = outer_prod (u \<otimes> v) (a \<otimes> b)

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
define to where "to = tensor_mat (outer_prod u a) (outer_prod v b)"
[PROOF STATE]
proof (state)
this:
to = outer_prod u a \<Otimes> outer_prod v b

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
define dv where "dv = dim_vec v"
[PROOF STATE]
proof (state)
this:
dv = dim_vec v

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
define db where "db = dim_vec b"
[PROOF STATE]
proof (state)
this:
db = dim_vec b

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
have "ot = to"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ot = to
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
have ro: "dim_row ot = dim_vec u * dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row ot = dim_vec u * dim_vec v
[PROOF STEP]
unfolding ot_def outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Matrix.mat (dim_vec (u \<otimes> v)) 1 (\<lambda>(i, j). (u \<otimes> v) $ i) * Matrix.mat 1 (dim_vec (a \<otimes> b)) (\<lambda>(i, y). conjugate (a \<otimes> b) $ y)) = dim_vec u * dim_vec v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row ot = dim_vec u * dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
have "dim_row to = dim_row (outer_prod u a) * dim_row (outer_prod v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row to = dim_row (outer_prod u a) * dim_row (outer_prod v b)
[PROOF STEP]
unfolding to_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod u a \<Otimes> outer_prod v b) = dim_row (outer_prod u a) * dim_row (outer_prod v b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row to = dim_row (outer_prod u a) * dim_row (outer_prod v b)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row to = dim_row (outer_prod u a) * dim_row (outer_prod v b)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
have "... = dim_vec u * dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod u a) * dim_row (outer_prod v b) = dim_vec u * dim_vec v
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_row (outer_prod u a) * dim_row (outer_prod v b) = dim_vec u * dim_vec v
[PROOF STEP]
by (metis carrier_matD(1) carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
dim_row (outer_prod u a) * dim_row (outer_prod v b) = dim_vec u * dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_row to = dim_vec u * dim_vec v
[PROOF STEP]
have rt: "dim_row to = dim_vec u * dim_vec v"
[PROOF STATE]
proof (prove)
using this:
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. dim_row to = dim_vec u * dim_vec v
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_row to = dim_vec u * dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_row ot = dim_row to
 3. dim_col ot = dim_col to
[PROOF STEP]
show "dim_row ot = dim_row to"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row ot = dim_row to
[PROOF STEP]
using ro rt
[PROOF STATE]
proof (prove)
using this:
dim_row ot = dim_vec u * dim_vec v
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. dim_row ot = dim_row to
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row ot = dim_row to

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
have co: "dim_col ot = dim_vec a * dim_vec b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col ot = dim_vec a * dim_vec b
[PROOF STEP]
unfolding ot_def outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (Matrix.mat (dim_vec (u \<otimes> v)) 1 (\<lambda>(i, j). (u \<otimes> v) $ i) * Matrix.mat 1 (dim_vec (a \<otimes> b)) (\<lambda>(i, y). conjugate (a \<otimes> b) $ y)) = dim_vec a * dim_vec b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col ot = dim_vec a * dim_vec b

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
have "dim_col to = dim_col (outer_prod u a) * dim_col (outer_prod v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col to = dim_col (outer_prod u a) * dim_col (outer_prod v b)
[PROOF STEP]
unfolding to_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod u a \<Otimes> outer_prod v b) = dim_col (outer_prod u a) * dim_col (outer_prod v b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col to = dim_col (outer_prod u a) * dim_col (outer_prod v b)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_col to = dim_col (outer_prod u a) * dim_col (outer_prod v b)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
have "... = dim_vec a * dim_vec b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod u a) * dim_col (outer_prod v b) = dim_vec a * dim_vec b
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_col (outer_prod u a) * dim_col (outer_prod v b) = dim_vec a * dim_vec b
[PROOF STEP]
by (metis carrier_matD(2) carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
dim_col (outer_prod u a) * dim_col (outer_prod v b) = dim_vec a * dim_vec b

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_col to = dim_vec a * dim_vec b
[PROOF STEP]
have ct: "dim_col to = dim_vec a * dim_vec b"
[PROOF STATE]
proof (prove)
using this:
dim_col to = dim_vec a * dim_vec b

goal (1 subgoal):
 1. dim_col to = dim_vec a * dim_vec b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_col to = dim_vec a * dim_vec b

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
 2. dim_col ot = dim_col to
[PROOF STEP]
show "dim_col ot = dim_col to"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col ot = dim_col to
[PROOF STEP]
using co ct
[PROOF STATE]
proof (prove)
using this:
dim_col ot = dim_vec a * dim_vec b
dim_col to = dim_vec a * dim_vec b

goal (1 subgoal):
 1. dim_col ot = dim_col to
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col ot = dim_col to

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
show "\<And>i j. i < dim_row to \<Longrightarrow> j < dim_col to \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
assume "i < dim_row to" and "j < dim_col to"
[PROOF STATE]
proof (state)
this:
i < dim_row to
j < dim_col to

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
note ij = this
[PROOF STATE]
proof (state)
this:
i < dim_row to
j < dim_col to

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "ot $$ (i,j) = Matrix.vec_index (tensor_vec u v) i *
        (conjugate (Matrix.vec_index (tensor_vec a b) j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ot $$ (i, j) = (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
unfolding ot_def outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Matrix.mat (dim_vec (u \<otimes> v)) 1 (\<lambda>(i, j). (u \<otimes> v) $ i) * Matrix.mat 1 (dim_vec (a \<otimes> b)) (\<lambda>(i, y). conjugate (a \<otimes> b) $ y)) $$ (i, j) = (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
using ij rt ct
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v
dim_col to = dim_vec a * dim_vec b

goal (1 subgoal):
 1. (Matrix.mat (dim_vec (u \<otimes> v)) 1 (\<lambda>(i, j). (u \<otimes> v) $ i) * Matrix.mat 1 (dim_vec (a \<otimes> b)) (\<lambda>(i, y). conjugate (a \<otimes> b) $ y)) $$ (i, j) = (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ot $$ (i, j) = (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ot $$ (i, j) = (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = vec_index u (i div dv) * vec_index v (i mod dv)  *
        (conjugate (Matrix.vec_index (tensor_vec a b) j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
using ij rt assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
unfolding dv_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. (u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j) = u $ (i div dim_vec v) * v $ (i mod dim_vec v) * conjugate ((a \<otimes> b) $ j)
[PROOF STEP]
by (metis index_tensor_vec less_nat_zero_code nat_0_less_mult_iff neq0_conv)
[PROOF STATE]
proof (state)
this:
(u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u \<otimes> v) $ i * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = vec_index u (i div dv) * vec_index v (i mod dv)  *
        (conjugate (vec_index a (j div db) * vec_index b (j mod db)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db))
[PROOF STEP]
using ij ct assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db))
[PROOF STEP]
unfolding db_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div dim_vec b) * b $ (j mod dim_vec b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate ((a \<otimes> b) $ j) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = vec_index u (i div dv) * vec_index v (i mod dv)  *
        (conjugate (vec_index a (j div db))) * (conjugate (vec_index b (j mod db)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db)) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db)) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db) * b $ (j mod db)) = u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = vec_index u (i div dv) * (conjugate (vec_index a (j div db))) *
        vec_index v (i mod dv) * (conjugate (vec_index b (j mod db)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db)) = u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db)) = u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * v $ (i mod dv) * conjugate (a $ (j div db)) * conjugate (b $ (j mod db)) = u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = (outer_prod u a) $$ (i div dv, j div db) *
        vec_index v (i mod dv) * (conjugate (vec_index b (j mod db)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
have "i div dv < dim_vec u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div dv < dim_vec u
[PROOF STEP]
using ij rt
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. i div dv < dim_vec u
[PROOF STEP]
unfolding dv_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. i div dim_vec v < dim_vec u
[PROOF STEP]
by (simp add: less_mult_imp_div_less)
[PROOF STATE]
proof (state)
this:
i div dv < dim_vec u

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i div dv < dim_vec u

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
have "j div db < dim_vec a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j div db < dim_vec a
[PROOF STEP]
using ij ct assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. j div db < dim_vec a
[PROOF STEP]
unfolding db_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. j div dim_vec b < dim_vec a
[PROOF STEP]
by (simp add: less_mult_imp_div_less)
[PROOF STATE]
proof (state)
this:
j div db < dim_vec a

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i div dv < dim_vec u
j div db < dim_vec a
[PROOF STEP]
have "vec_index u (i div dv) * (conjugate (vec_index a (j div db))) =
          (outer_prod u a) $$ (i div dv, j div db)"
[PROOF STATE]
proof (prove)
using this:
i div dv < dim_vec u
j div db < dim_vec a

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) = outer_prod u a $$ (i div dv, j div db)
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
using this:
i div dv < dim_vec u
j div db < dim_vec a

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) = (Matrix.mat (dim_vec u) 1 (\<lambda>(i, j). u $ i) * Matrix.mat 1 (dim_vec a) (\<lambda>(i, y). conjugate a $ y)) $$ (i div dv, j div db)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * conjugate (a $ (j div db)) = outer_prod u a $$ (i div dv, j div db)

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
u $ (i div dv) * conjugate (a $ (j div db)) = outer_prod u a $$ (i div dv, j div db)

goal (1 subgoal):
 1. u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u $ (i div dv) * conjugate (a $ (j div db)) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = (outer_prod u a) $$ (i div dv, j div db) *
        (outer_prod v b) $$ (i mod dv, j mod db)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
have "i mod dv < dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i mod dv < dim_vec v
[PROOF STEP]
using ij rt
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. i mod dv < dim_vec v
[PROOF STEP]
unfolding dv_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. i mod dim_vec v < dim_vec v
[PROOF STEP]
using assms mod_less_divisor
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v
0 < dim_vec a
0 < dim_vec b
0 < ?n \<Longrightarrow> ?m mod ?n < ?n

goal (1 subgoal):
 1. i mod dim_vec v < dim_vec v
[PROOF STEP]
by (metis less_nat_zero_code mult.commute neq0_conv times_nat.simps(1))
[PROOF STATE]
proof (state)
this:
i mod dv < dim_vec v

goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i mod dv < dim_vec v

goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
have "j mod db < dim_vec b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j mod db < dim_vec b
[PROOF STEP]
using ij ct assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. j mod db < dim_vec b
[PROOF STEP]
unfolding db_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. j mod dim_vec b < dim_vec b
[PROOF STEP]
by (simp add: less_mult_imp_div_less)
[PROOF STATE]
proof (state)
this:
j mod db < dim_vec b

goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i mod dv < dim_vec v
j mod db < dim_vec b
[PROOF STEP]
have "vec_index v (i mod dv) * (conjugate (vec_index b (j mod db))) =
          (outer_prod v b) $$ (i mod dv, j mod db)"
[PROOF STATE]
proof (prove)
using this:
i mod dv < dim_vec v
j mod db < dim_vec b

goal (1 subgoal):
 1. v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
using this:
i mod dv < dim_vec v
j mod db < dim_vec b

goal (1 subgoal):
 1. v $ (i mod dv) * conjugate (b $ (j mod db)) = (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec b) (\<lambda>(i, y). conjugate b $ y)) $$ (i mod dv, j mod db)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod v b $$ (i mod dv, j mod db)

goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod v b $$ (i mod dv, j mod db)

goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
outer_prod u a $$ (i div dv, j div db) * v $ (i mod dv) * conjugate (b $ (j mod db)) = outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
have "... = tensor_mat (outer_prod u a) (outer_prod v b) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)
[PROOF STEP]
proof (rule index_tensor_mat[symmetric])
[PROOF STATE]
proof (state)
goal (8 subgoals):
 1. dim_row (outer_prod u a) = ?rA
 2. dim_col (outer_prod u a) = ?cA
 3. dim_row (outer_prod v b) = dv
 4. dim_col (outer_prod v b) = db
 5. i < ?rA * dv
 6. j < ?cA * db
 7. 0 < ?cA
 8. 0 < db
[PROOF STEP]
show "dim_row (outer_prod u a) = dim_vec u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod u a) = dim_vec u
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Matrix.mat (dim_vec u) 1 (\<lambda>(i, j). u $ i) * Matrix.mat 1 (dim_vec a) (\<lambda>(i, y). conjugate a $ y)) = dim_vec u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (outer_prod u a) = dim_vec u

goal (7 subgoals):
 1. dim_col (outer_prod u a) = ?cA
 2. dim_row (outer_prod v b) = dv
 3. dim_col (outer_prod v b) = db
 4. i < dim_vec u * dv
 5. j < ?cA * db
 6. 0 < ?cA
 7. 0 < db
[PROOF STEP]
show "dim_row (outer_prod v b) = dv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod v b) = dv
[PROOF STEP]
unfolding outer_prod_def dv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec b) (\<lambda>(i, y). conjugate b $ y)) = dim_vec v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (outer_prod v b) = dv

goal (6 subgoals):
 1. dim_col (outer_prod u a) = ?cA
 2. dim_col (outer_prod v b) = db
 3. i < dim_vec u * dv
 4. j < ?cA * db
 5. 0 < ?cA
 6. 0 < db
[PROOF STEP]
show "dim_col (outer_prod v b) = db"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod v b) = db
[PROOF STEP]
unfolding db_def outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec b) (\<lambda>(i, y). conjugate b $ y)) = dim_vec b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (outer_prod v b) = db

goal (5 subgoals):
 1. dim_col (outer_prod u a) = ?cA
 2. i < dim_vec u * dv
 3. j < ?cA * db
 4. 0 < ?cA
 5. 0 < db
[PROOF STEP]
show "i < dim_vec u * dv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec u * dv
[PROOF STEP]
unfolding dv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec u * dim_vec v
[PROOF STEP]
using ij rt
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_row to = dim_vec u * dim_vec v

goal (1 subgoal):
 1. i < dim_vec u * dim_vec v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < dim_vec u * dv

goal (4 subgoals):
 1. dim_col (outer_prod u a) = ?cA
 2. j < ?cA * db
 3. 0 < ?cA
 4. 0 < db
[PROOF STEP]
show "dim_col (outer_prod u a) = dim_vec a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod u a) = dim_vec a
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (Matrix.mat (dim_vec u) 1 (\<lambda>(i, j). u $ i) * Matrix.mat 1 (dim_vec a) (\<lambda>(i, y). conjugate a $ y)) = dim_vec a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (outer_prod u a) = dim_vec a

goal (3 subgoals):
 1. j < dim_vec a * db
 2. 0 < dim_vec a
 3. 0 < db
[PROOF STEP]
show "j < dim_vec a * db"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_vec a * db
[PROOF STEP]
unfolding db_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_vec a * dim_vec b
[PROOF STEP]
using ij ct
[PROOF STATE]
proof (prove)
using this:
i < dim_row to
j < dim_col to
dim_col to = dim_vec a * dim_vec b

goal (1 subgoal):
 1. j < dim_vec a * dim_vec b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < dim_vec a * db

goal (2 subgoals):
 1. 0 < dim_vec a
 2. 0 < db
[PROOF STEP]
show "0 < dim_vec a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < dim_vec a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. 0 < dim_vec a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < dim_vec a

goal (1 subgoal):
 1. 0 < db
[PROOF STEP]
show "0 < db"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < db
[PROOF STEP]
unfolding db_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < dim_vec b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec a
0 < dim_vec b

goal (1 subgoal):
 1. 0 < dim_vec b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < db

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
outer_prod u a $$ (i div dv, j div db) * outer_prod v b $$ (i mod dv, j mod db) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row to; j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ot $$ (i, j) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)
[PROOF STEP]
show "ot $$ (i, j) = to $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
ot $$ (i, j) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)

goal (1 subgoal):
 1. ot $$ (i, j) = to $$ (i, j)
[PROOF STEP]
unfolding to_def
[PROOF STATE]
proof (prove)
using this:
ot $$ (i, j) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)

goal (1 subgoal):
 1. ot $$ (i, j) = (outer_prod u a \<Otimes> outer_prod v b) $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ot $$ (i, j) = to $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row to; ?j < dim_col to\<rbrakk> \<Longrightarrow> ot $$ (?i, ?j) = to $$ (?i, ?j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ot = to

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ot = to

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
unfolding ot_def to_def
[PROOF STATE]
proof (prove)
using this:
outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b

goal (1 subgoal):
 1. outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod (u \<otimes> v) (a \<otimes> b) = outer_prod u a \<Otimes> outer_prod v b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_of_list_sorted_wrt_list_of_set [simp]:
  assumes "linorder_on A R" "finite A"
  shows   "linorder_of_list (sorted_wrt_list_of_set R A) = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
[PROOF STEP]
have subset: "R \<subseteq> A \<times> A"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R

goal (1 subgoal):
 1. R \<subseteq> A \<times> A
[PROOF STEP]
by (auto simp: linorder_on_def refl_on_def)
[PROOF STATE]
proof (state)
this:
R \<subseteq> A \<times> A

goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
from assms and subset
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
finite A
R \<subseteq> A \<times> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
finite A
R \<subseteq> A \<times> A

goal (1 subgoal):
 1. linorder_of_list (sorted_wrt_list_of_set R A) = R
[PROOF STEP]
by (auto simp: linorder_of_list_def linorder_sorted_wrt_list_of_set sorted_wrt_linorder_index_le_iff)
[PROOF STATE]
proof (state)
this:
linorder_of_list (sorted_wrt_list_of_set R A) = R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_strict_SD_iff:
  assumes "p \<in> lotteries_on carrier" "q \<in> lotteries_on carrier"
  shows   "\<not>(p \<prec>[SD(le)] q) \<longleftrightarrow>
             (\<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> p \<prec>[SD le] q) = (\<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
 2. \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u \<Longrightarrow> \<not> p \<prec>[SD le] q
[PROOF STEP]
let ?E = "measure_pmf.expectation :: 'a pmf \<Rightarrow> _ \<Rightarrow> real"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
 2. \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u \<Longrightarrow> \<not> p \<prec>[SD le] q
[PROOF STEP]
assume "\<exists>u. is_vnm_utility u \<and> ?E p u \<ge> ?E q u"
[PROOF STATE]
proof (state)
this:
\<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u

goal (2 subgoals):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
 2. \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u \<Longrightarrow> \<not> p \<prec>[SD le] q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
[PROOF STEP]
obtain u where u: "is_vnm_utility u" "?E p u \<ge> ?E q u"
[PROOF STATE]
proof (prove)
using this:
\<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>is_vnm_utility u; measure_pmf.expectation q u \<le> measure_pmf.expectation p u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_vnm_utility u
measure_pmf.expectation q u \<le> measure_pmf.expectation p u

goal (2 subgoals):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
 2. \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u \<Longrightarrow> \<not> p \<prec>[SD le] q
[PROOF STEP]
interpret u: vnm_utility carrier le u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_vnm_utility u
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
 2. \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u \<Longrightarrow> \<not> p \<prec>[SD le] q
[PROOF STEP]
show "\<not> p \<prec>[SD le] q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p \<prec>[SD le] q
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
assume less: "p \<prec>[SD le] q"
[PROOF STATE]
proof (state)
this:
p \<prec>[SD le] q

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
p \<prec>[SD le] q
[PROOF STEP]
have pq: "?E p u \<le> ?E q u" if "is_vnm_utility u" for u
[PROOF STATE]
proof (prove)
using this:
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
p \<prec>[SD le] q

goal (1 subgoal):
 1. measure_pmf.expectation p u \<le> measure_pmf.expectation q u
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
p \<prec>[SD le] q
is_vnm_utility u

goal (1 subgoal):
 1. measure_pmf.expectation p u \<le> measure_pmf.expectation q u
[PROOF STEP]
by (auto simp: SD_iff_expected_utilities_le strongly_preferred_def)
[PROOF STATE]
proof (state)
this:
is_vnm_utility ?u \<Longrightarrow> measure_pmf.expectation p ?u \<le> measure_pmf.expectation q ?u

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
with u
[PROOF STATE]
proof (chain)
picking this:
is_vnm_utility u
measure_pmf.expectation q u \<le> measure_pmf.expectation p u
is_vnm_utility ?u \<Longrightarrow> measure_pmf.expectation p ?u \<le> measure_pmf.expectation q ?u
[PROOF STEP]
have u_eq: "?E p u = ?E q u"
[PROOF STATE]
proof (prove)
using this:
is_vnm_utility u
measure_pmf.expectation q u \<le> measure_pmf.expectation p u
is_vnm_utility ?u \<Longrightarrow> measure_pmf.expectation p ?u \<le> measure_pmf.expectation q ?u

goal (1 subgoal):
 1. measure_pmf.expectation p u = measure_pmf.expectation q u
[PROOF STEP]
by (intro antisym) simp_all
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation p u = measure_pmf.expectation q u

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
from less assms
[PROOF STATE]
proof (chain)
picking this:
p \<prec>[SD le] q
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
[PROOF STEP]
obtain u' where u': "is_vnm_utility u'" "?E p u' < ?E q u'"
[PROOF STATE]
proof (prove)
using this:
p \<prec>[SD le] q
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier

goal (1 subgoal):
 1. (\<And>u'. \<lbrakk>is_vnm_utility u'; measure_pmf.expectation p u' < measure_pmf.expectation q u'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: SD_iff_expected_utilities_le strongly_preferred_def not_le)
[PROOF STATE]
proof (state)
this:
is_vnm_utility u'
measure_pmf.expectation p u' < measure_pmf.expectation q u'

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
interpret u': vnm_utility carrier le u'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_vnm_utility u'
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
have "\<exists>\<epsilon>>0. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<epsilon>>0. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)
[PROOF STEP]
by (intro u.diff_epsilon antisym u'.utility_le)
[PROOF STATE]
proof (state)
this:
\<exists>\<epsilon>>0. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<epsilon>>0. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)
[PROOF STEP]
obtain \<epsilon> where \<epsilon>: "\<epsilon> > 0" "is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<epsilon>>0. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)

goal (1 subgoal):
 1. (\<And>\<epsilon>. \<lbrakk>0 < \<epsilon>; is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < \<epsilon>
is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
define u'' where "u'' x = u x - \<epsilon> * u' x" for x
[PROOF STATE]
proof (state)
this:
u'' ?x = u ?x - \<epsilon> * u' ?x

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
interpret u'': vnm_utility carrier le u''
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_vnm_utility u''
[PROOF STEP]
unfolding u''_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
have exp_u'': "?E p u'' = ?E p u - \<epsilon> * ?E p u'" if "p \<in> lotteries_on carrier" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation p u'' = measure_pmf.expectation p u - \<epsilon> * measure_pmf.expectation p u'
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p \<in> lotteries_on carrier

goal (1 subgoal):
 1. measure_pmf.expectation p u'' = measure_pmf.expectation p u - \<epsilon> * measure_pmf.expectation p u'
[PROOF STEP]
by (subst (1 2 3) integral_measure_pmf[of carrier])
         (auto simp: lotteries_on_def u''_def algebra_simps sum_subtractf sum_distrib_left)
[PROOF STATE]
proof (state)
this:
?p \<in> lotteries_on carrier \<Longrightarrow> measure_pmf.expectation ?p u'' = measure_pmf.expectation ?p u - \<epsilon> * measure_pmf.expectation ?p u'

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
from assms \<epsilon>
[PROOF STATE]
proof (chain)
picking this:
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
0 < \<epsilon>
is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)
[PROOF STEP]
have "?E p u'' > ?E q u''"
[PROOF STATE]
proof (prove)
using this:
p \<in> lotteries_on carrier
q \<in> lotteries_on carrier
0 < \<epsilon>
is_vnm_utility (\<lambda>x. u x - \<epsilon> * u' x)

goal (1 subgoal):
 1. measure_pmf.expectation q u'' < measure_pmf.expectation p u''
[PROOF STEP]
by (simp_all add: exp_u'' algebra_simps u_eq u')
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation q u'' < measure_pmf.expectation p u''

goal (1 subgoal):
 1. p \<prec>[SD le] q \<Longrightarrow> False
[PROOF STEP]
with pq[OF u''.vnm_utility_axioms]
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.expectation p u'' \<le> measure_pmf.expectation q u''
measure_pmf.expectation q u'' < measure_pmf.expectation p u''
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
measure_pmf.expectation p u'' \<le> measure_pmf.expectation q u''
measure_pmf.expectation q u'' < measure_pmf.expectation p u''

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> p \<prec>[SD le] q

goal (1 subgoal):
 1. \<not> p \<prec>[SD le] q \<Longrightarrow> \<exists>u. is_vnm_utility u \<and> measure_pmf.expectation q u \<le> measure_pmf.expectation p u
[PROOF STEP]
qed (insert assms utility_weak_ranking_index,
     auto simp: strongly_preferred_def SD_iff_expected_utilities_le not_le not_less intro: antisym)


[STATEMENT]
theorem image_is_isomorphic_to_quotient_ring:
  "\<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
interpret image: ring_homomorphism_fundamental where R' = "\<eta> ` R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_homomorphism_fundamental \<eta> R (+) (\<cdot>) \<zero> \<one> (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'
[PROOF STEP]
by unfold_locales (auto simp: target.additive.commutative additive.commutes_with_composition
      multiplicative.commutes_with_composition target.distributive multiplicative.commutes_with_unit)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
have "ring_isomorphism image.additive.induced (R // additive.Ker) ([+]) ([\<cdot>]) (kernel.additive.Class \<zero>) (kernel.additive.Class \<one>) (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_isomorphism image.additive.induced kernel.additive.Partition ([+]) ([\<cdot>]) (kernel.additive.Class \<zero>) (kernel.additive.Class \<one>) (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'
[PROOF STEP]
by unfold_locales (simp add: image.additive.induced_image bij_betw_def)
[PROOF STATE]
proof (state)
this:
ring_isomorphism image.additive.induced kernel.additive.Partition ([+]) ([\<cdot>]) (kernel.additive.Class \<zero>) (kernel.additive.Class \<one>) (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'

goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ring_isomorphism image.additive.induced kernel.additive.Partition ([+]) ([\<cdot>]) (kernel.additive.Class \<zero>) (kernel.additive.Class \<one>) (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'
[PROOF STEP]
have "(\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // additive.Ker, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)"
[PROOF STATE]
proof (prove)
using this:
ring_isomorphism image.additive.induced kernel.additive.Partition ([+]) ([\<cdot>]) (kernel.additive.Class \<zero>) (kernel.additive.Class \<one>) (\<eta> ` R) (+') (\<cdot>') \<zero>' \<one>'

goal (1 subgoal):
 1. (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (kernel.additive.Partition, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)
[PROOF STEP]
by (simp add: isomorphic_as_rings_def) (meson ring_isomorphism.inverse_ring_isomorphism)
[PROOF STATE]
proof (state)
this:
(\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (kernel.additive.Partition, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)

goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (kernel.additive.Partition, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)

goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
have "ideal additive.Ker R (+) (\<cdot>) \<zero> \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal image.additive.Ker R (+) (\<cdot>) \<zero> \<one>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
ideal image.additive.Ker R (+) (\<cdot>) \<zero> \<one>

goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (kernel.additive.Partition, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)
ideal image.additive.Ker R (+) (\<cdot>) \<zero> \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (kernel.additive.Partition, ([+]), ([\<cdot>]), kernel.additive.Class \<zero>, kernel.additive.Class \<one>)
ideal image.additive.Ker R (+) (\<cdot>) \<zero> \<one>

goal (1 subgoal):
 1. \<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>K add mult zero one. ideal K R (+) (\<cdot>) \<zero> \<one> \<and> (\<eta> ` R, (+'), (\<cdot>'), \<zero>', \<one>') \<cong>\<^sub>R (R // K, add, mult, zero, one)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in abelian_group) four_elem_comm:
  assumes "a \<in> carrier G" and "b \<in> carrier G" and "c \<in> carrier G" and "d \<in> carrier G"
  shows "a \<ominus> c \<oplus> b \<ominus> d = a \<oplus> b \<ominus> c \<ominus> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<ominus> c \<oplus> b \<ominus> d = a \<oplus> b \<ominus> c \<ominus> d
[PROOF STEP]
using assms a_assoc a_comm
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G
d \<in> carrier G
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G; ?z \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y \<oplus> ?z = ?x \<oplus> (?y \<oplus> ?z)
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y = ?y \<oplus> ?x

goal (1 subgoal):
 1. a \<ominus> c \<oplus> b \<ominus> d = a \<oplus> b \<ominus> c \<ominus> d
[PROOF STEP]
by (simp add: a_minus_def)


[STATEMENT]
lemma ln_msetprod:
  assumes "\<And>x. x \<in>#I \<Longrightarrow> x > 0"
  shows "(\<Sum>p::nat\<in>#I. ln p) = ln (\<Prod>p\<in>#I. p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>#I. ln (real p)) = ln (\<Prod>\<^sub># (image_mset real I))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># I \<Longrightarrow> 0 < ?x

goal (1 subgoal):
 1. (\<Sum>p\<in>#I. ln (real p)) = ln (\<Prod>\<^sub># (image_mset real I))
[PROOF STEP]
by (induction I) (simp_all add: of_nat_prod_mset ln_mult prod_mset_pos)


[STATEMENT]
lemma sum_list_concat_map: "sum_list (concat (map f xs)) = sum_list (map (\<lambda>x. sum_list (f x)) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (concat (map f xs)) = (\<Sum>x\<leftarrow>xs. sum_list (f x))
[PROOF STEP]
by(induction xs) simp_all


[STATEMENT]
theorem maxt_corr:assumes "invar_vebt t n" and "vebt_maxt t = Some x" shows "max_in_set (set_vebt' t) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_in_set (set_vebt' t) x
[PROOF STEP]
unfolding set_vebt'_def Max_def max_in_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Collect (vebt_member t) \<and> (\<forall>y\<in>Collect (vebt_member t). y \<le> x)
[PROOF STEP]
using assms(1) assms(2) maxt_corr_help maxt_member
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n
vebt_maxt t = Some x
\<lbrakk>invar_vebt ?t ?n; vebt_maxt ?t = Some ?maxi; vebt_member ?t ?x\<rbrakk> \<Longrightarrow> ?x \<le> ?maxi
\<lbrakk>invar_vebt ?t ?n; vebt_maxt ?t = Some ?maxi\<rbrakk> \<Longrightarrow> vebt_member ?t ?maxi

goal (1 subgoal):
 1. x \<in> Collect (vebt_member t) \<and> (\<forall>y\<in>Collect (vebt_member t). y \<le> x)
[PROOF STEP]
by blast


[STATEMENT]
lemma sqrtu_2_eq:
   "sqrtu x 2 = (1/8)*(x^4 + 28*x^3 + 70*x^2 + 28*x + 1) / ((x + 1)*(x^2 + 6*x + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrtu x 2 = 1 / 8 * (x ^ 4 + 28 * x ^ 3 + 70 * x\<^sup>2 + 28 * x + 1) / ((x + 1) * (x\<^sup>2 + 6 * x + 1))
[PROOF STEP]
by (simp add: sqrtu_numeral divide_simps) algebra


[STATEMENT]
lemma inverse_prod_list: "inverse (prod_list xs :: 'a :: field) = prod_list (map inverse xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (prod_list xs) = prod_list (map inverse xs)
[PROOF STEP]
by (induction xs) simp_all


[STATEMENT]
lemma list_of_eucl_add: "list_of_eucl (x + y) = map2 (+) (list_of_eucl x) (list_of_eucl y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_of_eucl (x + y) = map2 (+) (list_of_eucl x) (list_of_eucl y)
[PROOF STEP]
by (auto intro!: nth_equalityI simp: inner_simps)


[STATEMENT]
lemma sqrtl_2_eq: "sqrtl x 2 =
    8*x*(x + 1)*(x^2 + 6*x + 1) / (x^4 + 28*x^3 + 70*x^2 + 28*x + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrtl x 2 = 8 * x * (x + 1) * (x\<^sup>2 + 6 * x + 1) / (x ^ 4 + 28 * x ^ 3 + 70 * x\<^sup>2 + 28 * x + 1)
[PROOF STEP]
using sqrtu_gt_0 [of x 2]
[PROOF STATE]
proof (prove)
using this:
0 \<le> x \<Longrightarrow> 0 < sqrtu x 2

goal (1 subgoal):
 1. sqrtl x 2 = 8 * x * (x + 1) * (x\<^sup>2 + 6 * x + 1) / (x ^ 4 + 28 * x ^ 3 + 70 * x\<^sup>2 + 28 * x + 1)
[PROOF STEP]
by (simp add: sqrtl_def sqrtu_2_eq)


[STATEMENT]
lemma mono_SupI:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  assumes "mono f"
  assumes "S'\<subseteq>f`S"
  shows "Sup S' \<le> f (Sup S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup S' \<le> f (Sup S)
[PROOF STEP]
by (metis Sup_subset_mono assms mono_Sup order_trans)


[STATEMENT]
lemma move_matrix_add: "((move_matrix (A + B) j i)::(('a::monoid_add) matrix)) = (move_matrix A j i) + (move_matrix B j i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. move_matrix (A + B) j i = move_matrix A j i + move_matrix B j i
[PROOF STEP]
apply (subst Rep_matrix_inject[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (move_matrix (A + B) j i) = Rep_matrix (move_matrix A j i + move_matrix B j i)
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (move_matrix (A + B) j i) x xa = Rep_matrix (move_matrix A j i + move_matrix B j i) x xa
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prime_odd_nat: "prime p \<Longrightarrow> p > (2::nat) \<Longrightarrow> odd p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; 2 < p\<rbrakk> \<Longrightarrow> odd p
[PROOF STEP]
by (intro prime_nat_not_dvd) auto


[STATEMENT]
lemma orthogonal_complementI:
  \<open>(\<And>x. x \<in> M \<Longrightarrow> y \<bullet>\<^sub>C x = 0) \<Longrightarrow> y \<in> orthogonal_complement M\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> M \<Longrightarrow> y \<bullet>\<^sub>C x = 0) \<Longrightarrow> y \<in> orthogonal_complement M
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> M \<Longrightarrow> y \<bullet>\<^sub>C x = 0) \<Longrightarrow> y \<in> {x |x. \<forall>y\<in>M. x \<bullet>\<^sub>C y = 0}
[PROOF STEP]
by simp


[STATEMENT]
lemma raw_has_prod_inverse:
  assumes "raw_has_prod f M a" shows "raw_has_prod (\<lambda>n. inverse (f n)) M (inverse a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. raw_has_prod (\<lambda>n. inverse (f n)) M (inverse a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
raw_has_prod f M a

goal (1 subgoal):
 1. raw_has_prod (\<lambda>n. inverse (f n)) M (inverse a)
[PROOF STEP]
unfolding raw_has_prod_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> a \<and> a \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i\<le>n. inverse (f (i + M))) \<longlonglongrightarrow> inverse a \<and> inverse a \<noteq> (0::'a)
[PROOF STEP]
by (auto dest: tendsto_inverse simp: prod_inversef [symmetric])


[STATEMENT]
lemma affine_hull_halfspace_lt:
  fixes a :: "'a::euclidean_space"
  shows "affine hull {x. a \<bullet> x < r} = (if a = 0 \<and> r \<le> 0 then {} else UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull {x. a \<bullet> x < r} = (if a = (0::'a) \<and> r \<le> 0 then {} else UNIV)
[PROOF STEP]
using halfspace_eq_empty_lt [of a r]
[PROOF STATE]
proof (prove)
using this:
({x. a \<bullet> x < r} = {}) = (a = (0::'a) \<and> r \<le> 0)

goal (1 subgoal):
 1. affine hull {x. a \<bullet> x < r} = (if a = (0::'a) \<and> r \<le> 0 then {} else UNIV)
[PROOF STEP]
by (simp add: open_halfspace_lt affine_hull_open)


[STATEMENT]
lemma distinct_seteq_set_Cons:
  "\<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk>
    \<Longrightarrow> \<exists>y ys. y # ys = x \<and> length ys = n \<and> distinct ys \<and> finite (set ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys. y # ys = x \<and> length ys = n \<and> distinct ys \<and> finite (set ys)
[PROOF STEP]
using distinct_seteq_set_length_eq[of x] Suc_length_conv[of n x]
[PROOF STATE]
proof (prove)
using this:
x \<in> {ys. set ys = ?xs \<and> distinct ys} \<Longrightarrow> length x = Finite_Set.card ?xs
(Suc n = length x) = (\<exists>y ys. x = y # ys \<and> length ys = n)

goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys. y # ys = x \<and> length ys = n \<and> distinct ys \<and> finite (set ys)
[PROOF STEP]
by force


[STATEMENT]
lemma arccos_le_arccos: "- 1 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y \<le> arccos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> arccos y \<le> arccos x
[PROOF STEP]
using arccos_le_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<bar>?x\<bar> \<le> 1; \<bar>?y\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arccos ?x \<le> arccos ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> arccos y \<le> arccos x
[PROOF STEP]
by auto


[STATEMENT]
lemma prime_dvd_mult_iff: "prime p \<Longrightarrow> p dvd a * b \<longleftrightarrow> p dvd a \<or> p dvd b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> (p dvd a * b) = (p dvd a \<or> p dvd b)
[PROOF STEP]
by (auto dest: prime_dvd_multD)


[STATEMENT]
lemma gauss_norm_geqI:
  assumes "g \<in> carrier (UP Q\<^sub>p)"
  assumes "\<And>n. val (g n) \<ge> \<alpha>"
  shows "gauss_norm g \<ge> \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> \<le> gauss_norm g
[PROOF STEP]
unfolding gauss_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> \<le> Min (val ` g ` {..deg Q\<^sub>p g})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier (UP Q\<^sub>p)
\<alpha> \<le> val (g ?n1)

goal (1 subgoal):
 1. \<alpha> \<le> Min (val ` g ` {..deg Q\<^sub>p g})
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_list_replicate: "sum_list (replicate n c) = of_nat n * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate n c) = of_nat n * c
[PROOF STEP]
by(induction n)(auto simp add: distrib_right)


[STATEMENT]
lemma not_inj_on_iff_eq_icard: "\<exists>(f::nat\<Rightarrow>nat) (A::nat set). \<not> (inj_on f A = (icard (f ` A) = icard A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f A. inj_on f A \<noteq> (icard (f ` A) = icard A)
[PROOF STEP]
by (insert not_eq_icard_imp_inj_on, blast)


[STATEMENT]
lemma Sum_any_product:
  fixes f g :: "'b \<Rightarrow> 'a::semiring_0"
  assumes "finite {a. f a \<noteq> 0}" and "finite {b. g b \<noteq> 0}"
  shows "Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
have subset_f: "{a. (\<Sum>b. f a * g b) \<noteq> 0} \<subseteq> {a. f a \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
[PROOF STEP]
by rule (simp, rule, auto)
[PROOF STATE]
proof (state)
this:
{a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
have subset_g: "\<And>a. {b. f a * g b \<noteq> 0} \<subseteq> {b. g b \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. {b. f a * g b \<noteq> (0::'a)} \<subseteq> {b. g b \<noteq> (0::'a)}
[PROOF STEP]
by rule (simp, rule, auto)
[PROOF STATE]
proof (state)
this:
{b. f ?a * g b \<noteq> (0::'a)} \<subseteq> {b. g b \<noteq> (0::'a)}

goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
{b. f ?a * g b \<noteq> (0::'a)} \<subseteq> {b. g b \<noteq> (0::'a)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
{b. f ?a * g b \<noteq> (0::'a)} \<subseteq> {b. g b \<noteq> (0::'a)}

goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{a. (\<Sum>b. f a * g b) \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
{b. f ?a * g b \<noteq> (0::'a)} \<subseteq> {b. g b \<noteq> (0::'a)}
finite {a. f a \<noteq> (0::'a)}
finite {b. g b \<noteq> (0::'a)}

goal (1 subgoal):
 1. Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)
[PROOF STEP]
by (auto simp add: Sum_any.expand_set [of f] Sum_any.expand_set [of g]
      Sum_any.expand_superset [of "{a. f a \<noteq> 0}"] Sum_any.expand_superset [of "{b. g b \<noteq> 0}"]
      sum_product)
[PROOF STATE]
proof (state)
this:
Sum_any f * Sum_any g = (\<Sum>a. \<Sum>b. f a * g b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_add_null:
  fixes u v::"nat \<Rightarrow> ('a::real_normed_vector)"
  assumes "convergent u"
          "(\<lambda>n. v n - u n) \<longlonglongrightarrow> 0"
  shows "convergent v" "lim v = lim u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent v &&& lim v = lim u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convergent v
 2. lim v = lim u
[PROOF STEP]
have "(\<lambda>n. u n + (v n - u n)) \<longlonglongrightarrow> lim u + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. u n + (v n - u n)) \<longlonglongrightarrow> lim u + (0::'a)
[PROOF STEP]
apply (rule tendsto_add)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. u \<longlonglongrightarrow> lim u
 2. (\<lambda>x. v x - u x) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using assms convergent_LIMSEQ_iff
[PROOF STATE]
proof (prove)
using this:
convergent u
(\<lambda>n. v n - u n) \<longlonglongrightarrow> (0::'a)
convergent ?X = ?X \<longlonglongrightarrow> lim ?X

goal (2 subgoals):
 1. u \<longlonglongrightarrow> lim u
 2. (\<lambda>x. v x - u x) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. u n + (v n - u n)) \<longlonglongrightarrow> lim u + (0::'a)

goal (2 subgoals):
 1. convergent v
 2. lim v = lim u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. u n + (v n - u n)) \<longlonglongrightarrow> lim u + (0::'a)
[PROOF STEP]
have *: "v \<longlonglongrightarrow> lim u"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. u n + (v n - u n)) \<longlonglongrightarrow> lim u + (0::'a)

goal (1 subgoal):
 1. v \<longlonglongrightarrow> lim u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<longlonglongrightarrow> lim u

goal (2 subgoals):
 1. convergent v
 2. lim v = lim u
[PROOF STEP]
show "convergent v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent v
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
v \<longlonglongrightarrow> lim u

goal (1 subgoal):
 1. convergent v
[PROOF STEP]
by (simp add: Lim_def convergentI)
[PROOF STATE]
proof (state)
this:
convergent v

goal (1 subgoal):
 1. lim v = lim u
[PROOF STEP]
show "lim v = lim u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lim v = lim u
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
v \<longlonglongrightarrow> lim u

goal (1 subgoal):
 1. lim v = lim u
[PROOF STEP]
by (simp add: limI)
[PROOF STATE]
proof (state)
this:
lim v = lim u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cis_inj:
  assumes "-pi < \<alpha>" and "\<alpha> \<le> pi" and "-pi < \<alpha>'" and "\<alpha>' \<le> pi"
  assumes "cis \<alpha> = cis \<alpha>'"
  shows "\<alpha> = \<alpha>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> = \<alpha>'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- pi < \<alpha>
\<alpha> \<le> pi
- pi < \<alpha>'
\<alpha>' \<le> pi
cis \<alpha> = cis \<alpha>'

goal (1 subgoal):
 1. \<alpha> = \<alpha>'
[PROOF STEP]
by (metis cis_Arg_unique sgn_cis)