[STATEMENT]
lemma bij_betw_quotient_domain_and_range_permutation_eq:
  assumes "finite A" "finite B"
  assumes "card A = card B"
  shows "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
 2. {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
show "{{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
    \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
using bijections_in_domain_and_range_permutation[OF assms]
[PROOF STATE]
proof (prove)
using this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B

goal (1 subgoal):
 1. {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
show "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
fix F
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
assume F_in: "F \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B"
[PROOF STATE]
proof (state)
this:
F \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
have "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> ((A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B). univ (\<lambda>f. bij_betw f A B) F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. bij_betw f A B) F}
[PROOF STEP]
using equiv_domain_and_range_permutation[of A B] bij_betw_respects_domain_and_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
equiv (A \<rightarrow>\<^sub>E B) (domain_and_range_permutation A B)
(\<lambda>f. bij_betw f A B) respects domain_and_range_permutation A B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. bij_betw f A B) F}
[PROOF STEP]
by (simp only: univ_preserves_predicate)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. bij_betw f A B) F}

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
from F_in this
[PROOF STATE]
proof (chain)
picking this:
F \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. bij_betw f A B) F}
[PROOF STEP]
have "F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B"
      and "univ (\<lambda>f. bij_betw f A B) F"
[PROOF STATE]
proof (prove)
using this:
F \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. bij_betw f A B) F}

goal (1 subgoal):
 1. F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B &&& univ (\<lambda>f. bij_betw f A B) F
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
univ (\<lambda>f. bij_betw f A B) F

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
have "F = {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
 2. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
have "\<forall>f \<in> F. f \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
using \<open>F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B\<close>
[PROOF STATE]
proof (prove)
using this:
F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. \<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
by (metis ImageE equiv_class_eq_iff equiv_domain_and_range_permutation quotientE)
[PROOF STATE]
proof (state)
this:
\<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B

goal (2 subgoals):
 1. F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
 2. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B

goal (2 subgoals):
 1. F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
 2. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
have "\<forall>f \<in> F. bij_betw f A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f\<in>F. bij_betw f A B
[PROOF STEP]
using univ_predicate_impl_forall[OF equiv_domain_and_range_permutation bij_betw_respects_domain_and_range_permutation]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?X \<in> (?A1 \<rightarrow>\<^sub>E ?B1) // domain_and_range_permutation ?A1 ?B1; univ (\<lambda>f. bij_betw f ?A1 ?B1) ?X\<rbrakk> \<Longrightarrow> \<forall>x\<in>?X. bij_betw x ?A1 ?B1

goal (1 subgoal):
 1. \<forall>f\<in>F. bij_betw f A B
[PROOF STEP]
using \<open>F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B\<close> \<open>univ (\<lambda>f. bij_betw f A B) F\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?X \<in> (?A1 \<rightarrow>\<^sub>E ?B1) // domain_and_range_permutation ?A1 ?B1; univ (\<lambda>f. bij_betw f ?A1 ?B1) ?X\<rbrakk> \<Longrightarrow> \<forall>x\<in>?X. bij_betw x ?A1 ?B1
F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
univ (\<lambda>f. bij_betw f A B) F

goal (1 subgoal):
 1. \<forall>f\<in>F. bij_betw f A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f\<in>F. bij_betw f A B

goal (2 subgoals):
 1. F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
 2. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B
\<forall>f\<in>F. bij_betw f A B
[PROOF STEP]
show "F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
using this:
\<forall>f\<in>F. f \<in> A \<rightarrow>\<^sub>E B
\<forall>f\<in>F. bij_betw f A B

goal (1 subgoal):
 1. F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
show "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
fix f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
assume "f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (state)
this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "f' \<in> A \<rightarrow>\<^sub>E B" "bij_betw f' A B"
[PROOF STATE]
proof (prove)
using this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B &&& bij_betw f' A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> A \<rightarrow>\<^sub>E B
bij_betw f' A B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
obtain f where "f \<in> A \<rightarrow>\<^sub>E B" and "F = domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A \<rightarrow>\<^sub>E B; F = domain_and_range_permutation A B `` {f}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B\<close>
[PROOF STATE]
proof (prove)
using this:
F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A \<rightarrow>\<^sub>E B; F = domain_and_range_permutation A B `` {f}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: quotientE)
[PROOF STATE]
proof (state)
this:
f \<in> A \<rightarrow>\<^sub>E B
F = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
have "bij_betw f A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f A B
[PROOF STEP]
using univ_commute'[OF equiv_domain_and_range_permutation bij_betw_respects_domain_and_range_permutation]
[PROOF STATE]
proof (prove)
using this:
?x \<in> ?A1 \<rightarrow>\<^sub>E ?B1 \<Longrightarrow> univ (\<lambda>f. bij_betw f ?A1 ?B1) (domain_and_range_permutation ?A1 ?B1 `` {?x}) = bij_betw ?x ?A1 ?B1

goal (1 subgoal):
 1. bij_betw f A B
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>F = domain_and_range_permutation A B `` {f}\<close> \<open>univ (\<lambda>f. bij_betw f A B) F\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<in> ?A1 \<rightarrow>\<^sub>E ?B1 \<Longrightarrow> univ (\<lambda>f. bij_betw f ?A1 ?B1) (domain_and_range_permutation ?A1 ?B1 `` {?x}) = bij_betw ?x ?A1 ?B1
f \<in> A \<rightarrow>\<^sub>E B
F = domain_and_range_permutation A B `` {f}
univ (\<lambda>f. bij_betw f A B) F

goal (1 subgoal):
 1. bij_betw f A B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw f A B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
obtain p where "p permutes A" "\<forall>x\<in>A. f x = f' (p x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p permutes A; \<forall>x\<in>A. f x = f' (p x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using obtain_domain_permutation_for_two_bijections
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bij_betw ?f ?A ?B; bij_betw ?f' ?A ?B; \<And>p. \<lbrakk>p permutes ?A; \<forall>a\<in>?A. ?f a = ?f' (p a)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p permutes A; \<forall>x\<in>A. f x = f' (p x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>bij_betw f A B\<close> \<open>bij_betw f' A B\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bij_betw ?f ?A ?B; bij_betw ?f' ?A ?B; \<And>p. \<lbrakk>p permutes ?A; \<forall>a\<in>?A. ?f a = ?f' (p a)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
bij_betw f A B
bij_betw f' A B

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p permutes A; \<forall>x\<in>A. f x = f' (p x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p permutes A
\<forall>x\<in>A. f x = f' (p x)

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p permutes A
\<forall>x\<in>A. f x = f' (p x)

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
have "id permutes B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id permutes B
[PROOF STEP]
by (simp add: permutes_id)
[PROOF STATE]
proof (state)
this:
id permutes B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
id permutes B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
note \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (state)
this:
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p permutes A
\<forall>x\<in>A. f x = f' (p x)
id permutes B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
have "(f, f') \<in> domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
using this:
p permutes A
\<forall>x\<in>A. f x = f' (p x)
id permutes B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. (f, f') \<in> domain_and_range_permutation A B
[PROOF STEP]
unfolding domain_and_range_permutation_def id_def
[PROOF STATE]
proof (prove)
using this:
p permutes A
\<forall>x\<in>A. f x = f' (p x)
(\<lambda>x. x) permutes B
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. (f, f') \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> x \<in> F
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(f, f') \<in> domain_and_range_permutation A B
[PROOF STEP]
show "f' \<in> F"
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. f' \<in> F
[PROOF STEP]
using \<open>F = domain_and_range_permutation A B `` {f}\<close>
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> domain_and_range_permutation A B
F = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. f' \<in> F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f' \<in> F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
F = {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. \<And>x. x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<Longrightarrow> x \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
F = {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
show "F \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}"
[PROOF STATE]
proof (prove)
using this:
F = {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. F \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
F \<in> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B \<subseteq> {{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_rel_id[relator_props]: "\<lbrakk>R1=Id; R2=Id\<rbrakk> \<Longrightarrow> \<langle>R1,R2\<rangle>prod_rel = Id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R1 = Id; R2 = Id\<rbrakk> \<Longrightarrow> R1 \<times>\<^sub>r R2 = Id
[PROOF STEP]
by (auto simp: prod_rel_def)


[STATEMENT]
lemma valid_index_list_all2_iff: "is \<lhd> ds \<longleftrightarrow> list_all2 (<) is ds"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (is \<lhd> ds) = list_all2 (<) is ds
[PROOF STEP]
by (metis list_all2_conv_all_nth list_all2_nthD valid_indexI valid_index_length valid_index_lt)


[STATEMENT]
lemma upper_triangular_snd_QR_decomposition:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "upper_triangular (snd (QR_decomposition A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (snd (QR_decomposition A))
[PROOF STEP]
proof (unfold upper_triangular_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
fix i j::'n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
assume j_less_i: "j < i"
[PROOF STATE]
proof (state)
this:
j < i

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
have "snd (QR_decomposition A) $ i $ j = column i (fst (QR_decomposition A)) \<bullet> column j A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (QR_decomposition A) $ i $ j = column i (fst (QR_decomposition A)) \<bullet> column j A
[PROOF STEP]
unfolding QR_decomposition_def Let_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose (divide_by_norm (Gram_Schmidt_matrix A)) ** A) $ i $ j = column i (divide_by_norm (Gram_Schmidt_matrix A)) \<bullet> column j A
[PROOF STEP]
unfolding matrix_matrix_mult_inner_mult row_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (divide_by_norm (Gram_Schmidt_matrix A)) \<bullet> column j A = column i (divide_by_norm (Gram_Schmidt_matrix A)) \<bullet> column j A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
snd (QR_decomposition A) $ i $ j = column i (fst (QR_decomposition A)) \<bullet> column j A

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
snd (QR_decomposition A) $ i $ j = column i (fst (QR_decomposition A)) \<bullet> column j A

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
using scaler_column_fst_QR_decomposition[OF j_less_i r]
[PROOF STATE]
proof (prove)
using this:
column i (fst (QR_decomposition A)) \<bullet> column j A = 0

goal (1 subgoal):
 1. column i (fst (QR_decomposition A)) \<bullet> column j A = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column i (fst (QR_decomposition A)) \<bullet> column j A = 0

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
show "snd (QR_decomposition A) $ i $ j = 0"
[PROOF STATE]
proof (prove)
using this:
snd (QR_decomposition A) $ i $ j = 0

goal (1 subgoal):
 1. snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd (QR_decomposition A) $ i $ j = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_isolated_verts_iso[simp]:
    "card (iso_verts hom ` pre_digraph.isolated_verts G) = card isolated_verts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (iso_verts hom ` isolated_verts) = card isolated_verts
[PROOF STEP]
apply (rule card_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (iso_verts hom) isolated_verts
[PROOF STEP]
using hom
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom

goal (1 subgoal):
 1. inj_on (iso_verts hom) isolated_verts
[PROOF STEP]
apply (rule digraph_isomorphism_inj_on_verts[THEN subset_inj_on])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isolated_verts \<subseteq> verts G
[PROOF STEP]
apply (auto simp: isolated_verts_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma infin_imp_iNextStrong_eq_iNextWeak: "\<lbrakk> infinite I; t0 \<in> I \<rbrakk> \<Longrightarrow> (\<circle>\<^sub>S t t0 I. P t) = (\<circle>\<^sub>W t t0 I. P t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite I; t0 \<in> I\<rbrakk> \<Longrightarrow> iNextStrong t0 I P = iNextWeak t0 I P
[PROOF STEP]
by (simp add: infin_imp_iNextWeak_eq_iNext infin_imp_iNextStrong_eq_iNext)


[STATEMENT]
lemma at_within_eq_bot_lemma:
  "at x within {b..c} = (if x < b \<or> b > c then bot else at x within {b..c})"
  for x b c::"'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at x within {b..c} = (if x < b \<or> c < b then bot else at x within {b..c})
[PROOF STEP]
by (auto intro!: not_in_closure_trivial_limitI)


[STATEMENT]
lemma neg_divideC_le_eq [field_simps]:
  "b /\<^sub>C c \<le> a \<longleftrightarrow> c *\<^sub>C a \<le> b" if "c < 0"
    for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b /\<^sub>C c \<le> a) = (c *\<^sub>C a \<le> b)
[PROOF STEP]
using that pos_divideC_le_eq [of "- c" "- b" a]
[PROOF STATE]
proof (prove)
using this:
c < 0
0 < - c \<Longrightarrow> (- b /\<^sub>C - c \<le> a) = (- b \<le> - c *\<^sub>C a)

goal (1 subgoal):
 1. (b /\<^sub>C c \<le> a) = (c *\<^sub>C a \<le> b)
[PROOF STEP]
by (simp add: less_complex_def)


[STATEMENT]
lemma cf_brcomp_ObjMap_vdomain[cat_cs_simps]:
  assumes "\<SS> : \<CC> \<times>\<^sub>C \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC> \<times>\<^sub>C\<^sub>3 \<CC> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>
[PROOF STEP]
interpret \<SS>: is_functor \<alpha> \<open>\<CC> \<times>\<^sub>C \<CC>\<close> \<CC> \<SS>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<SS> : \<CC> \<times>\<^sub>C \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>
[PROOF STEP]
interpret cf_brcomp: is_functor \<alpha> \<open>\<CC> \<times>\<^sub>C\<^sub>3 \<CC> \<times>\<^sub>C\<^sub>3 \<CC>\<close> \<CC> \<open>cf_brcomp \<SS>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_brcomp \<SS> : \<CC>^\<^sub>C\<^sub>3 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule cf_brcomp_is_functor[OF assms])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>
[PROOF STEP]
by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> (cf_brcomp \<SS>\<lparr>ObjMap\<rparr>) = (\<CC>^\<^sub>C\<^sub>3)\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_bit_flip_bit_eq:
  \<open>take_bit n (flip_bit m a) = (if n \<le> m then take_bit n a else flip_bit m (take_bit n a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit n (flip_bit m a) = (if n \<le> m then take_bit n a else flip_bit m (take_bit n a))
[PROOF STEP]
by (rule bit_eqI) (auto simp add: bit_take_bit_iff bit_flip_bit_iff)


[STATEMENT]
lemma r_lchild_eq_l_rchild_if_well_shaped:
  "\<lbrakk>well_shaped t; l t < r t\<rbrakk> \<Longrightarrow> r (lchild t) = l (rchild t) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>well_shaped t; l t < r t\<rbrakk> \<Longrightarrow> r (lchild t) = l (rchild t) - 1
[PROOF STEP]
by (induct t) auto


[STATEMENT]
lemma purgeIdle_Cons_iff:
"purgeIdle sl = s # sll
 \<longleftrightarrow>
 (\<exists> sl1 sl2. sl = sl1 @ s # sl2 \<and>
            (\<forall>s1\<in>set sl1. \<not> isState s1) \<and> isState s \<and> purgeIdle sl2 = sll)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (purgeIdle sl = s # sll) = (\<exists>sl1 sl2. sl = sl1 @ s # sl2 \<and> (\<forall>s1\<in>set sl1. \<not> isState s1) \<and> isState s \<and> purgeIdle sl2 = sll)
[PROOF STEP]
unfolding purgeIdle_def filter_eq_Cons_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>us vs. sl = us @ s # vs \<and> (\<forall>u\<in>set us. \<not> isState u) \<and> isState s \<and> sll = filter isState vs) = (\<exists>sl1 sl2. sl = sl1 @ s # sl2 \<and> (\<forall>s1\<in>set sl1. \<not> isState s1) \<and> isState s \<and> filter isState sl2 = sll)
[PROOF STEP]
by auto


[STATEMENT]
lemma satisfiableEquivalentAppend:
  fixes formula1 :: Formula and formula1' :: Formula and formula2 :: Formula
  assumes "equivalentFormulae formula1 formula1'" and "satisfiable (formula1 @ formula2)"
  shows "satisfiable (formula1' @ formula2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfiable (formula1' @ formula2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
equivalentFormulae formula1 formula1'
satisfiable (formula1 @ formula2)

goal (1 subgoal):
 1. satisfiable (formula1' @ formula2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>equivalentFormulae formula1 formula1'; satisfiable (formula1 @ formula2)\<rbrakk> \<Longrightarrow> satisfiable (formula1' @ formula2)
[PROOF STEP]
from \<open>satisfiable (formula1 @ formula2)\<close>
[PROOF STATE]
proof (chain)
picking this:
satisfiable (formula1 @ formula2)
[PROOF STEP]
obtain valuation::Valuation
    where "consistent valuation" "formulaTrue formula1 valuation" "formulaTrue formula2 valuation"
[PROOF STATE]
proof (prove)
using this:
satisfiable (formula1 @ formula2)

goal (1 subgoal):
 1. (\<And>valuation. \<lbrakk>consistent valuation; formulaTrue formula1 valuation; formulaTrue formula2 valuation\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding satisfiable_def
[PROOF STATE]
proof (prove)
using this:
\<exists>valuation. model valuation (formula1 @ formula2)

goal (1 subgoal):
 1. (\<And>valuation. \<lbrakk>consistent valuation; formulaTrue formula1 valuation; formulaTrue formula2 valuation\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: formulaTrueAppend)
[PROOF STATE]
proof (state)
this:
consistent valuation
formulaTrue formula1 valuation
formulaTrue formula2 valuation

goal (1 subgoal):
 1. \<lbrakk>equivalentFormulae formula1 formula1'; satisfiable (formula1 @ formula2)\<rbrakk> \<Longrightarrow> satisfiable (formula1' @ formula2)
[PROOF STEP]
from \<open>equivalentFormulae formula1 formula1'\<close> \<open>consistent valuation\<close> \<open>formulaTrue formula1 valuation\<close>
[PROOF STATE]
proof (chain)
picking this:
equivalentFormulae formula1 formula1'
consistent valuation
formulaTrue formula1 valuation
[PROOF STEP]
have "formulaTrue formula1' valuation"
[PROOF STATE]
proof (prove)
using this:
equivalentFormulae formula1 formula1'
consistent valuation
formulaTrue formula1 valuation

goal (1 subgoal):
 1. formulaTrue formula1' valuation
[PROOF STEP]
unfolding equivalentFormulae_def
[PROOF STATE]
proof (prove)
using this:
\<forall>valuation. model valuation formula1 = model valuation formula1'
consistent valuation
formulaTrue formula1 valuation

goal (1 subgoal):
 1. formulaTrue formula1' valuation
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
formulaTrue formula1' valuation

goal (1 subgoal):
 1. \<lbrakk>equivalentFormulae formula1 formula1'; satisfiable (formula1 @ formula2)\<rbrakk> \<Longrightarrow> satisfiable (formula1' @ formula2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfiable (formula1' @ formula2)
[PROOF STEP]
using \<open>consistent valuation\<close> \<open>formulaTrue formula1' valuation\<close> \<open>formulaTrue formula2 valuation\<close>
[PROOF STATE]
proof (prove)
using this:
consistent valuation
formulaTrue formula1' valuation
formulaTrue formula2 valuation

goal (1 subgoal):
 1. satisfiable (formula1' @ formula2)
[PROOF STEP]
unfolding satisfiable_def
[PROOF STATE]
proof (prove)
using this:
consistent valuation
formulaTrue formula1' valuation
formulaTrue formula2 valuation

goal (1 subgoal):
 1. \<exists>valuation. model valuation (formula1' @ formula2)
[PROOF STEP]
by (auto simp add: formulaTrueAppend)
[PROOF STATE]
proof (state)
this:
satisfiable (formula1' @ formula2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_set_other_def:
  "finite A \<Longrightarrow> sorted_list_of_set(A) = (THE xs. sorted(xs) \<and> distinct(xs) \<and> set xs = A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> sorted_list_of_set A = (THE xs. sorted xs \<and> distinct xs \<and> set xs = A)
[PROOF STEP]
apply (rule sym)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (THE xs. sorted xs \<and> distinct xs \<and> set xs = A) = sorted_list_of_set A
[PROOF STEP]
apply (rule the_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite A \<Longrightarrow> sorted (sorted_list_of_set A) \<and> distinct (sorted_list_of_set A) \<and> set (sorted_list_of_set A) = A
 2. \<And>xs. \<lbrakk>finite A; sorted xs \<and> distinct xs \<and> set xs = A\<rbrakk> \<Longrightarrow> xs = sorted_list_of_set A
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>sorted xs; distinct xs; A = set xs\<rbrakk> \<Longrightarrow> xs = sorted_list_of_set (set xs)
[PROOF STEP]
apply (simp add: sorted_distinct_set_unique)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma trunc_ell2_ket_cspan:
  \<open>trunc_ell2 S x \<in> (cspan (range ket))\<close> if \<open>finite S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trunc_ell2 S x \<in> cspan (range ket)
[PROOF STEP]
proof (use that in induction)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. trunc_ell2 {} x \<in> cspan (range ket)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. trunc_ell2 {} x \<in> cspan (range ket)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trunc_ell2 {} x \<in> cspan (range ket)
[PROOF STEP]
by (auto intro: complex_vector.span_zero)
[PROOF STATE]
proof (state)
this:
trunc_ell2 {} x \<in> cspan (range ket)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
case (insert a F)
[PROOF STATE]
proof (state)
this:
finite F
a \<notin> F
trunc_ell2 F x \<in> cspan (range ket)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
from insert.hyps
[PROOF STATE]
proof (chain)
picking this:
finite F
a \<notin> F
[PROOF STEP]
have \<open>trunc_ell2 (insert a F) x = trunc_ell2 F x + Rep_ell2 x a *\<^sub>C ket a\<close>
[PROOF STATE]
proof (prove)
using this:
finite F
a \<notin> F

goal (1 subgoal):
 1. trunc_ell2 (insert a F) x = trunc_ell2 F x + Rep_ell2 x a *\<^sub>C ket a
[PROOF STEP]
apply (transfer fixing: F a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>finite F; a \<notin> F; has_ell2_norm x\<rbrakk> \<Longrightarrow> (\<lambda>i. if i \<in> insert a F then x i else 0) = (\<lambda>xa. (if xa \<in> F then x xa else 0) + x a * (if a = xa then 1 else 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trunc_ell2 (insert a F) x = trunc_ell2 F x + Rep_ell2 x a *\<^sub>C ket a

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; trunc_ell2 F x \<in> cspan (range ket)\<rbrakk> \<Longrightarrow> trunc_ell2 (insert xa F) x \<in> cspan (range ket)
[PROOF STEP]
with insert.IH
[PROOF STATE]
proof (chain)
picking this:
trunc_ell2 F x \<in> cspan (range ket)
trunc_ell2 (insert a F) x = trunc_ell2 F x + Rep_ell2 x a *\<^sub>C ket a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
trunc_ell2 F x \<in> cspan (range ket)
trunc_ell2 (insert a F) x = trunc_ell2 F x + Rep_ell2 x a *\<^sub>C ket a

goal (1 subgoal):
 1. trunc_ell2 (insert a F) x \<in> cspan (range ket)
[PROOF STEP]
by (simp add: complex_vector.span_add_eq complex_vector.span_base complex_vector.span_scale)
[PROOF STATE]
proof (state)
this:
trunc_ell2 (insert a F) x \<in> cspan (range ket)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_component: "path_component S x y \<longleftrightarrow> (\<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_component S x y = (\<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t)
[PROOF STEP]
apply (intro iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. path_component S x y \<Longrightarrow> \<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t
 2. \<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t \<Longrightarrow> path_component S x y
[PROOF STEP]
apply (metis path_connected_path_image path_defs(5) pathfinish_in_path_image pathstart_in_path_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t \<Longrightarrow> path_component S x y
[PROOF STEP]
using path_component_of_subset path_connected_component
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?S \<subseteq> ?T; path_component ?S ?x ?y\<rbrakk> \<Longrightarrow> path_component ?T ?x ?y
path_connected ?S = (\<forall>x\<in>?S. \<forall>y\<in>?S. path_component ?S x y)

goal (1 subgoal):
 1. \<exists>t. path_connected t \<and> t \<subseteq> S \<and> x \<in> t \<and> y \<in> t \<Longrightarrow> path_component S x y
[PROOF STEP]
by blast


[STATEMENT]
lemma vars_add_Var_subset:
  \<open>vars (p' + Var x :: 'a :: {ab_group_add,one,zero_neq_one} mpoly) \<subseteq>  \<V> \<Longrightarrow> vars p' \<subseteq> insert x \<V>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (p' + Var x) \<subseteq> \<V> \<Longrightarrow> vars p' \<subseteq> insert x \<V>
[PROOF STEP]
using vars_add[of \<open>p' + Var x\<close> \<open>-Var x\<close>]
[PROOF STATE]
proof (prove)
using this:
vars (p' + Var x + - Var x) \<subseteq> vars (p' + Var x) \<union> vars (- Var x)

goal (1 subgoal):
 1. vars (p' + Var x) \<subseteq> \<V> \<Longrightarrow> vars p' \<subseteq> insert x \<V>
[PROOF STEP]
by auto


[STATEMENT]
lemma val_eq_trans: fixes v1::val and v2::val and v3::val
  assumes v12: "v1 \<sim> v2" and v23: "v2 \<sim> v3" shows "v1 \<sim> v3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v1 \<sim> v3
[PROOF STEP]
using v12 v23
[PROOF STATE]
proof (prove)
using this:
v1 \<sim> v2
v2 \<sim> v3

goal (1 subgoal):
 1. v1 \<sim> v3
[PROOF STEP]
apply (simp only: val_eq_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v1 \<sqsubseteq> v2 \<and> v2 \<sqsubseteq> v1; v2 \<sqsubseteq> v3 \<and> v3 \<sqsubseteq> v2\<rbrakk> \<Longrightarrow> v1 \<sqsubseteq> v3 \<and> v3 \<sqsubseteq> v1
[PROOF STEP]
using val_le_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v1.0 \<sqsubseteq> ?v2.0; ?v2.0 \<sqsubseteq> ?v3.0\<rbrakk> \<Longrightarrow> ?v1.0 \<sqsubseteq> ?v3.0

goal (1 subgoal):
 1. \<lbrakk>v1 \<sqsubseteq> v2 \<and> v2 \<sqsubseteq> v1; v2 \<sqsubseteq> v3 \<and> v3 \<sqsubseteq> v2\<rbrakk> \<Longrightarrow> v1 \<sqsubseteq> v3 \<and> v3 \<sqsubseteq> v1
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iam_iterateoi_foldli_conv :
    "iam_iterateoi a =
     foldli (List.map_filter
       (\<lambda>n. map_option (\<lambda>v. (n, v)) (array_get a n))
       ([0..<(array_length a)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iam_iterateoi a = foldli (List.map_filter (\<lambda>n. map_option (Pair n) (array_get a n)) [0..<array_length a])
[PROOF STEP]
apply (intro ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa xb. iam_iterateoi a x xa xb = foldli (List.map_filter (\<lambda>n. map_option (Pair n) (array_get a n)) [0..<array_length a]) x xa xb
[PROOF STEP]
unfolding iam_iterateoi_def iam_iterateoi_aux_foldli_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa xb. foldli (List.map_filter (\<lambda>n. map_option (Pair n) (array_get a n)) [0..<array_length a]) x xa xb = foldli (List.map_filter (\<lambda>n. map_option (Pair n) (array_get a n)) [0..<array_length a]) x xa xb
[PROOF STEP]
by simp


[STATEMENT]
lemma disjE5:
  "\<lbrakk> A \<or> B \<or> C \<or> D \<or> E ; A \<Longrightarrow> P ; B \<Longrightarrow> P ; C \<Longrightarrow> P ; D \<Longrightarrow> P ; E \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<or> B \<or> C \<or> D \<or> E; A \<Longrightarrow> P; B \<Longrightarrow> P; C \<Longrightarrow> P; D \<Longrightarrow> P; E \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by auto


[STATEMENT]
lemma cubic_reduction:
  fixes a :: complex
  assumes
    "a \<noteq> 0 \<and> x = y - b / (3 * a) \<and>  p = (3* a * c - b^2) / (9 * a^2) \<and>
      q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3)"
  shows "a * x^3 + b * x^2 + c * x + d = 0 \<longleftrightarrow> y^3 + 3 * p * y - 2 * q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0 \<and> x = y - b / (3 * a) \<and> p = (3 * a * c - b\<^sup>2) / (9 * a\<^sup>2) \<and> q = (9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d) / (54 * a ^ 3)
[PROOF STEP]
have "3 * a \<noteq> 0" "9 * a^2 \<noteq> 0" "54 * a^3 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<and> x = y - b / (3 * a) \<and> p = (3 * a * c - b\<^sup>2) / (9 * a\<^sup>2) \<and> q = (9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d) / (54 * a ^ 3)

goal (1 subgoal):
 1. 3 * a \<noteq> 0 &&& 9 * a\<^sup>2 \<noteq> 0 &&& 54 * a ^ 3 \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
3 * a \<noteq> 0
9 * a\<^sup>2 \<noteq> 0
54 * a ^ 3 \<noteq> 0

goal (1 subgoal):
 1. (a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
3 * a \<noteq> 0
9 * a\<^sup>2 \<noteq> 0
54 * a ^ 3 \<noteq> 0
[PROOF STEP]
have *:
      "x = y - b / (3 * a) \<longleftrightarrow> (3*a) * x = (3*a) * y - b"
      "p = (3* a * c - b^2) / (9 * a^2) \<longleftrightarrow> (9 * a^2) * p = (3* a * c - b^2)"
      "q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3) \<longleftrightarrow>
        (54 * a^3) * q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d)"
[PROOF STATE]
proof (prove)
using this:
3 * a \<noteq> 0
9 * a\<^sup>2 \<noteq> 0
54 * a ^ 3 \<noteq> 0

goal (1 subgoal):
 1. (x = y - b / (3 * a)) = (3 * a * x = 3 * a * y - b) &&& (p = (3 * a * c - b\<^sup>2) / (9 * a\<^sup>2)) = (9 * a\<^sup>2 * p = 3 * a * c - b\<^sup>2) &&& (q = (9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d) / (54 * a ^ 3)) = (54 * a ^ 3 * q = 9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d)
[PROOF STEP]
by (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
(x = y - b / (3 * a)) = (3 * a * x = 3 * a * y - b)
(p = (3 * a * c - b\<^sup>2) / (9 * a\<^sup>2)) = (9 * a\<^sup>2 * p = 3 * a * c - b\<^sup>2)
(q = (9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d) / (54 * a ^ 3)) = (54 * a ^ 3 * q = 9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d)

goal (1 subgoal):
 1. (a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)
[PROOF STEP]
from assms [unfolded *]
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0 \<and> 3 * a * x = 3 * a * y - b \<and> 9 * a\<^sup>2 * p = 3 * a * c - b\<^sup>2 \<and> 54 * a ^ 3 * q = 9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<and> 3 * a * x = 3 * a * y - b \<and> 9 * a\<^sup>2 * p = 3 * a * c - b\<^sup>2 \<and> 54 * a ^ 3 * q = 9 * a * b * c - 2 * b ^ 3 - 27 * a\<^sup>2 * d

goal (1 subgoal):
 1. (a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
(a * x ^ 3 + b * x\<^sup>2 + c * x + d = 0) = (y ^ 3 + 3 * p * y - 2 * q = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<Phi>_wbalanced: assumes "wbalanced t" shows "\<Phi> t = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
have "\<Phi> t = 6*e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> t = 6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s))
[PROOF STEP]
by(simp add: \<Phi>_sum_mset sum_mset_distrib_left)
[PROOF STATE]
proof (state)
this:
\<Phi> t = 6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s))

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> t = 6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s))

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
have "\<dots> = (6*e) * real(\<Sum>s\<in>#subtrees_mset t. imbal s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s)) = 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t)))
[PROOF STEP]
using e0
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s)) = 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t)))
[PROOF STEP]
by (simp add: multiset.map_comp o_def)
[PROOF STATE]
proof (state)
this:
6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s)) = 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t)))

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
6 * e * (\<Sum>s\<in>#subtrees_mset t. real (imbal s)) = 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t)))

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t))) = 0
[PROOF STEP]
using e0 assms
[PROOF STATE]
proof (prove)
using this:
0 < e
wbalanced t

goal (1 subgoal):
 1. 6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t))) = 0
[PROOF STEP]
by(simp add: imbal0_if_wbalanced wbalanced_subtrees del: of_nat_sum_mset)
[PROOF STATE]
proof (state)
this:
6 * e * real (\<Sum>\<^sub># (image_mset imbal (subtrees_mset t))) = 0

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Phi> t = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Phi> t = 0

goal (1 subgoal):
 1. \<Phi> t = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Phi> t = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma blinfun_componentwise:
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::euclidean_space \<Rightarrow>\<^sub>L 'c::real_normed_vector"
  shows "f = (\<lambda>x. \<Sum>i\<in>Basis. blinfun_scaleR (blinfun_inner_left i) (f x i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. \<Sum>i\<in>Basis. blinfun_scaleR (blinfun_inner_left i) (blinfun_apply (f x) i))
[PROOF STEP]
by (auto intro!: blinfun_eqI
    simp: blinfun.sum_left euclidean_representation blinfun.scaleR_right[symmetric]
      blinfun.sum_right[symmetric])


[STATEMENT]
lemma foo_eq: "foo = (Var 0)^3 + (Const (3/2))*(Var 0)^2*(Var 1) + (Const (3))*(Var 0)^2*(Var 2) + (Const (3/4))*(Var 0)*(Var 1)^2 + (Const (3))*(Var 0)*(Var 1)*(Var 2) + (Const (3))*(Var 0)*(Var 2)^2 + (Const (1/8))*(Var 1)^3 + (Const (3/4))*(Var 1)^2*(Var 2) + (Const (3/2))*(Var 1)*(Var 2)^2 + (Var 2)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Var 0 + Const (5 / 10) * Var 1 + Var 2) ^ 3 = Var 0 ^ 3 + Const (3 / 2) * (Var 0)\<^sup>2 * Var 1 + Const 3 * (Var 0)\<^sup>2 * Var 2 + Const (3 / 4) * Var 0 * (Var 1)\<^sup>2 + Const 3 * Var 0 * Var 1 * Var 2 + Const 3 * Var 0 * (Var 2)\<^sup>2 + Const (1 / 8) * Var 1 ^ 3 + Const (3 / 4) * (Var 1)\<^sup>2 * Var 2 + Const (3 / 2) * Var 1 * (Var 2)\<^sup>2 + Var 2 ^ 3
[PROOF STEP]
by code_simp


[STATEMENT]
lemma subst_single_eq: "subst_single t s t' = subst t (fmap_of_list [(s, t')])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst_single t s t' = subst t (fmap_of_list [(s, t')])
[PROOF STEP]
proof (induction t)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x. subst_single (Nconst x) s t' = subst (Nconst x) (fmap_of_list [(s, t')])
 2. \<And>x. subst_single (Nvar x) s t' = subst (Nvar x) (fmap_of_list [(s, t')])
 3. \<And>x1a t. subst_single t s t' = subst t (fmap_of_list [(s, t')]) \<Longrightarrow> subst_single (\<Lambda>\<^sub>n x1a. t) s t' = subst (\<Lambda>\<^sub>n x1a. t) (fmap_of_list [(s, t')])
 4. \<And>t1 t2. \<lbrakk>subst_single t1 s t' = subst t1 (fmap_of_list [(s, t')]); subst_single t2 s t' = subst t2 (fmap_of_list [(s, t')])\<rbrakk> \<Longrightarrow> subst_single (t1 $\<^sub>n t2) s t' = subst (t1 $\<^sub>n t2) (fmap_of_list [(s, t')])
[PROOF STEP]
case (Nabs x t)
[PROOF STATE]
proof (state)
this:
subst_single t s t' = subst t (fmap_of_list [(s, t')])

goal (4 subgoals):
 1. \<And>x. subst_single (Nconst x) s t' = subst (Nconst x) (fmap_of_list [(s, t')])
 2. \<And>x. subst_single (Nvar x) s t' = subst (Nvar x) (fmap_of_list [(s, t')])
 3. \<And>x1a t. subst_single t s t' = subst t (fmap_of_list [(s, t')]) \<Longrightarrow> subst_single (\<Lambda>\<^sub>n x1a. t) s t' = subst (\<Lambda>\<^sub>n x1a. t) (fmap_of_list [(s, t')])
 4. \<And>t1 t2. \<lbrakk>subst_single t1 s t' = subst t1 (fmap_of_list [(s, t')]); subst_single t2 s t' = subst t2 (fmap_of_list [(s, t')])\<rbrakk> \<Longrightarrow> subst_single (t1 $\<^sub>n t2) s t' = subst (t1 $\<^sub>n t2) (fmap_of_list [(s, t')])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subst_single t s t' = subst t (fmap_of_list [(s, t')])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
subst_single t s t' = subst t (fmap_of_list [(s, t')])

goal (1 subgoal):
 1. subst_single (\<Lambda>\<^sub>n x. t) s t' = subst (\<Lambda>\<^sub>n x. t) (fmap_of_list [(s, t')])
[PROOF STEP]
by (cases "x = s") (simp add: fmfilter_alt_defs)+
[PROOF STATE]
proof (state)
this:
subst_single (\<Lambda>\<^sub>n x. t) s t' = subst (\<Lambda>\<^sub>n x. t) (fmap_of_list [(s, t')])

goal (3 subgoals):
 1. \<And>x. subst_single (Nconst x) s t' = subst (Nconst x) (fmap_of_list [(s, t')])
 2. \<And>x. subst_single (Nvar x) s t' = subst (Nvar x) (fmap_of_list [(s, t')])
 3. \<And>t1 t2. \<lbrakk>subst_single t1 s t' = subst t1 (fmap_of_list [(s, t')]); subst_single t2 s t' = subst t2 (fmap_of_list [(s, t')])\<rbrakk> \<Longrightarrow> subst_single (t1 $\<^sub>n t2) s t' = subst (t1 $\<^sub>n t2) (fmap_of_list [(s, t')])
[PROOF STEP]
qed auto


[STATEMENT]
lemma tendsto_principal_singleton[simp]:
  shows "(f \<longlongrightarrow> f x) (principal {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f x) (principal {x})
[PROOF STEP]
unfolding tendsto_def eventually_principal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S. open S \<longrightarrow> f x \<in> S \<longrightarrow> (\<forall>x\<in>{x}. f x \<in> S)
[PROOF STEP]
by simp


[STATEMENT]
lemma count_roots_with_times_root:
  assumes "p \<noteq> 0" "P (a :: 'a :: linordered_idom)"
  shows   "count_roots_with P ([:a, -1:] * p) = Suc (count_roots_with P p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
define q where "q = [:a, -1:] * p"
[PROOF STATE]
proof (state)
this:
q = [:a, - (1::'a):] * p

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
P a
[PROOF STEP]
have a: "a \<in> roots_with P q"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
P a

goal (1 subgoal):
 1. a \<in> roots_with P q
[PROOF STEP]
by (simp_all add: roots_with_def q_def)
[PROOF STATE]
proof (state)
this:
a \<in> roots_with P q

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
have q_nz: "q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<noteq> 0
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:a, - (1::'a):] * p \<noteq> 0
[PROOF STEP]
by (rule no_zero_divisors) (simp_all add: assms)
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
have "count_roots_with P q = (\<Sum>x\<in>roots_with P q. order x q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_with P q = (\<Sum>x\<in>roots_with P q. order x q)
[PROOF STEP]
by (simp add: count_roots_with_def)
[PROOF STATE]
proof (state)
this:
count_roots_with P q = (\<Sum>x\<in>roots_with P q. order x q)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_roots_with P q = (\<Sum>x\<in>roots_with P q. order x q)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
from a q_nz
[PROOF STATE]
proof (chain)
picking this:
a \<in> roots_with P q
q \<noteq> 0
[PROOF STEP]
have "\<dots> = order a q + (\<Sum>x\<in>roots_with P q - {a}. order x q)"
[PROOF STATE]
proof (prove)
using this:
a \<in> roots_with P q
q \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>x\<in>roots_with P q. order x q) = order a q + (\<Sum>x\<in>roots_with P q - {a}. order x q)
[PROOF STEP]
by (subst sum.remove) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>roots_with P q. order x q) = order a q + (\<Sum>x\<in>roots_with P q - {a}. order x q)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>roots_with P q. order x q) = order a q + (\<Sum>x\<in>roots_with P q - {a}. order x q)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
have "order a q = order a [:a, -1:] + order a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order a q = order a [:a, - (1::'a):] + order a p
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order a ([:a, - (1::'a):] * p) = order a [:a, - (1::'a):] + order a p
[PROOF STEP]
by (subst order_mult[OF no_zero_divisors]) (simp_all add: assms)
[PROOF STATE]
proof (state)
this:
order a q = order a [:a, - (1::'a):] + order a p

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order a q = order a [:a, - (1::'a):] + order a p

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
have "order a [:a, -1:] = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order a [:a, - (1::'a):] = 1
[PROOF STEP]
by (subst order_smult [of "-1", symmetric])
       (insert order_power_n_n[of a 1], simp_all add: order_1)
[PROOF STATE]
proof (state)
this:
order a [:a, - (1::'a):] = 1

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order a [:a, - (1::'a):] = 1

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
have "(\<Sum>x\<in>roots_with P q - {a}. order x q) = (\<Sum>x\<in>roots_with P q - {a}. order x p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>roots_with P q - {a}. order x q) = (\<Sum>x\<in>roots_with P q - {a}. order x p)
[PROOF STEP]
proof (intro sum.cong refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
assume x: "x \<in> roots_with P q - {a}"
[PROOF STATE]
proof (state)
this:
x \<in> roots_with P q - {a}

goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
P a
[PROOF STEP]
have "order x q = order x [:a, -1:] + order x p"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
P a

goal (1 subgoal):
 1. order x q = order x [:a, - (1::'a):] + order x p
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
P a

goal (1 subgoal):
 1. order x ([:a, - (1::'a):] * p) = order x [:a, - (1::'a):] + order x p
[PROOF STEP]
by (subst order_mult[OF no_zero_divisors]) (simp_all add: assms)
[PROOF STATE]
proof (state)
this:
order x q = order x [:a, - (1::'a):] + order x p

goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order x q = order x [:a, - (1::'a):] + order x p

goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> roots_with P q - {a}
[PROOF STEP]
have "order x [:a, -1:] = 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> roots_with P q - {a}

goal (1 subgoal):
 1. order x [:a, - (1::'a):] = 0
[PROOF STEP]
by (intro order_0I) simp_all
[PROOF STATE]
proof (state)
this:
order x [:a, - (1::'a):] = 0

goal (1 subgoal):
 1. \<And>x. x \<in> roots_with P q - {a} \<Longrightarrow> order x q = order x p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
order x q = 0 + order x p
[PROOF STEP]
show "order x q = order x p"
[PROOF STATE]
proof (prove)
using this:
order x q = 0 + order x p

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>roots_with P q - {a}. order x q) = (\<Sum>x\<in>roots_with P q - {a}. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>roots_with P q - {a}. order x q) = (\<Sum>x\<in>roots_with P q - {a}. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
from a q_nz
[PROOF STATE]
proof (chain)
picking this:
a \<in> roots_with P q
q \<noteq> 0
[PROOF STEP]
have "1 + order a p + (\<Sum>x\<in>roots_with P q - {a}. order x p) =
                           1 + (\<Sum>x\<in>roots_with P q. order x p)"
[PROOF STATE]
proof (prove)
using this:
a \<in> roots_with P q
q \<noteq> 0

goal (1 subgoal):
 1. 1 + order a p + (\<Sum>x\<in>roots_with P q - {a}. order x p) = 1 + (\<Sum>x\<in>roots_with P q. order x p)
[PROOF STEP]
by (subst add.assoc, subst sum.remove[symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
1 + order a p + (\<Sum>x\<in>roots_with P q - {a}. order x p) = 1 + (\<Sum>x\<in>roots_with P q. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 + order a p + (\<Sum>x\<in>roots_with P q - {a}. order x p) = 1 + (\<Sum>x\<in>roots_with P q. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
from q_nz
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
[PROOF STEP]
have "(\<Sum>x\<in>roots_with P q. order x p) = (\<Sum>x\<in>roots_with P p. order x p)"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>x\<in>roots_with P q. order x p) = (\<Sum>x\<in>roots_with P p. order x p)
[PROOF STEP]
proof (intro sum.mono_neutral_right)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. q \<noteq> 0 \<Longrightarrow> finite (roots_with P q)
 2. q \<noteq> 0 \<Longrightarrow> roots_with P p \<subseteq> roots_with P q
 3. q \<noteq> 0 \<Longrightarrow> \<forall>i\<in>roots_with P q - roots_with P p. order i p = 0
[PROOF STEP]
show "roots_with P p \<subseteq> roots_with P q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots_with P p \<subseteq> roots_with P q
[PROOF STEP]
by (auto simp: roots_with_def q_def simp del: mult_pCons_left)
[PROOF STATE]
proof (state)
this:
roots_with P p \<subseteq> roots_with P q

goal (2 subgoals):
 1. q \<noteq> 0 \<Longrightarrow> finite (roots_with P q)
 2. q \<noteq> 0 \<Longrightarrow> \<forall>i\<in>roots_with P q - roots_with P p. order i p = 0
[PROOF STEP]
show "\<forall>x\<in>roots_with P q - roots_with P p. order x p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>roots_with P q - roots_with P p. order x p = 0
[PROOF STEP]
by (auto simp: roots_with_def q_def order_root simp del: mult_pCons_left)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>roots_with P q - roots_with P p. order x p = 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> finite (roots_with P q)
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>roots_with P q. order x p) = (\<Sum>x\<in>roots_with P p. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_roots_with P q = 1 + (\<Sum>x\<in>roots_with P p. order x p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_roots_with P q = 1 + (\<Sum>x\<in>roots_with P p. order x p)

goal (1 subgoal):
 1. count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)
[PROOF STEP]
by (simp add: q_def count_roots_with_def)
[PROOF STATE]
proof (state)
this:
count_roots_with P ([:a, - (1::'a):] * p) = Suc (count_roots_with P p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma older_seniors_stable:
  "x \<le> n \<Longrightarrow> older_seniors x n = older_seniors x (n + m + m') \<Longrightarrow> older_seniors x n = older_seniors x (n + m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> n; older_seniors x n = older_seniors x (n + m + m')\<rbrakk> \<Longrightarrow> older_seniors x n = older_seniors x (n + m)
[PROOF STEP]
by (induction m') (simp, unfold set_eq_subset, metis dual_order.trans le_add1 older_seniors_monotonic)


[STATEMENT]
lemma homologous_rel_singular_subdivision:
  assumes "singular_relcycle p X T c"
  shows "homologous_rel p X T (singular_subdivision p c) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
 2. p \<noteq> 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
 2. p \<noteq> 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
singular_relcycle p X T c
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_relcycle p X T c
p = 0

goal (1 subgoal):
 1. homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
by (auto simp: singular_relcycle_def singular_subdivision_zero)
[PROOF STATE]
proof (state)
this:
homologous_rel p X T (singular_subdivision p c) c

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
singular_relcycle p X T c
p \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_relcycle p X T c
p \<noteq> 0

goal (1 subgoal):
 1. homologous_rel p X T (singular_subdivision p c) c
[PROOF STEP]
unfolding homologous_rel_def singular_relboundary singular_relcycle
[PROOF STATE]
proof (prove)
using this:
singular_chain p X c \<and> singular_chain (p - 1) (subtopology X T) (chain_boundary p c)
p \<noteq> 0

goal (1 subgoal):
 1. \<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X T) e \<and> chain_boundary (Suc p) d + e = singular_subdivision p c - c
[PROOF STEP]
by (metis One_nat_def Suc_diff_1 chain_homotopic_singular_subdivision gr_zeroI)
[PROOF STATE]
proof (state)
this:
homologous_rel p X T (singular_subdivision p c) c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contractible_space:
   "contractible_space X \<longleftrightarrow>
        topspace X = {} \<or>
        (\<exists>a \<in> topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
proof (cases "topspace X = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
 2. topspace X \<noteq> {} \<Longrightarrow> contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace X \<noteq> {}

goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
 2. topspace X \<noteq> {} \<Longrightarrow> contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace X \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X \<noteq> {}

goal (1 subgoal):
 1. contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
using homotopic_with_imp_continuous_maps
[PROOF STATE]
proof (prove)
using this:
topspace X \<noteq> {}
homotopic_with ?P ?X ?Y ?f ?g \<Longrightarrow> continuous_map ?X ?Y ?f \<and> continuous_map ?X ?Y ?g

goal (1 subgoal):
 1. contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
by (fastforce simp: contractible_space_def)
[PROOF STATE]
proof (state)
this:
contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))

goal (1 subgoal):
 1. topspace X = {} \<Longrightarrow> contractible_space X = (topspace X = {} \<or> (\<exists>a\<in>topspace X. homotopic_with (\<lambda>x. True) X X id (\<lambda>x. a)))
[PROOF STEP]
qed (simp add: contractible_space_empty)


[STATEMENT]
lemma eventually_at_right:
  fixes x::"'a::{archimedean_field,linorder_topology}"
  shows "eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
obtain y where "y>x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. x < y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_less_of_int
[PROOF STATE]
proof (prove)
using this:
\<exists>z. ?x < of_int z

goal (1 subgoal):
 1. (\<And>y. x < y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < y

goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x < y

goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
using eventually_at_right[OF \<open>y>x\<close>]
[PROOF STATE]
proof (prove)
using this:
x < y
eventually ?P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> ?P y)

goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_UNIV:
  fixes S::"'a::finite set"
  assumes complete: "\<And>x. x\<notin>S \<Longrightarrow> f x = 0"
  shows "sum f S = sum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
from complete
[PROOF STATE]
proof (chain)
picking this:
?x \<notin> S \<Longrightarrow> f ?x = (0::'b)
[PROOF STEP]
have "sum f S = sum f (UNIV - S) + sum f S"
[PROOF STATE]
proof (prove)
using this:
?x \<notin> S \<Longrightarrow> f ?x = (0::'b)

goal (1 subgoal):
 1. sum f S = sum f (UNIV - S) + sum f S
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
sum f S = sum f (UNIV - S) + sum f S

goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f S = sum f (UNIV - S) + sum f S

goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
have "... = sum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (UNIV - S) + sum f S = sum f UNIV
[PROOF STEP]
by(auto intro: sum.subset_diff[symmetric])
[PROOF STATE]
proof (state)
this:
sum f (UNIV - S) + sum f S = sum f UNIV

goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f S = sum f UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f S = sum f UNIV

goal (1 subgoal):
 1. sum f S = sum f UNIV
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum f S = sum f UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_pmf_eq_1:
  assumes "finite A" "set_pmf p \<subseteq> A"
  shows   "(\<Sum>x\<in>A. pmf p x) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
have "(\<Sum>x\<in>A. pmf p x) = measure_pmf.prob p A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (pmf p) A = measure_pmf.prob p A
[PROOF STEP]
by (simp add: measure_measure_pmf_finite assms)
[PROOF STATE]
proof (state)
this:
sum (pmf p) A = measure_pmf.prob p A

goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (pmf p) A = measure_pmf.prob p A

goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
set_pmf p \<subseteq> A
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
using this:
finite A
set_pmf p \<subseteq> A

goal (1 subgoal):
 1. measure_pmf.prob p A = 1
[PROOF STEP]
by (subst measure_pmf.prob_eq_1) (auto simp: AE_measure_pmf_iff)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = 1

goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum (pmf p) A = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum (pmf p) A = 1

goal (1 subgoal):
 1. sum (pmf p) A = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum (pmf p) A = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_diff':
  assumes "m \<ge> n" "x \<noteq> 0"
  shows   "x ^ (m - n) = (x ^ m div x ^ n :: 'a :: unique_euclidean_semiring)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ (m - n) = x ^ m div x ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ (m - n) = x ^ m div x ^ n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
x \<noteq> (0::'a)
[PROOF STEP]
have "x ^ m = x ^ (m - n) * x ^ n"
[PROOF STATE]
proof (prove)
using this:
n \<le> m
x \<noteq> (0::'a)

goal (1 subgoal):
 1. x ^ m = x ^ (m - n) * x ^ n
[PROOF STEP]
by (subst power_add [symmetric]) simp
[PROOF STATE]
proof (state)
this:
x ^ m = x ^ (m - n) * x ^ n

goal (1 subgoal):
 1. x ^ (m - n) = x ^ m div x ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ^ m = x ^ (m - n) * x ^ n

goal (1 subgoal):
 1. x ^ (m - n) = x ^ m div x ^ n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
x \<noteq> (0::'a)
[PROOF STEP]
have "\<dots> div x ^ n = x ^ (m - n)"
[PROOF STATE]
proof (prove)
using this:
n \<le> m
x \<noteq> (0::'a)

goal (1 subgoal):
 1. x ^ (m - n) * x ^ n div x ^ n = x ^ (m - n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x ^ (m - n) * x ^ n div x ^ n = x ^ (m - n)

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

goal (1 subgoal):
 1. x ^ (m - n) = x ^ m div x ^ n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x ^ (m - n) = x ^ m div x ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_id:
  "Closure\<^sub>\<alpha> Z \<noteq> {} \<Longrightarrow> Z \<subseteq> R \<Longrightarrow> R \<in> \<R> \<Longrightarrow> Closure\<^sub>\<alpha> Z = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Closure\<^sub>\<alpha> Z \<noteq> {}; Z \<subseteq> R; R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> Z = R
[PROOF STEP]
proof goal_cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>Closure\<^sub>\<alpha> Z \<noteq> {}; Z \<subseteq> R; R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> Z = R
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
Closure\<^sub>\<alpha> Z \<noteq> {}
Z \<subseteq> R
R \<in> \<R>

goal (1 subgoal):
 1. \<lbrakk>Closure\<^sub>\<alpha> Z \<noteq> {}; Z \<subseteq> R; R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> Z = R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Closure\<^sub>\<alpha> Z \<noteq> {}
Z \<subseteq> R
R \<in> \<R>
[PROOF STEP]
have "Z \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
Closure\<^sub>\<alpha> Z \<noteq> {}
Z \<subseteq> R
R \<in> \<R>

goal (1 subgoal):
 1. Z \<noteq> {}
[PROOF STEP]
unfolding cla_def
[PROOF STATE]
proof (prove)
using this:
\<Union> {R \<in> \<R>. R \<inter> Z \<noteq> {}} \<noteq> {}
Z \<subseteq> R
R \<in> \<R>

goal (1 subgoal):
 1. Z \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Z \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>Closure\<^sub>\<alpha> Z \<noteq> {}; Z \<subseteq> R; R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> Z = R
[PROOF STEP]
with 1 closure_id'
[PROOF STATE]
proof (chain)
picking this:
Closure\<^sub>\<alpha> Z \<noteq> {}
Z \<subseteq> R
R \<in> \<R>
\<lbrakk>?Z \<noteq> {}; ?Z \<subseteq> ?R; ?R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> ?Z = ?R
Z \<noteq> {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Closure\<^sub>\<alpha> Z \<noteq> {}
Z \<subseteq> R
R \<in> \<R>
\<lbrakk>?Z \<noteq> {}; ?Z \<subseteq> ?R; ?R \<in> \<R>\<rbrakk> \<Longrightarrow> Closure\<^sub>\<alpha> ?Z = ?R
Z \<noteq> {}

goal (1 subgoal):
 1. Closure\<^sub>\<alpha> Z = R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Closure\<^sub>\<alpha> Z = R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_favorites [simp, intro]: "finite (favorites R i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (favorites R i)
[PROOF STEP]
using favorites_subset_alts finite_alts
[PROOF STATE]
proof (prove)
using this:
favorites R ?i \<subseteq> alts
finite alts

goal (1 subgoal):
 1. finite (favorites R i)
[PROOF STEP]
by (rule finite_subset)


[STATEMENT]
lemma poly_diff [simp]: "poly (p - q) x = poly p x - poly q x"
  for x :: "'a::comm_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (p - q) x = poly p x - poly q x
[PROOF STEP]
using poly_add [of p "- q" x]
[PROOF STATE]
proof (prove)
using this:
poly (p + - q) x = poly p x + poly (- q) x

goal (1 subgoal):
 1. poly (p - q) x = poly p x - poly q x
[PROOF STEP]
by simp


[STATEMENT]
lemma proj_tuple_replicate: "(\<And>i. i \<in> set bs \<Longrightarrow> \<not>i) \<Longrightarrow> length bs = length as \<Longrightarrow>
  proj_tuple bs as = replicate (length bs) None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i. i \<in> set bs \<Longrightarrow> \<not> i; length bs = length as\<rbrakk> \<Longrightarrow> proj_tuple bs as = replicate (length bs) None
[PROOF STEP]
by (induction bs as rule: proj_tuple.induct) fastforce+


[STATEMENT]
lemma poly_tendsto_pinfty:  fixes p :: "real poly"
  assumes "lead_coeff p > 0" "degree p \<noteq> 0"
  shows "poly p \<longlonglongrightarrow> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ereal (poly p (real x))) \<longlonglongrightarrow> \<infinity>
[PROOF STEP]
unfolding Lim_PInfty
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>B. \<exists>N. \<forall>n\<ge>N. ereal B \<le> ereal (poly p (real n))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>B. \<exists>N. \<forall>n\<ge>N. ereal B \<le> ereal (poly p (real n))
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>B. \<exists>N. \<forall>n\<ge>N. ereal B \<le> ereal (poly p (real n))
[PROOF STEP]
show "\<exists>N. \<forall>n\<ge>N. ereal b \<le> ereal (poly p (real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. ereal b \<le> ereal (poly p (real n))
[PROOF STEP]
unfolding ereal_less_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. b \<le> poly p (real n)
[PROOF STEP]
using poly_pinfty_ge[OF assms, of b]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. \<forall>x\<ge>n. b \<le> poly p x

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. b \<le> poly p (real n)
[PROOF STEP]
by (meson of_nat_le_iff order_trans real_arch_simple)
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. ereal b \<le> ereal (poly p (real n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_totatives [simp]: "finite (totatives n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (totatives n)
[PROOF STEP]
by (simp add: totatives_def)


[STATEMENT]
lemma echelon_form_upt_row_condition1_explicit':
  assumes "echelon_form_upt_row A k"
  and "to_nat i < k" and "is_zero_row i A" and "i\<le>j" and "to_nat j < k"
  shows "is_zero_row j A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row j A
[PROOF STEP]
proof (cases "i=j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = j \<Longrightarrow> is_zero_row j A
 2. i \<noteq> j \<Longrightarrow> is_zero_row j A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i = j

goal (2 subgoals):
 1. i = j \<Longrightarrow> is_zero_row j A
 2. i \<noteq> j \<Longrightarrow> is_zero_row j A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = j

goal (1 subgoal):
 1. is_zero_row j A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i = j
echelon_form_upt_row A k
mod_type_class.to_nat i < k
is_zero_row i A
i \<le> j
mod_type_class.to_nat j < k

goal (1 subgoal):
 1. is_zero_row j A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_zero_row j A

goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> is_zero_row j A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> is_zero_row j A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<noteq> j

goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> is_zero_row j A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j

goal (1 subgoal):
 1. is_zero_row j A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
echelon_form_upt_row A k
mod_type_class.to_nat i < k
is_zero_row i A
i \<le> j
mod_type_class.to_nat j < k

goal (1 subgoal):
 1. is_zero_row j A
[PROOF STEP]
unfolding echelon_form_upt_row_def
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
(\<forall>i. mod_type_class.to_nat i < k \<and> is_zero_row i A \<longrightarrow> \<not> (\<exists>j>i. mod_type_class.to_nat j < k \<and> \<not> is_zero_row j A)) \<and> (\<forall>i j. i < j \<and> mod_type_class.to_nat j < k \<and> \<not> is_zero_row i A \<and> \<not> is_zero_row j A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ j $ n \<noteq> (0::'a)))
mod_type_class.to_nat i < k
is_zero_row i A
i \<le> j
mod_type_class.to_nat j < k

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minsky_reaching_s_imp_minsky_reaching_s_not_t:
  assumes "s \<in> {0,1}" "t \<in> {0,1}" "s \<noteq> t"
  shows "minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t
[PROOF STEP]
have [dest!]: "((2, vs), (0, vs')) \<notin> (step M)\<^sup>* \<or> ((2, vs), (1, vs')) \<notin> (step M)\<^sup>*"
    if "deterministic M" "0 \<notin> fst ` M" "1 \<notin> fst ` M" for M :: "(nat, nat) minsky" and vs vs'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((2, vs), 0, vs') \<notin> (step M)\<^sup>* \<or> ((2, vs), 1, vs') \<notin> (step M)\<^sup>*
[PROOF STEP]
using deterministic_minsky_UN[OF that(1) _ _ that(2,3)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?x, 0, ?vsa) \<in> (step M)\<^sup>*; (?x, 1, ?vs) \<in> (step M)\<^sup>*\<rbrakk> \<Longrightarrow> (0, ?vsa) = (1, ?vs)

goal (1 subgoal):
 1. ((2, vs), 0, vs') \<notin> (step M)\<^sup>* \<or> ((2, vs), 1, vs') \<notin> (step M)\<^sup>*
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>deterministic ?M; 0 \<notin> fst ` ?M; 1 \<notin> fst ` ?M\<rbrakk> \<Longrightarrow> ((2, ?vs), 0, ?vs') \<notin> (step ?M)\<^sup>* \<or> ((2, ?vs), 1, ?vs') \<notin> (step ?M)\<^sup>*

goal (1 subgoal):
 1. minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<in> {0, 1}
t \<in> {0, 1}
s \<noteq> t

goal (1 subgoal):
 1. minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t
[PROOF STEP]
by (auto simp: minsky_reaching_s_def minsky_reaching_s_not_t_def rev_image_eqI)
[PROOF STATE]
proof (state)
this:
minsky_reaching_s s \<subseteq> minsky_reaching_s_not_t s t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in prob_space) AE_convergence_imp_convergence_in_prob:
  assumes [measurable]: "\<And>i. random_variable borel (X i)" "random_variable borel Y"
  assumes AE: "AE x in M. (\<lambda>i. X i x) \<longlonglongrightarrow> Y x"
  assumes "\<epsilon> > (0 :: real)"
  shows   "(\<lambda>i. prob {x\<in>space M. \<bar>X i x - Y x\<bar> > \<epsilon>}) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
define A where "A = (\<lambda>i. {x\<in>space M. \<bar>X i x - Y x\<bar> > \<epsilon>})"
[PROOF STATE]
proof (state)
this:
A = (\<lambda>i. {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>})

goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
define B where "B = (\<lambda>n. (\<Union>i\<in>{n..}. A i))"
[PROOF STATE]
proof (state)
this:
B = (\<lambda>n. \<Union> (A ` {n..}))

goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
have [measurable]: "A i \<in> sets M"  "B i \<in> sets M" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A i \<in> events &&& B i \<in> events
[PROOF STEP]
unfolding A_def B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>} \<in> events &&& (\<Union>i\<in>{i..}. {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<in> events
[PROOF STEP]
by measurable
[PROOF STATE]
proof (state)
this:
A ?i12 \<in> events
B ?i12 \<in> events

goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
have "AE x in M. x \<notin> (\<Inter>i. B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. x \<notin> \<Inter> (range B)
[PROOF STEP]
using AE
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>i. X i x) \<longlonglongrightarrow> Y x

goal (1 subgoal):
 1. AE x in M. x \<notin> \<Inter> (range B)
[PROOF STEP]
unfolding B_def A_def
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>i. X i x) \<longlonglongrightarrow> Y x

goal (1 subgoal):
 1. AE x in M. x \<notin> (\<Inter>i. \<Union>i\<in>{i..}. {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>})
[PROOF STEP]
by eventually_elim
       (use \<open>\<epsilon> > 0\<close> in \<open>fastforce simp: tendsto_iff dist_norm eventually_at_top_linorder\<close>)
[PROOF STATE]
proof (state)
this:
AE x in M. x \<notin> \<Inter> (range B)

goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
hence "(\<Inter>i. B i) \<in> null_sets M"
[PROOF STATE]
proof (prove)
using this:
AE x in M. x \<notin> \<Inter> (range B)

goal (1 subgoal):
 1. \<Inter> (range B) \<in> null_sets M
[PROOF STEP]
by (subst AE_iff_null_sets) auto
[PROOF STATE]
proof (state)
this:
\<Inter> (range B) \<in> null_sets M

goal (1 subgoal):
 1. (\<lambda>i. prob {x \<in> space M. \<epsilon> < \<bar>X i x - Y x\<bar>}) \<longlonglongrightarrow> 0
[PROOF STEP]
show "(\<lambda>i. prob (A i)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. prob (A i)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule Lim_null_comparison)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> ?g x
 2. ?g \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>i. prob (B i)) \<longlonglongrightarrow> prob (\<Inter>i. B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. prob (B i)) \<longlonglongrightarrow> prob (\<Inter> (range B))
[PROOF STEP]
proof (rule finite_Lim_measure_decseq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. range B \<subseteq> events
 2. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) B
[PROOF STEP]
show "decseq B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) B
[PROOF STEP]
by (rule decseq_SucI) (force simp: B_def)
[PROOF STATE]
proof (state)
this:
monotone (\<le>) (\<lambda>x y. y \<subseteq> x) B

goal (1 subgoal):
 1. range B \<subseteq> events
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. prob (B i)) \<longlonglongrightarrow> prob (\<Inter> (range B))

goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> ?g x
 2. ?g \<longlonglongrightarrow> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. prob (B i)) \<longlonglongrightarrow> prob (\<Inter> (range B))

goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> ?g x
 2. ?g \<longlonglongrightarrow> 0
[PROOF STEP]
have "prob (\<Inter>i. B i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (\<Inter> (range B)) = 0
[PROOF STEP]
using \<open>(\<Inter>i. B i) \<in> null_sets M\<close>
[PROOF STATE]
proof (prove)
using this:
\<Inter> (range B) \<in> null_sets M

goal (1 subgoal):
 1. prob (\<Inter> (range B)) = 0
[PROOF STEP]
by (simp add: measure_eq_0_null_sets)
[PROOF STATE]
proof (state)
this:
prob (\<Inter> (range B)) = 0

goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> ?g x
 2. ?g \<longlonglongrightarrow> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. prob (B i)) \<longlonglongrightarrow> 0
[PROOF STEP]
show "(\<lambda>i. prob (B i)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. prob (B i)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>i. prob (B i)) \<longlonglongrightarrow> 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>i. prob (B i)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> prob (B x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> prob (B x)
[PROOF STEP]
have "prob (A n) \<le> prob (B n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (A n) \<le> prob (B n)
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (A n) \<le> prob (\<Union> (A ` {n..}))
[PROOF STEP]
by (intro finite_measure_mono) auto
[PROOF STATE]
proof (state)
this:
prob (A ?n12) \<le> prob (B ?n12)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. norm (prob (A x)) \<le> prob (B x)
[PROOF STEP]
thus "\<forall>\<^sub>F n in at_top. norm (prob (A n)) \<le> prob (B n)"
[PROOF STATE]
proof (prove)
using this:
prob (A ?n12) \<le> prob (B ?n12)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (prob (A n)) \<le> prob (B n)
[PROOF STEP]
by (intro always_eventually) auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm (prob (A n)) \<le> prob (B n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. prob (A i)) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ent_conjE2: "\<lbrakk>B\<Longrightarrow>\<^sub>AC\<rbrakk> \<Longrightarrow> A\<and>\<^sub>AB\<Longrightarrow>\<^sub>AC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<Longrightarrow>\<^sub>A C \<Longrightarrow> A \<and>\<^sub>A B \<Longrightarrow>\<^sub>A C
[PROOF STEP]
unfolding entails_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>h. h \<Turnstile> B \<longrightarrow> h \<Turnstile> C \<Longrightarrow> \<forall>h. h \<Turnstile> A \<and>\<^sub>A B \<longrightarrow> h \<Turnstile> C
[PROOF STEP]
by (auto simp: mod_and_dist)