[STATEMENT]
lemma asymp_equiv_inverse_iff [asymp_equiv_simps]:
  "(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<longleftrightarrow> f \<sim>[F] g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))) = (f \<sim>[F] g)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<Longrightarrow> f \<sim>[F] g
 2. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
assume "(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))"
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))

goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<Longrightarrow> f \<sim>[F] g
 2. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
hence "(\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))" (is ?P)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))

goal (1 subgoal):
 1. (\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))
[PROOF STEP]
by (rule asymp_equiv_inverse)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))

goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<Longrightarrow> f \<sim>[F] g
 2. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))

goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<Longrightarrow> f \<sim>[F] g
 2. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
have "?P \<longleftrightarrow> f \<sim>[F] g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))) = (f \<sim>[F] g)
[PROOF STEP]
by (intro asymp_equiv_cong) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (inverse (f x))) \<sim>[F] (\<lambda>x. inverse (inverse (g x)))) = (f \<sim>[F] g)

goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x)) \<Longrightarrow> f \<sim>[F] g
 2. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<sim>[F] g
[PROOF STEP]
show "f \<sim>[F] g"
[PROOF STATE]
proof (prove)
using this:
f \<sim>[F] g

goal (1 subgoal):
 1. f \<sim>[F] g
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f \<sim>[F] g

goal (1 subgoal):
 1. f \<sim>[F] g \<Longrightarrow> (\<lambda>x. inverse (f x)) \<sim>[F] (\<lambda>x. inverse (g x))
[PROOF STEP]
qed (simp_all add: asymp_equiv_inverse)


[STATEMENT]
lemma Inf2_inf: "\<Sqinter>{ f x | x. x \<in> {c, d}} = f c \<sqinter> f d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "{ f x | x. x \<in> {c, d}} = {f c, f d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f x |x::'b. x \<in> {c, d}} = {f c, f d}
variables:
c, d :: 'b
f :: 'b \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = {f c, f d}

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = {f c, f d}
[PROOF STEP]
have "\<Sqinter>{ f x | x. x \<in> {c, d}} = \<Sqinter>{f c, f d}"
[PROOF STATE]
proof (prove)
using this:
{(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = {f c, f d}

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = \<Sqinter> {f c, f d}
variables:
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = \<Sqinter> {f c, f d}

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = \<Sqinter> {f c, f d}

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
have "... = f c \<sqinter> f d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {f c, f d} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) (c::'b::type), f (d::'b::type)} = f c \<sqinter> f d

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = f c \<sqinter> f d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = f c \<sqinter> f d

goal (1 subgoal):
 1. \<Sqinter> {f x |x::'b. x \<in> {c, d}} = f c \<sqinter> f d
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Sqinter> {(f::'b::type \<Rightarrow> 'a::type) x |x::'b::type. x \<in> {c::'b::type, d::'b::type}} = f c \<sqinter> f d

goal:
No subgoals!
variables:
inf :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d :: 'b
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
qed


[STATEMENT]
lemma permutation_mat_left: assumes A: "A \<in> carrier_mat n nc" and p: "p permutes {..<n}"
  shows "permutation_mat n p * A = Matrix.mat n nc (\<lambda> (i,j). A $$ (inv p i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
assume ij: "i < n" "j < nc"
[PROOF STATE]
proof (state)
this:
i < n
j < nc

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
from p ij(1)
[PROOF STATE]
proof (chain)
picking this:
p permutes {..<n}
i < n
[PROOF STEP]
have i: "inv p i < n"
[PROOF STATE]
proof (prove)
using this:
p permutes {..<n}
i < n

goal (1 subgoal):
 1. inv p i < n
[PROOF STEP]
by (simp add: permutes_def)
[PROOF STATE]
proof (state)
this:
inv p i < n

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
have "(permutation_mat n p * A) $$ (i,j) = scalar_prod (unit_vec n (inv p i)) (col A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (permutation_mat n p * A) $$ (i, j) = unit_vec n (inv p i) \<bullet> col A j
[PROOF STEP]
by (subst index_mult_mat, insert ij A p, auto)
[PROOF STATE]
proof (state)
this:
(permutation_mat n p * A) $$ (i, j) = unit_vec n (inv p i) \<bullet> col A j

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(permutation_mat n p * A) $$ (i, j) = unit_vec n (inv p i) \<bullet> col A j

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
have "\<dots> = A $$ (inv p i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec n (inv p i) \<bullet> col A j = A $$ (inv p i, j)
[PROOF STEP]
by (subst scalar_prod_left_unit, insert A ij i, auto)
[PROOF STATE]
proof (state)
this:
unit_vec n (inv p i) \<bullet> col A j = A $$ (inv p i, j)

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
unit_vec n (inv p i) \<bullet> col A j = A $$ (inv p i, j)

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
note calculation
[PROOF STATE]
proof (state)
this:
(permutation_mat n p * A) $$ (i, j) = A $$ (inv p i, j)

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < n; ?j2 < nc\<rbrakk> \<Longrightarrow> (permutation_mat n p * A) $$ (?i2, ?j2) = A $$ (inv p ?i2, ?j2)

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < n; ?j2 < nc\<rbrakk> \<Longrightarrow> (permutation_mat n p * A) $$ (?i2, ?j2) = A $$ (inv p ?i2, ?j2)

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < n; ?j2 < nc\<rbrakk> \<Longrightarrow> (permutation_mat n p * A) $$ (?i2, ?j2) = A $$ (inv p ?i2, ?j2)
A \<in> carrier_mat n nc

goal (1 subgoal):
 1. permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
permutation_mat n p * A = Matrix.mat n nc (\<lambda>(i, j). A $$ (inv p i, j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equal_pair_count_eq_pairwise[rule_format]: "
  \<lbrakk> length ps1 = length ps2;
    \<forall>i<length ps2. equal_pair (ps1 ! i) = equal_pair(ps2 ! i) \<rbrakk>
  \<Longrightarrow> equal_pair_count ps1 = equal_pair_count ps2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length ps1 = length ps2; \<forall>i<length ps2. equal_pair (ps1 ! i) = equal_pair (ps2 ! i)\<rbrakk> \<Longrightarrow> equal_pair_count ps1 = equal_pair_count ps2
[PROOF STEP]
apply (induct rule: list_induct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i<length []. equal_pair ([] ! i) = equal_pair ([] ! i) \<Longrightarrow> equal_pair_count [] = equal_pair_count []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>i<length ys. equal_pair (xs ! i) = equal_pair (ys ! i) \<Longrightarrow> equal_pair_count xs = equal_pair_count ys; \<forall>i<length (y # ys). equal_pair ((x # xs) ! i) = equal_pair ((y # ys) ! i)\<rbrakk> \<Longrightarrow> equal_pair_count (x # xs) = equal_pair_count (y # ys)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>i<length ys. equal_pair (xs ! i) = equal_pair (ys ! i) \<Longrightarrow> equal_pair_count xs = equal_pair_count ys; \<forall>i<length (y # ys). equal_pair ((x # xs) ! i) = equal_pair ((y # ys) ! i)\<rbrakk> \<Longrightarrow> equal_pair_count (x # xs) = equal_pair_count (y # ys)
[PROOF STEP]
apply (fastforce simp add: equal_pair_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma floor_of_nat [simp]: "\<lfloor>of_nat n\<rfloor> = int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>of_nat n\<rfloor> = int n
[PROOF STEP]
using floor_of_int [of "of_nat n"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int (int n)\<rfloor> = int n

goal (1 subgoal):
 1. \<lfloor>of_nat n\<rfloor> = int n
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_segment_same_Im:
  assumes "Im a = Im b"
  shows   "closed_segment a b = {z. Im z = Im a \<and> Re z \<in> closed_segment (Re a) (Re b)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a b = {z. Im z = Im a \<and> Re z \<in> closed_segment (Re a) (Re b)}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x = Im a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x \<in> closed_segment (Re a) (Re b)
 3. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x = Im a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x \<in> closed_segment (Re a) (Re b)
 3. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
assume "z \<in> closed_segment a b"
[PROOF STATE]
proof (state)
this:
z \<in> closed_segment a b

goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x = Im a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x \<in> closed_segment (Re a) (Re b)
 3. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> closed_segment a b
[PROOF STEP]
obtain u where u: "u \<in> {0..1}" "z = a + of_real u * (b - a)"
[PROOF STATE]
proof (prove)
using this:
z \<in> closed_segment a b

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> {0..1}; z = a + complex_of_real u * (b - a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: closed_segment_def scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
u \<in> {0..1}
z = a + complex_of_real u * (b - a)

goal (3 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Im x = Im a
 2. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x \<in> closed_segment (Re a) (Re b)
 3. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Im a = Im b
[PROOF STEP]
show "Im z = Im a"
[PROOF STATE]
proof (prove)
using this:
Im a = Im b

goal (1 subgoal):
 1. Im z = Im a
[PROOF STEP]
by (auto simp: u)
[PROOF STATE]
proof (state)
this:
Im z = Im a

goal (2 subgoals):
 1. \<And>x. x \<in> closed_segment a b \<Longrightarrow> Re x \<in> closed_segment (Re a) (Re b)
 2. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from u(1)
[PROOF STATE]
proof (chain)
picking this:
u \<in> {0..1}
[PROOF STEP]
show "Re z \<in> closed_segment (Re a) (Re b)"
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}

goal (1 subgoal):
 1. Re z \<in> closed_segment (Re a) (Re b)
[PROOF STEP]
by (force simp: u closed_segment_def algebra_simps)
[PROOF STATE]
proof (state)
this:
Re z \<in> closed_segment (Re a) (Re b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
assume [simp]: "Im z = Im a" and "Re z \<in> closed_segment (Re a) (Re b)"
[PROOF STATE]
proof (state)
this:
Im z = Im a
Re z \<in> closed_segment (Re a) (Re b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im z = Im a
Re z \<in> closed_segment (Re a) (Re b)
[PROOF STEP]
obtain u where u: "u \<in> {0..1}" "Re z = Re a + of_real u * (Re b - Re a)"
[PROOF STATE]
proof (prove)
using this:
Im z = Im a
Re z \<in> closed_segment (Re a) (Re b)

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> {0..1}; Re z = Re a + of_real u * (Re b - Re a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: closed_segment_def scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
u \<in> {0..1}
Re z = Re a + of_real u * (Re b - Re a)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>Im x = Im a; Re x \<in> closed_segment (Re a) (Re b)\<rbrakk> \<Longrightarrow> x \<in> closed_segment a b
[PROOF STEP]
from u(1)
[PROOF STATE]
proof (chain)
picking this:
u \<in> {0..1}
[PROOF STEP]
show "z \<in> closed_segment a b"
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}

goal (1 subgoal):
 1. z \<in> closed_segment a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> {0..1}
Im a = Im b

goal (1 subgoal):
 1. z \<in> closed_segment a b
[PROOF STEP]
by (force simp: u closed_segment_def algebra_simps scaleR_conv_of_real complex_eq_iff)
[PROOF STATE]
proof (state)
this:
z \<in> closed_segment a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dual_Inf: "(Inf X) ^ o = (SUP x\<in> X . x ^ o)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> X ^ o = \<Squnion> (dual ` X)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Sqinter> X ^ o \<le> \<Squnion> (dual ` X)
 2. \<Squnion> (dual ` X) \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (subst dual_le, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Squnion> (dual ` X) ^ o \<le> \<Sqinter> X
 2. \<Squnion> (dual ` X) \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (rule Inf_greatest)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> \<Squnion> (dual ` X) ^ o \<le> x
 2. \<Squnion> (dual ` X) \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (subst dual_le, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> X \<Longrightarrow> x ^ o \<le> \<Squnion> (dual ` X)
 2. \<Squnion> (dual ` X) \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (rule SUP_upper, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (dual ` X) \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (rule SUP_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> x ^ o \<le> \<Sqinter> X ^ o
[PROOF STEP]
apply (subst dual_le, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> \<Sqinter> X \<le> x
[PROOF STEP]
by (rule Inf_lower, simp)


[STATEMENT]
lemma (in cring) binomial_expansion:
  fixes n :: nat
  assumes [simp]: "x \<in> carrier R" "y \<in> carrier R"
  shows "(x \<oplus> y) [^] n =
    (\<Oplus>k \<in> {..n}. int_embed R (n choose k) \<otimes> x [^] k \<otimes> y [^] (n-k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
define A where "A = (\<lambda>k. {A. A \<subseteq> {..<n} \<and> card A = k})"
[PROOF STATE]
proof (state)
this:
A = (\<lambda>k. {A. A \<subseteq> {..<n} \<and> card A = k})

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have fin_A: "finite (A i)" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (A i)
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {A. A \<subseteq> {..<n} \<and> card A = i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (A ?i)

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have disj_A: "pairwise (\<lambda>i j. disjnt (A i) (A j)) {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>i j. disjnt (A i) (A j)) {..n}
[PROOF STEP]
unfolding pairwise_def disjnt_def A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{..n}. \<forall>y\<in>{..n}. x \<noteq> y \<longrightarrow> {A. A \<subseteq> {..<n} \<and> card A = x} \<inter> {A. A \<subseteq> {..<n} \<and> card A = y} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pairwise (\<lambda>i j. disjnt (A i) (A j)) {..n}

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have card_A: "B \<in> A i \<Longrightarrow> card B = i" if " i \<in> {..n}" for i B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> A i \<Longrightarrow> card B = i
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> {A. A \<subseteq> {..<n} \<and> card A = i} \<Longrightarrow> card B = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<in> {..n}; ?B \<in> A ?i\<rbrakk> \<Longrightarrow> card ?B = ?i

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have card_A2: "card (A i) = (n choose i)" if "i \<in> {..n}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A i) = n choose i
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {A. A \<subseteq> {..<n} \<and> card A = i} = n choose i
[PROOF STEP]
using n_subsets[where A="{..<n}"]
[PROOF STATE]
proof (prove)
using this:
finite {..<n} \<Longrightarrow> card {B. B \<subseteq> {..<n} \<and> card B = ?k} = card {..<n} choose ?k

goal (1 subgoal):
 1. card {A. A \<subseteq> {..<n} \<and> card A = i} = n choose i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i \<in> {..n} \<Longrightarrow> card (A ?i) = n choose ?i

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have card_bound: "card A \<le> n"
    if "A \<subseteq> {..<n}" for n A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A \<le> n
[PROOF STEP]
by (metis card_lessThan finite_lessThan card_mono that)
[PROOF STATE]
proof (state)
this:
?A \<subseteq> {..<?n} \<Longrightarrow> card ?A \<le> ?n

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have card_insert: "card (insert n A) = card A + 1"
    if "A \<subseteq> {..<(n::nat)}" for n A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert n A) = card A + 1
[PROOF STEP]
using finite_subset that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
A \<subseteq> {..<n}

goal (1 subgoal):
 1. card (insert n A) = card A + 1
[PROOF STEP]
by (subst card_insert_disjoint, auto)
[PROOF STATE]
proof (state)
this:
?A \<subseteq> {..<?n} \<Longrightarrow> card (insert ?n ?A) = card ?A + 1

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have embed_distr: "[m] \<cdot> y = int_embed R (int m) \<otimes> y"
    if "y \<in> carrier R" for m y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [m] \<cdot> y = int_embed R (int m) \<otimes> y
[PROOF STEP]
unfolding int_embed_def add_pow_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y [^]\<^bsub>add_monoid R\<^esub> m = \<one> [^]\<^bsub>add_monoid R\<^esub> int m \<otimes> y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier R

goal (1 subgoal):
 1. y [^]\<^bsub>add_monoid R\<^esub> m = \<one> [^]\<^bsub>add_monoid R\<^esub> int m \<otimes> y
[PROOF STEP]
by (simp add:add_pow_def[symmetric] int_pow_int add_pow_ldistr)
[PROOF STATE]
proof (state)
this:
?y \<in> carrier R \<Longrightarrow> [?m] \<cdot> ?y = int_embed R (int ?m) \<otimes> ?y

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "(x \<oplus> y) [^] n =
    (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A))
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x \<oplus> y) [^] 0 = (\<Oplus>A\<in>Pow {..<0}. x [^] card A \<otimes> y [^] (0 - card A))
 2. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (x \<oplus> y) [^] 0 = (\<Oplus>A\<in>Pow {..<0}. x [^] card A \<otimes> y [^] (0 - card A))
 2. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] 0 = (\<Oplus>A\<in>Pow {..<0}. x [^] card A \<otimes> y [^] (0 - card A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] 0 = (\<Oplus>A\<in>Pow {..<0}. x [^] card A \<otimes> y [^] (0 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have s1:
      "insert n ` Pow {..<n} = {A. A \<subseteq> {..<n+1} \<and> n \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert n ` Pow {..<n} = {A. A \<subseteq> {..<n + 1} \<and> n \<in> A}
[PROOF STEP]
by (intro image_set_eqI[where g="\<lambda>x. x \<inter> {..<n}"], auto)
[PROOF STATE]
proof (state)
this:
insert n ` Pow {..<n} = {A. A \<subseteq> {..<n + 1} \<and> n \<in> A}

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have s2:
      "Pow {..<n} = {A. A \<subseteq> {..<n+1} \<and> n \<notin> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pow {..<n} = {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}
[PROOF STEP]
using lessThan_Suc
[PROOF STATE]
proof (prove)
using this:
{..<Suc ?k} = insert ?k {..<?k}

goal (1 subgoal):
 1. Pow {..<n} = {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Pow {..<n} = {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "(x \<oplus> y) [^] Suc n = (x \<oplus> y) [^] n \<otimes> (x \<oplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] Suc n = (x \<oplus> y) [^] n \<otimes> (x \<oplus> y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] Suc n = (x \<oplus> y) [^] n \<otimes> (x \<oplus> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] Suc n = (x \<oplus> y) [^] n \<otimes> (x \<oplus> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A)) \<otimes>
      (x \<oplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<oplus> y) [^] n \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y)
[PROOF STEP]
by (subst Suc, simp)
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A)) \<otimes> x \<oplus>
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A)) \<otimes> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y
[PROOF STEP]
by (subst r_distr, auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> (x \<oplus> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A) \<otimes> x) \<oplus>
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A) \<otimes> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y)
[PROOF STEP]
by (simp add:finsum_ldistr)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> x \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<otimes> y = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y)

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A+1) \<otimes> y [^] (n-card A)) \<oplus>
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n-card A+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1))
[PROOF STEP]
using m_assoc m_comm
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y = ?y \<otimes> ?x

goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1))
[PROOF STEP]
by (intro arg_cong2[where f="(\<oplus>)"] finsum_cong', auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> x) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A) \<otimes> y) = (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card (insert n A))
        \<otimes> y [^] (n+1-card (insert n A))) \<oplus>
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n+1-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1)) = (\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
using finite_subset card_bound card_insert Suc_diff_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
?A \<subseteq> {..<?n} \<Longrightarrow> card ?A \<le> ?n
?A \<subseteq> {..<?n} \<Longrightarrow> card (insert ?n ?A) = card ?A + 1
?n \<le> ?m \<Longrightarrow> Suc ?m - ?n = Suc (?m - ?n)

goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1)) = (\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
by (intro arg_cong2[where f="(\<oplus>)"] finsum_cong', simp_all)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1)) = (\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] (card A + 1) \<otimes> y [^] (n - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A + 1)) = (\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> insert n ` Pow {..<n}. x [^] (card A)
        \<otimes> y [^] (n+1-card A)) \<oplus>
      (\<Oplus>A \<in> Pow {..<n}. x [^] (card A) \<otimes> y [^] (n+1-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
by (subst finsum_reindex, auto simp add:inj_on_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card (insert n A) \<otimes> y [^] (n + 1 - card (insert n A))) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> {A. A \<subseteq> {..<n+1} \<and> n \<in> A}.
        x [^] (card A) \<otimes> y [^] (n+1-card A)) \<oplus>
      (\<Oplus>A \<in> {A. A \<subseteq> {..<n+1} \<and> n \<notin> A}.
        x [^] (card A) \<otimes> y [^] (n+1-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
by (intro arg_cong2[where f="(\<oplus>)"] finsum_cong' s1 s2, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>insert n ` Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... = (\<Oplus>A \<in>
      {A. A \<subseteq> {..<n+1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n+1} \<and> n \<notin> A}.
        x [^] (card A) \<otimes> y [^] (n+1-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
by (subst finsum_Un_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) \<oplus> (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
have "... =
      (\<Oplus>A \<in> Pow {..<n+1}. x [^] (card A) \<otimes> y [^] (n+1-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>Pow {..<n + 1}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
by (intro finsum_cong', auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>{A. A \<subseteq> {..<n + 1} \<and> n \<in> A} \<union> {A. A \<subseteq> {..<n + 1} \<and> n \<notin> A}. x [^] card A \<otimes> y [^] (n + 1 - card A)) = (\<Oplus>A\<in>Pow {..<n + 1}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. \<And>n. (x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) \<Longrightarrow> (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<n + 1}. x [^] card A \<otimes> y [^] (n + 1 - card A))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<n + 1}. x [^] card A \<otimes> y [^] (n + 1 - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] Suc n = (\<Oplus>A\<in>Pow {..<Suc n}. x [^] card A \<otimes> y [^] (Suc n - card A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n = (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "... =
    (\<Oplus>A \<in> (\<Union> (A ` {..n})). x [^] (card A) \<otimes> y [^] (n-card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A))
[PROOF STEP]
using card_bound
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> {..<?n} \<Longrightarrow> card ?A \<le> ?n

goal (1 subgoal):
 1. (\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A))
[PROOF STEP]
by (intro finsum_cong', auto simp add:A_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>Pow {..<n}. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "... =
    (\<Oplus> k \<in> {..n}. (\<Oplus> A \<in> A k. x [^] (card A) \<otimes> y [^] (n-card A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A))
[PROOF STEP]
using fin_A disj_A
[PROOF STATE]
proof (prove)
using this:
finite (A ?i)
pairwise (\<lambda>i j. disjnt (A i) (A j)) {..n}

goal (1 subgoal):
 1. (\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A))
[PROOF STEP]
by (subst add.finprod_UN_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>A\<in>\<Union> (A ` {..n}). x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "... = (\<Oplus> k \<in> {..n}. (\<Oplus> A \<in> A k. x [^] k \<otimes> y [^] (n-k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
using card_A
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<in> {..n}; ?B \<in> A ?i\<rbrakk> \<Longrightarrow> card ?B = ?i

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
by (intro finsum_cong', auto)
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] card A \<otimes> y [^] (n - card A)) = (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "... =
    (\<Oplus> k \<in> {..n}. int_embed R (card (A k)) \<otimes> x [^] k \<otimes> y [^] (n-k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
using int_embed_closed
[PROOF STATE]
proof (prove)
using this:
int_embed R ?k \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
by (subst add.finprod_const, simp_all add:embed_distr m_assoc)
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..n}. \<Oplus>A\<in>A k. x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
have "... =
    (\<Oplus> k \<in> {..n}. int_embed R (n choose k) \<otimes> x [^] k \<otimes> y [^] (n-k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
using int_embed_closed card_A2
[PROOF STATE]
proof (prove)
using this:
int_embed R ?k \<in> carrier R
?i \<in> {..n} \<Longrightarrow> card (A ?i) = n choose ?i

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
by (intro finsum_cong', simp_all)
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..n}. int_embed R (int (card (A k))) \<otimes> x [^] k \<otimes> y [^] (n - k)) = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))

goal (1 subgoal):
 1. (x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<oplus> y) [^] n = (\<Oplus>k\<in>{..n}. int_embed R (int (n choose k)) \<otimes> x [^] k \<otimes> y [^] (n - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicity_self:
  assumes "p \<noteq> 0" "\<not>is_unit p"
  shows   "multiplicity p p = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> (0::'a)
\<not> is_unit p
[PROOF STEP]
have "multiplicity p p = Max {n. p ^ n dvd p}"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> (0::'a)
\<not> is_unit p

goal (1 subgoal):
 1. multiplicity p p = Max {n. p ^ n dvd p}
[PROOF STEP]
by (simp add: multiplicity_eq_Max)
[PROOF STATE]
proof (state)
this:
multiplicity p p = Max {n. p ^ n dvd p}

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p p = Max {n. p ^ n dvd p}

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> (0::'a)
\<not> is_unit p
[PROOF STEP]
have "p ^ n dvd p \<longleftrightarrow> n \<le> 1" for n
[PROOF STATE]
proof (prove)
using this:
p \<noteq> (0::'a)
\<not> is_unit p

goal (1 subgoal):
 1. (p ^ n dvd p) = (n \<le> 1)
[PROOF STEP]
using dvd_power_iff[of p n 1]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> (0::'a)
\<not> is_unit p
p \<noteq> (0::'a) \<Longrightarrow> (p ^ n dvd p ^ 1) = (is_unit p \<or> n \<le> 1)

goal (1 subgoal):
 1. (p ^ n dvd p) = (n \<le> 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p ^ ?n1 dvd p) = (?n1 \<le> 1)

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
hence "{n. p ^ n dvd p} = {..1}"
[PROOF STATE]
proof (prove)
using this:
(p ^ ?n1 dvd p) = (?n1 \<le> 1)

goal (1 subgoal):
 1. {n. p ^ n dvd p} = {..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{n. p ^ n dvd p} = {..1}

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{n. p ^ n dvd p} = {..1}

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
have "\<dots> = {0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..1} = {0, 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..1} = {0, 1}

goal (1 subgoal):
 1. multiplicity p p = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p p = Max {0, 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p p = Max {0, 1}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cauchy_filter_metricI:
  fixes F :: "'a::metric_space filter"
  assumes "\<And>e. e>0 \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)"
  shows "cauchy_filter F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy_filter F
[PROOF STEP]
proof (unfold cauchy_filter_def le_filter_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
fix P :: "'a \<times> 'a \<Rightarrow> bool"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
assume "eventually P uniformity"
[PROOF STATE]
proof (state)
this:
eventually P uniformity

goal (1 subgoal):
 1. \<And>P. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P uniformity
[PROOF STEP]
obtain e where e: "e > 0" and P: "dist x y < e \<Longrightarrow> P (x, y)" for x y
[PROOF STATE]
proof (prove)
using this:
eventually P uniformity

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; \<And>x y. dist x y < e \<Longrightarrow> P (x, y)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_uniformity_metric
[PROOF STATE]
proof (prove)
using this:
\<exists>e>0. \<forall>x y. dist x y < e \<longrightarrow> P (x, y)

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; \<And>x y. dist x y < e \<Longrightarrow> P (x, y)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e
dist ?x ?y < e \<Longrightarrow> P (?x, ?y)

goal (1 subgoal):
 1. \<And>P. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
obtain P' where evP': "eventually P' F" and P'_dist: "P' x \<and> P' y \<Longrightarrow> dist x y < e" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P'. \<lbrakk>eventually P' F; \<And>x y. P' x \<and> P' y \<Longrightarrow> dist x y < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply atomize_elim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P'. eventually P' F \<and> (\<forall>x y. P' x \<and> P' y \<longrightarrow> dist x y < e)
[PROOF STEP]
using assms e
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < ?e)
0 < e

goal (1 subgoal):
 1. \<exists>P'. eventually P' F \<and> (\<forall>x y. P' x \<and> P' y \<longrightarrow> dist x y < e)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eventually P' F
P' ?x \<and> P' ?y \<Longrightarrow> dist ?x ?y < e

goal (1 subgoal):
 1. \<And>P. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
from evP' P'_dist P
[PROOF STATE]
proof (chain)
picking this:
eventually P' F
P' ?x \<and> P' ?y \<Longrightarrow> dist ?x ?y < e
dist ?x ?y < e \<Longrightarrow> P (?x, ?y)
[PROOF STEP]
show "eventually P (F \<times>\<^sub>F F)"
[PROOF STATE]
proof (prove)
using this:
eventually P' F
P' ?x \<and> P' ?y \<Longrightarrow> dist ?x ?y < e
dist ?x ?y < e \<Longrightarrow> P (?x, ?y)

goal (1 subgoal):
 1. eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
unfolding eventually_uniformity_metric eventually_prod_filter eventually_filtermap
[PROOF STATE]
proof (prove)
using this:
eventually P' F
P' ?x \<and> P' ?y \<Longrightarrow> dist ?x ?y < e
dist ?x ?y < e \<Longrightarrow> P (?x, ?y)

goal (1 subgoal):
 1. \<exists>Pf Pg. eventually Pf F \<and> eventually Pg F \<and> (\<forall>x y. Pf x \<longrightarrow> Pg y \<longrightarrow> P (x, y))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
eventually P (F \<times>\<^sub>F F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma weight_del_edge[simp]:
  assumes "(x,y)\<in>edges T"
  shows "weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x,y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
define E where "E = uedge ` edges T - {{x,y}}"
[PROOF STATE]
proof (state)
this:
E = uedge ` edges T - {{x, y}}

goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
have [simp]: "(uedge ` (edges T - {(x, y), (y, x)})) = E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uedge ` (edges T - {(x, y), (y, x)}) = E
[PROOF STEP]
by (safe; simp add: E_def uedge_def doubleton_eq_iff; blast)
[PROOF STATE]
proof (state)
this:
uedge ` (edges T - {(x, y), (y, x)}) = E

goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
(x, y) \<in> edges T
[PROOF STEP]
have [simp]: "uedge ` edges T = insert {x,y} E"
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> edges T

goal (1 subgoal):
 1. uedge ` edges T = insert {x, y} E
[PROOF STEP]
unfolding E_def
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> edges T

goal (1 subgoal):
 1. uedge ` edges T = insert {x, y} (uedge ` edges T - {{x, y}})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
uedge ` edges T = insert {x, y} E

goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
have [simp]: "{x,y}\<notin>E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} \<notin> E
[PROOF STEP]
unfolding E_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} \<notin> uedge ` edges T - {{x, y}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x, y} \<notin> E

goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x, y} \<notin> E
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x, y} \<notin> E

goal (1 subgoal):
 1. weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}
[PROOF STEP]
unfolding weight_alt
[PROOF STATE]
proof (prove)
using this:
{x, y} \<notin> E

goal (1 subgoal):
 1. sum w (uedge ` edges (restrict_edges T (- {(x, y), (y, x)}))) = sum w (uedge ` edges T) - w {x, y}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w E = sum w (insert {x, y} E) - w {x, y}
[PROOF STEP]
by (metis E_def \<open>uedge ` edges T = insert {x, y} E\<close> insertI1 sum_diff1_nat)
[PROOF STATE]
proof (state)
this:
weight w (restrict_edges T (- {(x, y), (y, x)})) = weight w T - w {x, y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_to_atom_as_intersection:
  assumes "As \<noteq> {}"
  assumes "As \<subseteq> Xs"
  assumes "S = \<Union> Xs"
  shows "subset_to_atom Xs As = \<Inter> As \<inter> (\<Inter> X \<in> Xs - As. S - X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_to_atom Xs As = \<Inter> As \<inter> \<Inter> ((-) S ` (Xs - As))
[PROOF STEP]
unfolding assms subset_to_atom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> As - \<Union> (Xs - As) = \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As))
[PROOF STEP]
apply(rule equalityI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> \<Inter> As - \<Union> (Xs - As) \<Longrightarrow> x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As))
 2. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<in> \<Inter> As - \<Union> (Xs - As)
[PROOF STEP]
apply(rule IntI, blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> \<Inter> As - \<Union> (Xs - As) \<Longrightarrow> x \<in> \<Inter> ((-) (\<Union> Xs) ` (Xs - As))
 2. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<in> \<Inter> As - \<Union> (Xs - As)
[PROOF STEP]
apply(rule InterI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x X. \<lbrakk>x \<in> \<Inter> As - \<Union> (Xs - As); X \<in> (-) (\<Union> Xs) ` (Xs - As)\<rbrakk> \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<in> \<Inter> As - \<Union> (Xs - As)
[PROOF STEP]
using INT_I assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> ?A \<Longrightarrow> ?b \<in> ?B x) \<Longrightarrow> ?b \<in> \<Inter> (?B ` ?A)
As \<noteq> {}
As \<subseteq> Xs

goal (2 subgoals):
 1. \<And>x X. \<lbrakk>x \<in> \<Inter> As - \<Union> (Xs - As); X \<in> (-) (\<Union> Xs) ` (Xs - As)\<rbrakk> \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<in> \<Inter> As - \<Union> (Xs - As)
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<in> \<Inter> As - \<Union> (Xs - As)
[PROOF STEP]
apply(rule DiffI, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Inter> As \<inter> \<Inter> ((-) (\<Union> Xs) ` (Xs - As)) \<Longrightarrow> x \<notin> \<Union> (Xs - As)
[PROOF STEP]
by blast


[STATEMENT]
lemma mset_le_single_iff[iff]: "{#x#} \<le> {#y#} \<longleftrightarrow> x \<le> y" for x y :: "'a::order"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#x#} \<le> {#y#}) = (x \<le> y)
[PROOF STEP]
unfolding less_eq_multiset\<^sub>H\<^sub>O
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>ya. count {#y#} ya < count {#x#} ya \<longrightarrow> (\<exists>xa>ya. count {#x#} xa < count {#y#} xa)) = (x \<le> y)
[PROOF STEP]
by force


[STATEMENT]
lemma  cross_add_left: "(x + y) \<times> z = (x \<times> z) + (y \<times> z)" for x::"real^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) \<times> z = x \<times> z + y \<times> z
[PROOF STEP]
by (simp add: cross3_simps)


[STATEMENT]
lemma vec_of_basis_enum_uminus:
  "vec_of_basis_enum (- b2) = - vec_of_basis_enum b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (- b2) = - vec_of_basis_enum b2
[PROOF STEP]
unfolding scaleC_minus1_left[symmetric, of b2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (- 1 *\<^sub>C b2) = - vec_of_basis_enum b2
[PROOF STEP]
unfolding scaleC_minus1_left_vec[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (- 1 *\<^sub>C b2) = - 1 \<cdot>\<^sub>v vec_of_basis_enum b2
[PROOF STEP]
by (rule vec_of_basis_enum_scaleC)


[STATEMENT]
lemma total_onD:
  "\<lbrakk> total_on A r; x \<in> A; y \<in> A \<rbrakk> \<Longrightarrow> (x, y) \<in> r \<or> x = y \<or> (y, x) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>total_on A r; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> (x, y) \<in> r \<or> x = y \<or> (y, x) \<in> r
[PROOF STEP]
unfolding total_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y\<in>A. x \<noteq> y \<longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> (x, y) \<in> r \<or> x = y \<or> (y, x) \<in> r
[PROOF STEP]
by blast


[STATEMENT]
lemma ex_bij_betw_nat_finite_2:
  assumes "card A = n"
    and "n > 0"
  shows "\<exists>f. bij_betw f A {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. bij_betw f A {..<n}
[PROOF STEP]
using assms ex_bij_betw_finite_nat[of A] atLeast0LessThan card_ge_0_finite
[PROOF STATE]
proof (prove)
using this:
card A = n
0 < n
finite A \<Longrightarrow> \<exists>h. bij_betw h A {0..<card A}
{0..<?n} = {..<?n}
0 < card ?A \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. \<exists>f. bij_betw f A {..<n}
[PROOF STEP]
by auto


[STATEMENT]
lemma integer_hull_mono: "P \<subseteq> Q \<Longrightarrow> integer_hull P \<subseteq> integer_hull Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<subseteq> Q \<Longrightarrow> integer_hull P \<subseteq> integer_hull Q
[PROOF STEP]
unfolding integer_hull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<subseteq> Q \<Longrightarrow> convex_hull (P \<inter> \<int>\<^sub>v) \<subseteq> convex_hull (Q \<inter> \<int>\<^sub>v)
[PROOF STEP]
by (intro convex_hull_mono, auto)


[STATEMENT]
lemma iMin_neq_imp_greater[dest]: "\<lbrakk> k \<in> I; k \<noteq> iMin I \<rbrakk> \<Longrightarrow> iMin I < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; k \<noteq> iMin I\<rbrakk> \<Longrightarrow> iMin I < k
[PROOF STEP]
by (rule order_neq_le_trans[OF not_sym iMin_le])


[STATEMENT]
lemma icard_psubset: "\<lbrakk> A \<subseteq> B; icard A < icard B \<rbrakk> \<Longrightarrow> A \<subset> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; icard A < icard B\<rbrakk> \<Longrightarrow> A \<subset> B
[PROOF STEP]
by (metis less_le psubset_eq)


[STATEMENT]
lemma continuous_add [continuous_intros]:
  fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_add"
  shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x + g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x + g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; (g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) + g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_add)


[STATEMENT]
lemma abs_majoritiesE':
  assumes Smaj: "card S > (card E) div 2" and Tmaj: "card T > (card E) div 2"
      and s: "S \<subseteq> E" and t: "T \<subseteq> E" and e: "finite E"
  obtains p where "p \<in> S" and "p \<in> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule abs_majoritiesE[OF _ s t e])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>p. \<lbrakk>p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> card E < card S + card T
 2. \<And>p. \<lbrakk>\<And>p. \<lbrakk>p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis; p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from Smaj Tmaj
[PROOF STATE]
proof (chain)
picking this:
card E div 2 < card S
card E div 2 < card T
[PROOF STEP]
show "card E < card S + card T"
[PROOF STATE]
proof (prove)
using this:
card E div 2 < card S
card E div 2 < card T

goal (1 subgoal):
 1. card E < card S + card T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card E < card S + card T

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>p. \<lbrakk>p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis; p \<in> S; p \<in> T\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed


[STATEMENT]
lemma primes_omega_1 [simp]: "primes_omega 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_omega 1 = 0
[PROOF STEP]
by (simp add: primes_omega_def)


[STATEMENT]
lemma frac_eq_0_iff [simp]: "frac x = 0 \<longleftrightarrow> x \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (frac x = (0::'a)) = (x \<in> \<int>)
[PROOF STEP]
by (simp add: frac_def) (metis Ints_cases Ints_of_int floor_of_int )


[STATEMENT]
lemma finite_atLeastLessThan_integer [iff]: "finite {l..<u::integer}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {l..<u}
[PROOF STEP]
apply (subgoal_tac "(%x. x + l) ` {0..<u-l} = {l..<u}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u} \<Longrightarrow> finite {l..<u}
 2. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u}
[PROOF STEP]
apply (erule subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite ((\<lambda>x. x + l) ` {0..<u - l})
 2. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u}
[PROOF STEP]
apply (rule finite_imageI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {0..<u - l}
 2. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u}
[PROOF STEP]
apply (rule finite_atLeastZeroLessThan_integer)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x + l) ` {0..<u - l} = {l..<u}
[PROOF STEP]
apply (rule image_add_integer_atLeastLessThan)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_on_topological:
  "continuous_on s f \<longleftrightarrow>
    (\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s f = (\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))
[PROOF STEP]
unfolding continuous_on_def tendsto_def eventually_at_topological
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s. \<forall>S. open S \<longrightarrow> f x \<in> S \<longrightarrow> (\<exists>Sa. open Sa \<and> x \<in> Sa \<and> (\<forall>xa\<in>Sa. xa \<noteq> x \<longrightarrow> xa \<in> s \<longrightarrow> f xa \<in> S))) = (\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))
[PROOF STEP]
by metis


[STATEMENT]
lemma (in prob_space) exponential_distributed_min:
  assumes "0 < l" "0 < u"
  assumes expX: "distributed M lborel X (exponential_density l)"
  assumes expY: "distributed M lborel Y (exponential_density u)"
  assumes ind: "indep_var borel X borel Y"
  shows "distributed M lborel (\<lambda>x. min (X x) (Y x)) (exponential_density (l + u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. min (X x) (Y x)) (\<lambda>x. ennreal (exponential_density (l + u) x))
[PROOF STEP]
proof (subst exponential_distributed_iff, safe)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < l + u
 2. random_variable borel (\<lambda>x. min (X x) (Y x))
 3. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have randX: "random_variable borel X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel X
[PROOF STEP]
using expX \<open>0 < l\<close>
[PROOF STATE]
proof (prove)
using this:
distributed M lborel X (\<lambda>x. ennreal (exponential_density l x))
0 < l

goal (1 subgoal):
 1. random_variable borel X
[PROOF STEP]
by (simp add: exponential_distributed_iff)
[PROOF STATE]
proof (state)
this:
random_variable borel X

goal (3 subgoals):
 1. 0 < l + u
 2. random_variable borel (\<lambda>x. min (X x) (Y x))
 3. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
random_variable borel X

goal (3 subgoals):
 1. 0 < l + u
 2. random_variable borel (\<lambda>x. min (X x) (Y x))
 3. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have randY: "random_variable borel Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel Y
[PROOF STEP]
using expY \<open>0 < u\<close>
[PROOF STATE]
proof (prove)
using this:
distributed M lborel Y (\<lambda>x. ennreal (exponential_density u x))
0 < u

goal (1 subgoal):
 1. random_variable borel Y
[PROOF STEP]
by (simp add: exponential_distributed_iff)
[PROOF STATE]
proof (state)
this:
random_variable borel Y

goal (3 subgoals):
 1. 0 < l + u
 2. random_variable borel (\<lambda>x. min (X x) (Y x))
 3. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
random_variable borel X
random_variable borel Y
[PROOF STEP]
show "random_variable borel (\<lambda>x. min (X x) (Y x))"
[PROOF STATE]
proof (prove)
using this:
random_variable borel X
random_variable borel Y

goal (1 subgoal):
 1. random_variable borel (\<lambda>x. min (X x) (Y x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
random_variable borel (\<lambda>x. min (X x) (Y x))

goal (2 subgoals):
 1. 0 < l + u
 2. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
show " 0 < l + u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < l + u
[PROOF STEP]
using \<open>0 < l\<close> \<open>0 < u\<close>
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < u

goal (1 subgoal):
 1. 0 < l + u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < l + u

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
fix a::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
assume a[arith]: "0 \<le> a"
[PROOF STATE]
proof (state)
this:
0 \<le> a

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have gt1[simp]: "\<P>(x in M. a < X x ) = exp (- a * l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = exp (- a * l)
[PROOF STEP]
by (rule exponential_distributedD_gt[OF expX a]) fact
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < X x} = exp (- a * l)

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have gt2[simp]: "\<P>(x in M. a < Y x ) = exp (- a * u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < Y x} = exp (- a * u)
[PROOF STEP]
by (rule exponential_distributedD_gt[OF expY a]) fact
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < Y x} = exp (- a * u)

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have "\<P>(x in M. a < (min (X x) (Y x)) ) =  \<P>(x in M. a < (X x) \<and> a < (Y x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. a < X x \<and> a < Y x}
[PROOF STEP]
by (auto intro!:arg_cong[where f=prob])
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. a < X x \<and> a < Y x}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. a < X x \<and> a < Y x}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have " ... =  \<P>(x in M. a < (X x)) *  \<P>(x in M. a< (Y x) )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < X x \<and> a < Y x} = prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x}
[PROOF STEP]
using prob_indep_random_variable[OF ind, of "{a <..}" "{a <..}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{a<..} \<in> sets borel; {a<..} \<in> sets borel\<rbrakk> \<Longrightarrow> prob {x \<in> space M. X x \<in> {a<..} \<and> Y x \<in> {a<..}} = prob {x \<in> space M. X x \<in> {a<..}} * prob {x \<in> space M. Y x \<in> {a<..}}

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x \<and> a < Y x} = prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < X x \<and> a < Y x} = prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < X x \<and> a < Y x} = prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have " ... = exp (- a * (l + u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x} = exp (- a * (l + u))
[PROOF STEP]
by (auto simp:field_simps mult_exp_exp)
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < X x} * prob {x \<in> space M. a < Y x} = exp (- a * (l + u))

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {x \<in> space M. a < min (X x) (Y x)} = exp (- a * (l + u))
[PROOF STEP]
have indep_prob: "\<P>(x in M. a < (min (X x) (Y x)) ) = exp (- a * (l + u))"
[PROOF STATE]
proof (prove)
using this:
prob {x \<in> space M. a < min (X x) (Y x)} = exp (- a * (l + u))

goal (1 subgoal):
 1. prob {x \<in> space M. a < min (X x) (Y x)} = exp (- a * (l + u))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < min (X x) (Y x)} = exp (- a * (l + u))

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
have "{x \<in> space M. (min (X x) (Y x)) \<le>a } = (space M - {x \<in> space M. a<(min (X x) (Y x)) })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. min (X x) (Y x) \<le> a} = space M - {x \<in> space M. a < min (X x) (Y x)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. min (X x) (Y x) \<le> a} = space M - {x \<in> space M. a < min (X x) (Y x)}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x \<in> space M. min (X x) (Y x) \<le> a} = space M - {x \<in> space M. a < min (X x) (Y x)}
[PROOF STEP]
have "1 - prob {x \<in> space M. a < (min (X x) (Y x))} = prob {x \<in> space M. (min (X x) (Y x)) \<le> a}"
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. min (X x) (Y x) \<le> a} = space M - {x \<in> space M. a < min (X x) (Y x)}

goal (1 subgoal):
 1. 1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}
[PROOF STEP]
using randX randY
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. min (X x) (Y x) \<le> a} = space M - {x \<in> space M. a < min (X x) (Y x)}
random_variable borel X
random_variable borel Y

goal (1 subgoal):
 1. 1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}
[PROOF STEP]
by (auto simp: prob_compl)
[PROOF STATE]
proof (state)
this:
1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<Longrightarrow> prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}
[PROOF STEP]
show "prob {x \<in> space M. (min (X x) (Y x)) \<le> a} = 1 - exp (- a * (l + u))"
[PROOF STATE]
proof (prove)
using this:
1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}

goal (1 subgoal):
 1. prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
using indep_prob
[PROOF STATE]
proof (prove)
using this:
1 - prob {x \<in> space M. a < min (X x) (Y x)} = prob {x \<in> space M. min (X x) (Y x) \<le> a}
prob {x \<in> space M. a < min (X x) (Y x)} = exp (- a * (l + u))

goal (1 subgoal):
 1. prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. min (X x) (Y x) \<le> a} = 1 - exp (- a * (l + u))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_arcosh:
  "continuous F f \<Longrightarrow> f (Lim F (\<lambda>x. x)) > 1 \<Longrightarrow> continuous F (\<lambda>x. arcosh (f x :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; 1 < f (Lim F (\<lambda>x. x))\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. arcosh (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; 1 < f (Lim F (\<lambda>x. x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. arcosh (f x)) \<longlongrightarrow> arcosh (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_arcosh) auto


[STATEMENT]
lemma icard_cartesian_product_singleton: "icard ({x} \<times> A) = icard A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard ({x} \<times> A) = icard A
[PROOF STEP]
by (simp add: icard_cartesian_product mult_eSuc)


[STATEMENT]
lemma isCont_norm [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. norm (f x)) a"
  for f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f a \<Longrightarrow> isCont (\<lambda>x. norm (f x)) a
[PROOF STEP]
by (fact continuous_norm)


[STATEMENT]
lemma union_Bag [code]: "Bag xs + Bag ys = Bag (join (\<lambda>x (n1, n2). n1 + n2) xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bag xs + Bag ys = Bag (join (\<lambda>x (n1, n2). n1 + n2) xs ys)
[PROOF STEP]
by (rule multiset_eqI)
    (simp add: count_of_join_raw alist.Alist_inverse distinct_join_raw join_def)


[STATEMENT]
lemma strongly_confluent_on_E11:
  "strongly_confluent_on r A \<Longrightarrow> x \<in> A \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> (x, z) \<in> r \<Longrightarrow>
    \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>="
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>strongly_confluent_on r A; x \<in> A; (x, y) \<in> r; (x, z) \<in> r\<rbrakk> \<Longrightarrow> \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=
[PROOF STEP]
unfolding strongly_confluent_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y z. (x, y) \<in> r \<and> (x, z) \<in> r \<longrightarrow> (\<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=); x \<in> A; (x, y) \<in> r; (x, z) \<in> r\<rbrakk> \<Longrightarrow> \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=
[PROOF STEP]
by blast


[STATEMENT]
lemma quat_inverse_eq_cnj: "norm q = 1 \<Longrightarrow> inverse q = cnj q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm q = 1 \<Longrightarrow> inverse q = Quaternions.cnj q
[PROOF STEP]
by (metis inverse_1 mult_cancel_left norm_eq_zero norm_one cnj_one quat_norm_pow_2 right_inverse)


[STATEMENT]
lemma multiset_problem_of_cnf_mul_ext:
  assumes "multiset_problem_of_cnf cnf = (xs, ys, S, NS)"
  and non_trivial: "cnf \<noteq> []"
  shows "(\<exists> \<beta>. eval_cnf \<beta> cnf)
     \<longleftrightarrow> mul_ext (\<lambda> a b. ((a,b) \<in> set S, (a,b) \<in> set NS)) xs ys = (True,True)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
have "(\<exists> \<beta>. eval_cnf \<beta> cnf) = ((\<exists> \<beta>. eval_cnf \<beta> cnf) \<and> (\<exists> \<beta>. eval_cnf \<beta> cnf))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = ((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<exists>\<beta>. eval_cnf \<beta> cnf) = ((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>\<beta>. eval_cnf \<beta> cnf) = ((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
have "\<dots> = (((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S)) \<and> ((mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf)) = ((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S))
[PROOF STEP]
by (subst multiset_problem_of_cnf(1)[symmetric, OF assms(1)], subst multiset_problem_of_cnf(2)[symmetric, OF assms], simp)
[PROOF STATE]
proof (state)
this:
((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf)) = ((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<exists>\<beta>. eval_cnf \<beta> cnf) \<and> (\<exists>\<beta>. eval_cnf \<beta> cnf)) = ((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
have "\<dots> = (mul_ext (\<lambda> a b. ((a,b) \<in> set S, (a,b) \<in> set NS)) xs ys = (True,True))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S)) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
unfolding mul_ext_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S)) = (((mset xs, mset ys) \<in> s_mul_ext {(x, y). snd ((x, y) \<in> set S, (x, y) \<in> set NS)} {(x, y). fst ((x, y) \<in> set S, (x, y) \<in> set NS)}, (mset xs, mset ys) \<in> ns_mul_ext {(x, y). snd ((x, y) \<in> set S, (x, y) \<in> set NS)} {(x, y). fst ((x, y) \<in> set S, (x, y) \<in> set NS)}) = (True, True))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((mset xs, mset ys) \<in> s_mul_ext (set NS) (set S) \<and> (mset xs, mset ys) \<in> ns_mul_ext (set NS) (set S)) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))

goal (1 subgoal):
 1. (\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<exists>\<beta>. eval_cnf \<beta> cnf) = (mul_ext (\<lambda>a b. ((a, b) \<in> set S, (a, b) \<in> set NS)) xs ys = (True, True))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma double_sum_mult_hom:
  fixes k :: "'b :: {comm_ring_1}"
  shows "(\<Sum> i \<in> A . (\<Sum> j \<in> g i . k * (f i j))) = k* (\<Sum> i \<in> A . (\<Sum> j \<in> g i . f i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>A. \<Sum>j\<in>g i. k * f i j) = k * (\<Sum>i\<in>A. sum (f i) (g i))
[PROOF STEP]
by (metis (mono_tags, lifting) comm_monoid_add_class.sum.cong sum_distrib_left)


[STATEMENT]
lemma pseudo_mod_smult_right:
  assumes "(x::'a::idom)\<noteq>0" "q\<noteq>0"
  shows "(pseudo_mod p (smult (x::'a::idom) q)) = (smult (x^(Suc (length (coeffs p)) - length (coeffs q))) (pseudo_mod p q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pseudo_mod p (Polynomial.smult x q) = Polynomial.smult (x ^ (Suc (length (coeffs p)) - length (coeffs q))) (pseudo_mod p q)
[PROOF STEP]
unfolding pseudo_divmod_def pseudo_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if Polynomial.smult x q = 0 then (0, p) else pseudo_divmod_main (lead_coeff (Polynomial.smult x q)) 0 p (Polynomial.smult x q) (degree p) (1 + length (coeffs p) - length (coeffs (Polynomial.smult x q)))) = Polynomial.smult (x ^ (Suc (length (coeffs p)) - length (coeffs q))) (snd (if q = 0 then (0, p) else pseudo_divmod_main (lead_coeff q) 0 p q (degree p) (1 + length (coeffs p) - length (coeffs q))))
[PROOF STEP]
by (auto simp:snd_pseudo_mod_smult_invar_right[of _ _ _ _ _ _ _ 0]
                  snd_pseudo_mod_smult_invar_left[of _ _ _ _ _ _ _ 0] Polynomial.coeffs_smult assms)


[STATEMENT]
lemma recursion: "mono (f :: 'a \<Rightarrow> 'a :: domain_boolean_quantale) \<Longrightarrow>
  (\<And>x. d p \<le> |x] d q \<Longrightarrow> d p \<le> |f x] d q) \<Longrightarrow>  d p \<le> |lfp f] d q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; \<And>x. d p \<le>  |x] d q \<Longrightarrow> d p \<le>  |f x] d q\<rbrakk> \<Longrightarrow> d p \<le>  |lfp f] d q
[PROOF STEP]
apply (erule lfp_ordinal_induct [where f=f], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M. \<lbrakk>\<And>x. d p \<le>  |x] d q \<Longrightarrow> d p \<le>  |f x] d q; \<forall>S\<in>M. d p \<le>  |S] d q\<rbrakk> \<Longrightarrow> d p \<le>  |Sup M] d q
[PROOF STEP]
by (auto simp: ad.addual.ardual.fbox_demodalisation3 Sup_distr Sup_distl intro: Sup_mono)


[STATEMENT]
theorem B_trusts_NS3:
     "\<lbrakk>Says B A  (Crypt (pubEK A) \<lbrace>Nonce NA, Nonce NB, Agent B\<rbrace>) \<in> set evs;
       Says A' B (Crypt (pubEK B) (Nonce NB)) \<in> set evs;
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_public\<rbrakk>
      \<Longrightarrow> Says A B (Crypt (pubEK B) (Nonce NB)) \<in> set evs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Says B A (Crypt (pubK A) \<lbrace>Nonce NA, Nonce NB, Agent B\<rbrace>) \<in> set evs; Says A' B (Crypt (pubK B) (Nonce NB)) \<in> set evs; A \<notin> bad; B \<notin> bad; evs \<in> ns_public\<rbrakk> \<Longrightarrow> Says A B (Crypt (pubK B) (Nonce NB)) \<in> set evs
[PROOF STEP]
by (blast intro: B_trusts_NS3_lemma)


[STATEMENT]
theorem Euler: "exp(z) = of_real(exp(Re z)) *
              (of_real(cos(Im z)) + \<i> * of_real(sin(Im z)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp z = complex_of_real (exp (Re z)) * (complex_of_real (cos (Im z)) + \<i> * complex_of_real (sin (Im z)))
[PROOF STEP]
by (cases z) (simp add: exp_add exp_Euler cos_of_real exp_of_real sin_of_real Complex_eq)


[STATEMENT]
lemma log_base_10_eq1: "0 < x \<Longrightarrow> log 10 x = (ln (exp 1) / ln 10) * ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> log 10 x = ln (exp 1) / ln 10 * ln x
[PROOF STEP]
by (simp add: log_def)