[STATEMENT]
lemma f_sum_card_quadruple_set:
  assumes hAG: "A \<subseteq> G" and hA: "finite A"
  shows "(\<Sum> d \<in> (sumset A A). (f_sum d A)^2) = card (additive_quadruple_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
have fin: "\<forall> X \<in> ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
   additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` (sumset A A)). finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X\<in>(\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A. finite X
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A \<Longrightarrow> finite X
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A \<Longrightarrow> finite X
[PROOF STEP]
assume "X \<in>  (\<lambda>x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
      additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A"
[PROOF STATE]
proof (state)
this:
X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A

goal (1 subgoal):
 1. \<And>X. X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A \<Longrightarrow> finite X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A
[PROOF STEP]
obtain x where hX: "X = {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
      additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}"
[PROOF STATE]
proof (prove)
using this:
X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A

goal (1 subgoal):
 1. (\<And>x. X = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
X = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}

goal (1 subgoal):
 1. \<And>X. X \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A \<Longrightarrow> finite X
[PROOF STEP]
show "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
using hA hX finite_subset finite_cartesian_product
[PROOF STATE]
proof (prove)
using this:
finite A
X = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (?A \<times> ?B)

goal (1 subgoal):
 1. finite X
[PROOF STEP]
by (smt (verit, best) mem_Collect_eq mem_Sigma_iff rev_finite_subset subrelI)
[PROOF STATE]
proof (state)
this:
finite X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>X\<in>(\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A. finite X

goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
have "(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) =
    card (\<Union> ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
    additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` (sumset A A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})
[PROOF STEP]
using f_sum_card_eq hAG sum_card_image[of "sumset A A" "(\<lambda>x. {(a, b, c, d) |a b c d.
      a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})"]
      pairwise_disjoint_sum card_Union_disjoint[of "(\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and>
      c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` (sumset A A)"]
      fin pairwise_disjnt_quadruple_sum hA finite_sumset
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> G \<Longrightarrow> \<forall>x\<in>sumset ?A ?A. (f_sum x ?A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> ?A \<and> b \<in> ?A \<and> c \<in> ?A \<and> d \<in> ?A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}
A \<subseteq> G
\<lbrakk>finite (sumset A A); pairwise (\<lambda>s t. disjnt {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t}) (sumset A A)\<rbrakk> \<Longrightarrow> sum card ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A) = (\<Sum>a\<in>sumset A A. card {(aa, b, c, d) |aa b c d. aa \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple aa b c d \<and> aa \<oplus> b = a \<and> c \<oplus> d = a})
pairwise (\<lambda>s t. disjnt {(a, b, c, d) |a b c d. a \<in> ?A \<and> b \<in> ?A \<and> c \<in> ?A \<and> d \<in> ?A \<and> additive_quadruple a b c d \<and> a \<oplus> b = s \<and> c \<oplus> d = s} {(a, b, c, d) |a b c d. a \<in> ?A \<and> b \<in> ?A \<and> c \<in> ?A \<and> d \<in> ?A \<and> additive_quadruple a b c d \<and> a \<oplus> b = t \<and> c \<oplus> d = t}) (sumset ?A ?A)
\<lbrakk>pairwise disjnt ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A); \<And>Aa. Aa \<in> (\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A \<Longrightarrow> finite Aa\<rbrakk> \<Longrightarrow> card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) = sum card ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A)
\<forall>X\<in>(\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A. finite X
pairwise disjnt ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> ?A \<and> b \<in> ?A \<and> c \<in> ?A \<and> d \<in> ?A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset ?A ?A)
finite A
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)

goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})

goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})

goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
using quadruple_sum_Union_eq
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (\<Union>x\<in>sumset A A. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x})
(\<Union>x\<in>sumset ?A ?A. {(a, b, c, d) |a b c d. a \<in> ?A \<and> b \<in> ?A \<and> c \<in> ?A \<and> d \<in> ?A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) = additive_quadruple_set ?A

goal (1 subgoal):
 1. (\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>sumset A A. (f_sum d A)\<^sup>2) = card (additive_quadruple_set A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_not_elliptic_has_repelling_fixed_point:
  assumes "isometry f"
          "\<not>(elliptic_isometry f)"
  shows "\<exists>xi \<in> Gromov_boundary. Gromov_extension f xi = xi \<and> additive_strength f xi \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
have *: "\<not>elliptic_isometry (inv f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> elliptic_isometry (inv f)
[PROOF STEP]
using elliptic_isometry_inv_iff isometry_inverse(2)[OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
bij ?f \<Longrightarrow> elliptic_isometry (inv ?f) = elliptic_isometry ?f
bij f
\<not> elliptic_isometry f

goal (1 subgoal):
 1. \<not> elliptic_isometry (inv f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> elliptic_isometry (inv f)

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
obtain xi where xi: "xi \<in> Gromov_boundary" "Gromov_extension (inv f) xi = xi" "additive_strength (inv f) xi \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xi. \<lbrakk>xi \<in> Gromov_boundary; Gromov_extension (inv f) xi = xi; additive_strength (inv f) xi \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using isometry_not_elliptic_has_attracting_fixed_point[OF isometry_inverse(1)[OF assms(1)] *]
[PROOF STATE]
proof (prove)
using this:
\<exists>xi\<in>Gromov_boundary. Gromov_extension (inv f) xi = xi \<and> additive_strength (inv f) xi \<le> 0

goal (1 subgoal):
 1. (\<And>xi. \<lbrakk>xi \<in> Gromov_boundary; Gromov_extension (inv f) xi = xi; additive_strength (inv f) xi \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xi \<in> Gromov_boundary
Gromov_extension (inv f) xi = xi
additive_strength (inv f) xi \<le> 0

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
have *: "Gromov_extension f xi = xi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_extension f xi = xi
[PROOF STEP]
using Gromov_extension_inv_fixed_point[OF isometry_inverse(1)[OF assms(1)] xi(2)] inv_inv_eq[OF isometry_inverse(2)[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
Gromov_extension (inv (inv f)) xi = xi
inv (inv f) = f

goal (1 subgoal):
 1. Gromov_extension f xi = xi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gromov_extension f xi = xi

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Gromov_extension f xi = xi

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
have "additive_strength f xi \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> additive_strength f xi
[PROOF STEP]
using additive_strength_inv[OF assms(1) *] xi(3)
[PROOF STATE]
proof (prove)
using this:
additive_strength (inv f) xi = - additive_strength f xi
additive_strength (inv f) xi \<le> 0

goal (1 subgoal):
 1. 0 \<le> additive_strength f xi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> additive_strength f xi

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Gromov_extension f xi = xi
0 \<le> additive_strength f xi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Gromov_extension f xi = xi
0 \<le> additive_strength f xi

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
using xi(1)
[PROOF STATE]
proof (prove)
using this:
Gromov_extension f xi = xi
0 \<le> additive_strength f xi
xi \<in> Gromov_boundary

goal (1 subgoal):
 1. \<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>xi\<in>Gromov_boundary. Gromov_extension f xi = xi \<and> 0 \<le> additive_strength f xi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma if_is_pr: "\<lbrakk> p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda> x. if (p x = 0) then (q1 x) else (q2 x)) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
have if_as_pr: "(\<lambda> x. if (p x = 0) then (q1 x) else (q2 x)) = (\<lambda> x. (sgn2 (p x)) * (q1 x) + (sgn1 (p x)) * (q2 x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if p x = 0 then q1 x else q2 x) = (\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x)
[PROOF STEP]
proof (rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
show "(if (p x = 0) then (q1 x) else (q2 x)) = (sgn2 (p x)) * (q1 x) + (sgn1 (p x)) * (q2 x)" (is "?left = ?right")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
 2. \<not> ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
assume A1: "p x = 0"
[PROOF STATE]
proof (state)
this:
p x = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
 2. \<not> ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p x = 0
[PROOF STEP]
have S1: "?left = q1 x"
[PROOF STATE]
proof (prove)
using this:
p x = 0

goal (1 subgoal):
 1. (if p x = 0 then q1 x else q2 x) = q1 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x = 0 then q1 x else q2 x) = q1 x

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
 2. \<not> ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
p x = 0
[PROOF STEP]
have S2: "?right = q1 x"
[PROOF STATE]
proof (prove)
using this:
p x = 0

goal (1 subgoal):
 1. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x = q1 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn2 (p x) * q1 x + sgn1 (p x) * q2 x = q1 x

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
 2. \<not> ?P \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
(if p x = 0 then q1 x else q2 x) = q1 x
sgn2 (p x) * q1 x + sgn1 (p x) * q2 x = q1 x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if p x = 0 then q1 x else q2 x) = q1 x
sgn2 (p x) * q1 x + sgn1 (p x) * q2 x = q1 x

goal (1 subgoal):
 1. (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x

goal (1 subgoal):
 1. p x \<noteq> 0 \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p x \<noteq> 0 \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
assume A2: "p x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p x \<noteq> 0

goal (1 subgoal):
 1. p x \<noteq> 0 \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p x \<noteq> 0
[PROOF STEP]
have S3: "p x > 0"
[PROOF STATE]
proof (prove)
using this:
p x \<noteq> 0

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

goal (1 subgoal):
 1. p x \<noteq> 0 \<Longrightarrow> (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < p x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < p x

goal (1 subgoal):
 1. (if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(if p x = 0 then q1 x else q2 x) = sgn2 (p x) * q1 x + sgn1 (p x) * q2 x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if p x = 0 then q1 x else q2 x) = (\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x)

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
assume "p \<in> PrimRec1" and "q1 \<in> PrimRec1" and "q2 \<in> PrimRec1"
[PROOF STATE]
proof (state)
this:
p \<in> PrimRec1
q1 \<in> PrimRec1
q2 \<in> PrimRec1

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> PrimRec1
q1 \<in> PrimRec1
q2 \<in> PrimRec1
[PROOF STEP]
have "(\<lambda> x. (sgn2 (p x)) * (q1 x) + (sgn1 (p x)) * (q2 x)) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
p \<in> PrimRec1
q1 \<in> PrimRec1
q2 \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x) \<in> PrimRec1
[PROOF STEP]
by prec0
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x) \<in> PrimRec1

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec1; q1 \<in> PrimRec1; q2 \<in> PrimRec1\<rbrakk> \<Longrightarrow> (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
with if_as_pr
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. if p x = 0 then q1 x else q2 x) = (\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x)
(\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x) \<in> PrimRec1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. if p x = 0 then q1 x else q2 x) = (\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x)
(\<lambda>x. sgn2 (p x) * q1 x + sgn1 (p x) * q2 x) \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if p x = 0 then q1 x else q2 x) \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma WHILEI_unfold: "WHILEI I b f x = (
  if (I x) then (if b x then bind (f x) (WHILEI I b f) else return x) else top) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WHILEI I b f x = (if I x then if b x then bind (f x) (WHILEI I b f) else return x else top)
[PROOF STEP]
unfolding WHILEI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC (WHILEI_body bind return I b f) x = (if I x then if b x then bind (f x) (REC (WHILEI_body bind return I b f)) else return x else top)
[PROOF STEP]
apply (subst REC_unfold[OF WHILEI_body_trimono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. WHILEI_body bind return I b f (REC (WHILEI_body bind return I b f)) x = (if I x then if b x then bind (f x) (REC (WHILEI_body bind return I b f)) else return x else top)
[PROOF STEP]
unfolding WHILEI_body_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if I x then if b x then bind (f x) (REC (\<lambda>W s. if I s then if b s then bind (f s) W else return s else top)) else return x else top) = (if I x then if b x then bind (f x) (REC (\<lambda>W s. if I s then if b s then bind (f s) W else return s else top)) else return x else top)
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma harm_pos_iff [simp]: "harm n > (0 :: 'a :: {real_normed_field,linordered_field}) \<longleftrightarrow> n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < harm n) = (0 < n)
[PROOF STEP]
by (rule iffI, cases n, simp add: harm_expand, simp, rule harm_pos)


[STATEMENT]
lemma rank_of_eq_card_basis_in:
  assumes "basis_in \<E> B"
  shows "rank_of \<E> = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_of \<E> = card B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank_of \<E> = card B
[PROOF STEP]
have "{card B | B. basis_in \<E> B} = {card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {card B |B. basis_in \<E> B} = {card B}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
basis_in \<E> B

goal (1 subgoal):
 1. {card B |B. basis_in \<E> B} = {card B}
[PROOF STEP]
by safe (auto dest: basis_in_card[OF *])
[PROOF STATE]
proof (state)
this:
{card B |B. basis_in \<E> B} = {card B}

goal (1 subgoal):
 1. rank_of \<E> = card B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{card B |B. basis_in \<E> B} = {card B}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{card B |B. basis_in \<E> B} = {card B}

goal (1 subgoal):
 1. rank_of \<E> = card B
[PROOF STEP]
unfolding rank_of_def
[PROOF STATE]
proof (prove)
using this:
{card B |B. basis_in \<E> B} = {card B}

goal (1 subgoal):
 1. Min {card B |B. basis_in \<E> B} = card B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of \<E> = card B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma polyexp_ratfps [simp]: "fps_of_ratfps (polyexp_ratfps xs) = polyexp_fps xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_ratfps (polyexp_ratfps xs) = polyexp_fps xs
[PROOF STEP]
by (induction xs)
     (auto simp del: power_Suc fps_const_neg
           simp: coeff_0_power fps_of_poly_power fps_of_poly_smult fps_of_poly_pCons
                 fps_const_neg [symmetric] mult_ac polyexp_ratfps_Cons polyexp_fps_Cons)


[STATEMENT]
lemma hurwitz_zeta_real_bound_aux:
  fixes a x :: real
  assumes ax: "a > 0" "x > 1"
  shows "(\<Sum>i. (a + real (Suc i)) powr (-x)) \<le> a powr (1 - x) / (x - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. (a + real (Suc i)) powr - x) \<le> a powr (1 - x) / (x - 1)
[PROOF STEP]
proof (rule decreasing_sum_le_integral, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>xa. 0 \<le> xa \<Longrightarrow> 0 \<le> (a + xa) powr - x
 2. \<And>xa y. \<lbrakk>0 \<le> xa; xa \<le> y\<rbrakk> \<Longrightarrow> (a + y) powr - x \<le> (a + xa) powr - x
 3. ((\<lambda>b. (a + b) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}
[PROOF STEP]
have "((\<lambda>t. (a + t) powr -x) has_integral -(a powr (-x + 1)) / (-x + 1)) (interior {0..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. (a + t) powr - x) has_integral - (a powr (- x + 1)) / (- x + 1)) (interior {0..})
[PROOF STEP]
using powr_has_integral_at_top[of 0 a "-x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 0 + a; - x < - 1\<rbrakk> \<Longrightarrow> ((\<lambda>xa. (a + xa) powr - x) has_integral - ((a + 0) powr (- x + 1) / (- x + 1))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>t. (a + t) powr - x) has_integral - (a powr (- x + 1)) / (- x + 1)) (interior {0..})
[PROOF STEP]
using ax
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 0 + a; - x < - 1\<rbrakk> \<Longrightarrow> ((\<lambda>xa. (a + xa) powr - x) has_integral - ((a + 0) powr (- x + 1) / (- x + 1))) {0<..}
0 < a
1 < x

goal (1 subgoal):
 1. ((\<lambda>t. (a + t) powr - x) has_integral - (a powr (- x + 1)) / (- x + 1)) (interior {0..})
[PROOF STEP]
by (simp add: interior_real_atLeast)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. (a + t) powr - x) has_integral - (a powr (- x + 1)) / (- x + 1)) (interior {0..})

goal (3 subgoals):
 1. \<And>xa. 0 \<le> xa \<Longrightarrow> 0 \<le> (a + xa) powr - x
 2. \<And>xa y. \<lbrakk>0 \<le> xa; xa \<le> y\<rbrakk> \<Longrightarrow> (a + y) powr - x \<le> (a + xa) powr - x
 3. ((\<lambda>b. (a + b) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>t. (a + t) powr - x) has_integral - (a powr (- x + 1)) / (- x + 1)) (interior {0..})

goal (3 subgoals):
 1. \<And>xa. 0 \<le> xa \<Longrightarrow> 0 \<le> (a + xa) powr - x
 2. \<And>xa y. \<lbrakk>0 \<le> xa; xa \<le> y\<rbrakk> \<Longrightarrow> (a + y) powr - x \<le> (a + xa) powr - x
 3. ((\<lambda>b. (a + b) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}
[PROOF STEP]
have "-(a powr (- x + 1)) / (- x + 1) = a powr (1 - x) / (x - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (a powr (- x + 1)) / (- x + 1) = a powr (1 - x) / (x - 1)
[PROOF STEP]
using ax
[PROOF STATE]
proof (prove)
using this:
0 < a
1 < x

goal (1 subgoal):
 1. - (a powr (- x + 1)) / (- x + 1) = a powr (1 - x) / (x - 1)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
- (a powr (- x + 1)) / (- x + 1) = a powr (1 - x) / (x - 1)

goal (3 subgoals):
 1. \<And>xa. 0 \<le> xa \<Longrightarrow> 0 \<le> (a + xa) powr - x
 2. \<And>xa y. \<lbrakk>0 \<le> xa; xa \<le> y\<rbrakk> \<Longrightarrow> (a + y) powr - x \<le> (a + xa) powr - x
 3. ((\<lambda>b. (a + b) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>t. (a + t) powr - x) has_integral a powr (1 - x) / (x - 1)) (interior {0..})
[PROOF STEP]
show "((\<lambda>t. (a + t) powr -x) has_integral a powr (1 - x) / (x - 1)) {0..}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. (a + t) powr - x) has_integral a powr (1 - x) / (x - 1)) (interior {0..})

goal (1 subgoal):
 1. ((\<lambda>t. (a + t) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}
[PROOF STEP]
by (subst (asm) has_integral_interior) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>t. (a + t) powr - x) has_integral a powr (1 - x) / (x - 1)) {0..}

goal (2 subgoals):
 1. \<And>xa. 0 \<le> xa \<Longrightarrow> 0 \<le> (a + xa) powr - x
 2. \<And>xa y. \<lbrakk>0 \<le> xa; xa \<le> y\<rbrakk> \<Longrightarrow> (a + y) powr - x \<le> (a + xa) powr - x
[PROOF STEP]
qed (insert ax, auto intro!: powr_mono2')


[STATEMENT]
lemma (in aGroup) nsumTailTr:
         "(\<forall>j\<le>(Suc n). f j \<in> carrier A) \<longrightarrow>
          nsum A f (Suc n) = (nsum A (\<lambda> i. (f (Suc i))) n) \<plusminus> (f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0
[PROOF STEP]
apply (induct_tac "n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>Suc 0. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc 0 = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) 0 \<plusminus> f 0
 2. \<And>n. (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<Longrightarrow> (\<forall>j\<le>Suc (Suc n). f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) Suc n \<plusminus> f 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>Suc 0. f j \<in> carrier A) \<longrightarrow> f 0 \<plusminus> f (Suc 0) = f (Suc 0) \<plusminus> f 0
 2. \<And>n. (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<Longrightarrow> (\<forall>j\<le>Suc (Suc n). f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) Suc n \<plusminus> f 0
[PROOF STEP]
apply (rule impI,
         rule ag_pOp_commute)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>j\<le>Suc 0. f j \<in> carrier A \<Longrightarrow> f 0 \<in> carrier A
 2. \<forall>j\<le>Suc 0. f j \<in> carrier A \<Longrightarrow> f (Suc 0) \<in> carrier A
 3. \<And>n. (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<Longrightarrow> (\<forall>j\<le>Suc (Suc n). f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) Suc n \<plusminus> f 0
[PROOF STEP]
apply (cut_tac Nset_inc_0[of "Suc 0"],
         simp add:Pi_def,
         cut_tac n_in_Nsetn[of "Suc 0"],
         simp add:Pi_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<Longrightarrow> (\<forall>j\<le>Suc (Suc n). f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) Suc n \<plusminus> f 0
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>Suc n. f j \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; \<forall>j\<le>Suc (Suc n). f j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f Suc (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) Suc n \<plusminus> f 0
[PROOF STEP]
apply (cut_tac n = "Suc n" in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; \<forall>j\<le>Suc (Suc n). f j \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<plusminus> f (Suc (Suc n)) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply (frule_tac a = 0 in forall_spec, simp,
          frule_tac a = "Suc (Suc n)" in forall_spec, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; \<forall>j\<le>Suc (Suc n). f j \<in> carrier A; f 0 \<in> carrier A; f (Suc (Suc n)) \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<plusminus> f (Suc (Suc n)) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply (cut_tac n = n in nsum_mem[of  _  "\<lambda>i. f (Suc i)"],
          rule allI, rule impI,
          frule_tac a = "Suc j" in forall_spec, simp, simp,
          thin_tac "\<forall>j\<le>Suc (Suc n). f j \<in> carrier A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; f 0 \<in> carrier A; f (Suc (Suc n)) \<in> carrier A; \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0 \<plusminus> f (Suc (Suc n)) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply (subst ag_pOp_assoc, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; f 0 \<in> carrier A; f (Suc (Suc n)) \<in> carrier A; \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> (f 0 \<plusminus> f (Suc (Suc n))) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply (simp add:ag_pOp_commute[of  "f 0"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; f 0 \<in> carrier A; f (Suc (Suc n)) \<in> carrier A; \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> (f (Suc (Suc n)) \<plusminus> f 0) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply (subst ag_pOp_assoc[THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n \<plusminus> f (Suc n) = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f 0; f 0 \<in> carrier A; f (Suc (Suc n)) \<in> carrier A; \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0 = \<Sigma>\<^sub>e A (\<lambda>i. f (Suc i)) n \<plusminus> f (Suc (Suc n)) \<plusminus> f 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma expands_to_min_eq:
  assumes "(f expands_to F) basis" "eventually (\<lambda>x. f x = g x) at_top"
  shows   "((\<lambda>x. min (f x) (g x)) expands_to F) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. min (f x) (g x)) expands_to F) basis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
(f expands_to F) basis

goal (1 subgoal):
 1. ((\<lambda>x. min (f x) (g x)) expands_to F) basis
[PROOF STEP]
by (rule expands_to_cong) (insert assms(2), auto simp: min_def elim: eventually_mono)


[STATEMENT]
lemma homeomorphic_sym: "s homeomorphic t \<longleftrightarrow> t homeomorphic s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s homeomorphic t = t homeomorphic s
[PROOF STEP]
unfolding homeomorphic_def homeomorphism_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>f g. (\<forall>x\<in>s. g (f x) = x) \<and> f ` s = t \<and> continuous_on s f \<and> (\<forall>y\<in>t. f (g y) = y) \<and> g ` t = s \<and> continuous_on t g) = (\<exists>f g. (\<forall>x\<in>t. g (f x) = x) \<and> f ` t = s \<and> continuous_on t f \<and> (\<forall>y\<in>s. f (g y) = y) \<and> g ` s = t \<and> continuous_on s g)
[PROOF STEP]
by blast


[STATEMENT]
lemma Sum_map_pmf: assumes a: "map_pmf fa Da = Da'" and b: "map_pmf fb Db = Db'"
  shows "map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db)
              = Sum_pmf p Da' Db'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
have "map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db)
        = bind_pmf (Sum_pmf p Da Db) (f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x))
[PROOF STEP]
using a b
[PROOF STATE]
proof (prove)
using this:
map_pmf fa Da = Da'
map_pmf fb Db = Db'

goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x))
[PROOF STEP]
unfolding map_pmf_def sum_map_pmf_def f_on2_def
[PROOF STATE]
proof (prove)
using this:
Da \<bind> (\<lambda>x. return_pmf (fa x)) = Da'
Db \<bind> (\<lambda>x. return_pmf (fb x)) = Db'

goal (1 subgoal):
 1. Sum_pmf p Da Db \<bind> (\<lambda>x. return_pmf (case x of Inl e \<Rightarrow> Inl (fa e) | Inr e \<Rightarrow> Inr (fb e))) = Sum_pmf p Da Db \<bind> case_sum (\<lambda>e. return_pmf (fa e) \<bind> (\<lambda>x. return_pmf (Inl x))) (\<lambda>e. return_pmf (fb e) \<bind> (\<lambda>x. return_pmf (Inr x)))
[PROOF STEP]
by(auto simp add: bind_return_pmf sum.case_distrib)
[PROOF STATE]
proof (state)
this:
map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x))

goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x))

goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
have "\<dots> = Sum_pmf p Da' Db'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x)) = Sum_pmf p Da' Db'
[PROOF STEP]
using assms[unfolded map_pmf_def]
[PROOF STATE]
proof (prove)
using this:
Da \<bind> (\<lambda>x. return_pmf (fa x)) = Da'
Db \<bind> (\<lambda>x. return_pmf (fb x)) = Db'

goal (1 subgoal):
 1. Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x)) = Sum_pmf p Da' Db'
[PROOF STEP]
by(rule Sum_bind_pmf )
[PROOF STATE]
proof (state)
this:
Sum_pmf p Da Db \<bind> f_on2 (\<lambda>x. return_pmf (fa x)) (\<lambda>x. return_pmf (fb x)) = Sum_pmf p Da' Db'

goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'

goal (1 subgoal):
 1. map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map_pmf (sum_map_pmf fa fb) (Sum_pmf p Da Db) = Sum_pmf p Da' Db'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem soundness: "H |- p ==> H |= p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H |- p \<Longrightarrow> H |= p
[PROOF STEP]
by (induct set: thms) (auto simp: sat_def)


[STATEMENT]
theorem all_correct:
    "concat (cuts xs) = xs"
    "\<forall>c\<in>set (cuts xs). incr c \<or> decr c"
    "maxi (cuts xs)"
    "[] \<notin> set (cuts xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (concat (cuts xs) = xs &&& \<forall>c\<in>set (cuts xs). incr c \<or> decr c) &&& maxi (cuts xs) &&& [] \<notin> set (cuts xs)
[PROOF STEP]
using cuts_incr_decr concat_cuts maximal_cuts
          maxi_imp_non_empty[OF maximal_cuts]
[PROOF STATE]
proof (prove)
using this:
\<forall>c\<in>set (cuts ?xs). incr c \<or> decr c
concat (cuts ?xs) = ?xs
maxi (cuts ?xs)
[] \<notin> set (cuts ?xs1)

goal (1 subgoal):
 1. (concat (cuts xs) = xs &&& \<forall>c\<in>set (cuts xs). incr c \<or> decr c) &&& maxi (cuts xs) &&& [] \<notin> set (cuts xs)
[PROOF STEP]
by auto


[STATEMENT]
lemma iso_Euclidean_complements_lemma2:
  assumes S: "closedin (Euclidean_space m) S"
      and T: "closedin (Euclidean_space n) T"
      and hom: "homeomorphic_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f"
  obtains g where "homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n))
                                    (prod_topology (Euclidean_space n) (Euclidean_space m)) g"
                  "\<And>x. x \<in> S \<Longrightarrow> g(x,(\<lambda>i. 0)) = (f x,(\<lambda>i. 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain g where cmf: "continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f"
           and cmg: "continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g"
           and gf: "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
           and fg: "\<And>y. y \<in> T \<Longrightarrow> f (g y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f; continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g; \<And>x. x \<in> S \<Longrightarrow> g (f x) = x; \<And>y. y \<in> T \<Longrightarrow> f (g y) = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using hom S T closedin_subset
[PROOF STATE]
proof (prove)
using this:
homeomorphic_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f
closedin (Euclidean_space m) S
closedin (Euclidean_space n) T
closedin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f; continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g; \<And>x. x \<in> S \<Longrightarrow> g (f x) = x; \<And>y. y \<in> T \<Longrightarrow> f (g y) = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding homeomorphic_map_maps homeomorphic_maps_def
[PROOF STATE]
proof (prove)
using this:
\<exists>g. continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f \<and> continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g \<and> (\<forall>x\<in>topspace (subtopology (Euclidean_space m) S). g (f x) = x) \<and> (\<forall>y\<in>topspace (subtopology (Euclidean_space n) T). f (g y) = y)
closedin (Euclidean_space m) S
closedin (Euclidean_space n) T
closedin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f; continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g; \<And>x. x \<in> S \<Longrightarrow> g (f x) = x; \<And>y. y \<in> T \<Longrightarrow> f (g y) = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f
continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g
?x \<in> S \<Longrightarrow> g (f ?x) = ?x
?y \<in> T \<Longrightarrow> f (g ?y) = ?y

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain f' where cmf': "continuous_map (Euclidean_space m) (Euclidean_space n) f'"
             and f'f: "\<And>x. x \<in> S \<Longrightarrow> f' x = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f'. \<lbrakk>continuous_map (Euclidean_space m) (Euclidean_space n) f'; \<And>x. x \<in> S \<Longrightarrow> f' x = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using iso_Euclidean_complements_lemma1 S cmf continuous_map_into_fulltopology
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closedin (Euclidean_space ?m) ?S; continuous_map (subtopology (Euclidean_space ?m) ?S) (Euclidean_space ?n) ?f; \<And>g. \<lbrakk>continuous_map (Euclidean_space ?m) (Euclidean_space ?n) g; \<And>x. x \<in> ?S \<Longrightarrow> g x = ?f x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
closedin (Euclidean_space m) S
continuous_map (subtopology (Euclidean_space m) S) (subtopology (Euclidean_space n) T) f
continuous_map ?X (subtopology ?X' ?T) ?f \<Longrightarrow> continuous_map ?X ?X' ?f

goal (1 subgoal):
 1. (\<And>f'. \<lbrakk>continuous_map (Euclidean_space m) (Euclidean_space n) f'; \<And>x. x \<in> S \<Longrightarrow> f' x = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
continuous_map (Euclidean_space m) (Euclidean_space n) f'
?x \<in> S \<Longrightarrow> f' ?x = f ?x

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain g' where cmg': "continuous_map (Euclidean_space n) (Euclidean_space m) g'"
             and g'g: "\<And>x. x \<in> T \<Longrightarrow> g' x = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g'. \<lbrakk>continuous_map (Euclidean_space n) (Euclidean_space m) g'; \<And>x. x \<in> T \<Longrightarrow> g' x = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using iso_Euclidean_complements_lemma1 T cmg continuous_map_into_fulltopology
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closedin (Euclidean_space ?m) ?S; continuous_map (subtopology (Euclidean_space ?m) ?S) (Euclidean_space ?n) ?f; \<And>g. \<lbrakk>continuous_map (Euclidean_space ?m) (Euclidean_space ?n) g; \<And>x. x \<in> ?S \<Longrightarrow> g x = ?f x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
closedin (Euclidean_space n) T
continuous_map (subtopology (Euclidean_space n) T) (subtopology (Euclidean_space m) S) g
continuous_map ?X (subtopology ?X' ?T) ?f \<Longrightarrow> continuous_map ?X ?X' ?f

goal (1 subgoal):
 1. (\<And>g'. \<lbrakk>continuous_map (Euclidean_space n) (Euclidean_space m) g'; \<And>x. x \<in> T \<Longrightarrow> g' x = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
continuous_map (Euclidean_space n) (Euclidean_space m) g'
?x \<in> T \<Longrightarrow> g' ?x = g ?x

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define p  where "p \<equiv> \<lambda>(x,y). (x,(\<lambda>i. y i + f' x i))"
[PROOF STATE]
proof (state)
this:
p \<equiv> \<lambda>(x, y). (x, \<lambda>i. y i + f' x i)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define p' where "p' \<equiv> \<lambda>(x,y). (x,(\<lambda>i. y i - f' x i))"
[PROOF STATE]
proof (state)
this:
p' \<equiv> \<lambda>(x, y). (x, \<lambda>i. y i - f' x i)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define q  where "q \<equiv> \<lambda>(x,y). (x,(\<lambda>i. y i + g' x i))"
[PROOF STATE]
proof (state)
this:
q \<equiv> \<lambda>(x, y). (x, \<lambda>i. y i + g' x i)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define q' where "q' \<equiv> \<lambda>(x,y). (x,(\<lambda>i. y i - g' x i))"
[PROOF STATE]
proof (state)
this:
q' \<equiv> \<lambda>(x, y). (x, \<lambda>i. y i - g' x i)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n))
                          (prod_topology (Euclidean_space m) (Euclidean_space n))
                          p p'"
       "homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m))
                          (prod_topology (Euclidean_space n) (Euclidean_space m))
                          q q'"
       "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n))
                          (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x,y). (y,x)) (\<lambda>(x,y). (y,x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space m) (Euclidean_space n)) p p' &&& homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) (prod_topology (Euclidean_space n) (Euclidean_space m)) q q' &&& homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x, y). (y, x)) (\<lambda>(x, y). (y, x))
[PROOF STEP]
apply (simp_all add: p_def p'_def q_def q'_def homeomorphic_maps_def continuous_map_pairwise)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space m) (\<lambda>(x, y). x) \<and> continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space n) (\<lambda>(x, y) i. y i + f' x i) \<and> continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space m) (\<lambda>(x, y). x) \<and> continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space n) (\<lambda>(x, y) i. y i - f' x i)
 2. continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space n) (\<lambda>(x, y). x) \<and> continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space m) (\<lambda>(x, y) i. y i + g' x i) \<and> continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space n) (\<lambda>(x, y). x) \<and> continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space m) (\<lambda>(x, y) i. y i - g' x i)
 3. continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space n) (\<lambda>(x, y). y) \<and> continuous_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (Euclidean_space m) (\<lambda>(x, y). x) \<and> continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space m) (\<lambda>(x, y). y) \<and> continuous_map (prod_topology (Euclidean_space n) (Euclidean_space m)) (Euclidean_space n) (\<lambda>(x, y). x)
[PROOF STEP]
apply (force simp: case_prod_unfold continuous_map_of_fst [unfolded o_def] cmf' cmg' intro: continuous_intros)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space m) (Euclidean_space n)) p p'
homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) (prod_topology (Euclidean_space n) (Euclidean_space m)) q q'
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x, y). (y, x)) (\<lambda>(x, y). (y, x))

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space m) (Euclidean_space n)) p p'
homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) (prod_topology (Euclidean_space n) (Euclidean_space m)) q q'
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x, y). (y, x)) (\<lambda>(x, y). (y, x))
[PROOF STEP]
have "homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n))
                          (prod_topology (Euclidean_space n) (Euclidean_space m))
                          (q' \<circ> (\<lambda>(x,y). (y,x)) \<circ> p) (p' \<circ> ((\<lambda>(x,y). (y,x)) \<circ> q))"
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space m) (Euclidean_space n)) p p'
homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) (prod_topology (Euclidean_space n) (Euclidean_space m)) q q'
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x, y). (y, x)) (\<lambda>(x, y). (y, x))

goal (1 subgoal):
 1. homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))
[PROOF STEP]
using homeomorphic_maps_compose homeomorphic_maps_sym
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space m) (Euclidean_space n)) p p'
homeomorphic_maps (prod_topology (Euclidean_space n) (Euclidean_space m)) (prod_topology (Euclidean_space n) (Euclidean_space m)) q q'
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (\<lambda>(x, y). (y, x)) (\<lambda>(x, y). (y, x))
homeomorphic_maps ?X ?Y ?f ?h \<and> homeomorphic_maps ?Y ?X'' ?g ?k \<Longrightarrow> homeomorphic_maps ?X ?X'' (?g \<circ> ?f) (?h \<circ> ?k)
homeomorphic_maps ?X ?Y ?f ?g = homeomorphic_maps ?Y ?X ?g ?f

goal (1 subgoal):
 1. homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<And>x. x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x,y). (y,x)) \<circ> p) (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)
[PROOF STEP]
apply (simp add: q'_def p_def f'f)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> (\<lambda>i. x i - g' (f x) i) = (\<lambda>i. 0)
[PROOF STEP]
apply (simp add: fun_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> \<forall>xa. x xa = g' (f x) xa
[PROOF STEP]
by (metis S T closedin_subset g'g gf hom homeomorphic_imp_surjective_map image_eqI topspace_subtopology_subset)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (?x, \<lambda>i. 0) = (f ?x, \<lambda>i. 0)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) g; \<And>x. x \<in> S \<Longrightarrow> g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))
?x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (?x, \<lambda>i. 0) = (f ?x, \<lambda>i. 0)
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))
?x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (?x, \<lambda>i. 0) = (f ?x, \<lambda>i. 0)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using homeomorphic_map_maps that
[PROOF STATE]
proof (prove)
using this:
homeomorphic_maps (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (p' \<circ> ((\<lambda>(x, y). (y, x)) \<circ> q))
?x \<in> S \<Longrightarrow> (q' \<circ> (\<lambda>(x, y). (y, x)) \<circ> p) (?x, \<lambda>i. 0) = (f ?x, \<lambda>i. 0)
homeomorphic_map ?X ?Y ?f = (\<exists>g. homeomorphic_maps ?X ?Y ?f g)
\<lbrakk>homeomorphic_map (prod_topology (Euclidean_space m) (Euclidean_space n)) (prod_topology (Euclidean_space n) (Euclidean_space m)) ?g; \<And>x. x \<in> S \<Longrightarrow> ?g (x, \<lambda>i. 0) = (f x, \<lambda>i. 0)\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_extension_sequentially:
  fixes f :: "'a::{first_countable_topology, t2_space} \<Rightarrow> 'b::t3_space"
  assumes "T \<subseteq> closure S"
          "\<And>u b. (\<forall>n. u n \<in> S) \<Longrightarrow> b \<in> T \<Longrightarrow> u \<longlonglongrightarrow> b \<Longrightarrow> (\<lambda>n. f (u n)) \<longlonglongrightarrow> f b"
  shows "continuous_on T f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on T f
[PROOF STEP]
unfolding continuous_on_eq_continuous_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>T. continuous (at x within T) f
[PROOF STEP]
apply (auto intro!: continuous_within_subset[of _ "S \<union> T" f T])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> T \<Longrightarrow> continuous (at x within S \<union> T) f
[PROOF STEP]
by (intro continuous_at_extension_sequentially[OF _ assms], auto)


[STATEMENT]
lemma space_policy'[simp]: "h \<in> space (H i) \<Longrightarrow> s \<in> space Ms \<Longrightarrow> space (p i (h,s)) = space Ma"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> space (Pi\<^sub>M {0..<i} (\<lambda>_. M)); s \<in> space Ms\<rbrakk> \<Longrightarrow> space (p i (h, s)) = space Ma
[PROOF STEP]
using space_policy
[PROOF STATE]
proof (prove)
using this:
?hs \<in> space (Pi\<^sub>M {0..<?i} (\<lambda>_. M) \<Otimes>\<^sub>M Ms) \<Longrightarrow> space (p ?i ?hs) = space Ma

goal (1 subgoal):
 1. \<lbrakk>h \<in> space (Pi\<^sub>M {0..<i} (\<lambda>_. M)); s \<in> space Ms\<rbrakk> \<Longrightarrow> space (p i (h, s)) = space Ma
[PROOF STEP]
by (simp add: space_pair_measure)


[STATEMENT]
lemma seq_INF_distrib_UNIV: "c ; (\<Sqinter>x. d x) = (\<Sqinter>x. c ; d x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c ; \<Sqinter> range d = (\<Sqinter>x::'b. c ; d x)
variables:
d :: 'b \<Rightarrow> 'a
c :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
'b :: type
[PROOF STEP]
by (simp add: seq_INF_distrib)


[STATEMENT]
lemma bin_last_XOR [simp]: "(odd :: int \<Rightarrow> bool) (x XOR y) \<longleftrightarrow> ((odd :: int \<Rightarrow> bool) x \<or> (odd :: int \<Rightarrow> bool) y) \<and> \<not> ((odd :: int \<Rightarrow> bool) x \<and> (odd :: int \<Rightarrow> bool) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (x XOR y) = ((odd x \<or> odd y) \<and> \<not> (odd x \<and> odd y))
[PROOF STEP]
by (subst xor_int_rec) auto


[STATEMENT]
lemma scale_add3'[simp]: "ccw 0 a (b + x *\<^sub>R a) \<longleftrightarrow> ccw 0 a b"
  and scale_minus3[simp]: "ccw 0 a (x *\<^sub>R a - b) \<longleftrightarrow> ccw 0 b a"
  and scale_minus3'[simp]: "ccw 0 a (b - x *\<^sub>R a) \<longleftrightarrow> ccw 0 a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccw (0::'a) a (b + x *\<^sub>R a) = ccw (0::'a) a b &&& ccw (0::'a) a (x *\<^sub>R a - b) = ccw (0::'a) b a &&& ccw (0::'a) a (b - x *\<^sub>R a) = ccw (0::'a) a b
[PROOF STEP]
using
    scale_add3[of a x b]
    scale_add3[of a "-x" b]
    scale_add3[of a x "-b"]
[PROOF STATE]
proof (prove)
using this:
ccw (0::'a) a (x *\<^sub>R a + b) = ccw (0::'a) a b
ccw (0::'a) a (- x *\<^sub>R a + b) = ccw (0::'a) a b
ccw (0::'a) a (x *\<^sub>R a + - b) = ccw (0::'a) a (- b)

goal (1 subgoal):
 1. ccw (0::'a) a (b + x *\<^sub>R a) = ccw (0::'a) a b &&& ccw (0::'a) a (x *\<^sub>R a - b) = ccw (0::'a) b a &&& ccw (0::'a) a (b - x *\<^sub>R a) = ccw (0::'a) a b
[PROOF STEP]
by (simp_all add: ac_simps)


[STATEMENT]
lemma distrib_inf_sup_eq:
  "(class.distrib_lattice (\<sqinter>) ((\<le>)::'a \<Rightarrow> 'a \<Rightarrow> bool) (<) (\<squnion>)) =
    (\<forall> x y z::'a . x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>) = (\<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
fix x y z:: 'a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
assume A: "class.distrib_lattice (\<sqinter>) ((\<le>) ::'a \<Rightarrow> 'a \<Rightarrow> bool) (<) (\<squnion>)"
[PROOF STATE]
proof (state)
this:
class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
interpret distrib: distrib_lattice "(\<sqinter>)" "(\<le>) :: 'a \<Rightarrow> 'a \<Rightarrow> bool" "(<)" "(\<squnion>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
by (fact A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
assume B: "x \<sqinter> z = y \<sqinter> z"
[PROOF STATE]
proof (state)
this:
x \<sqinter> z = y \<sqinter> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
assume C: "x \<squnion> z = y \<squnion> z"
[PROOF STATE]
proof (state)
this:
x \<squnion> z = y \<squnion> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "x = x \<sqinter> (x \<squnion> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x \<sqinter> (x \<squnion> z)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = x \<sqinter> (x \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = x \<sqinter> (x \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "\<dots> = x \<sqinter> (y \<squnion> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (x \<squnion> z) = x \<sqinter> (y \<squnion> z)
[PROOF STEP]
by (simp add: C)
[PROOF STATE]
proof (state)
this:
x \<sqinter> (x \<squnion> z) = x \<sqinter> (y \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter> (x \<squnion> z) = x \<sqinter> (y \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "\<dots> = (x \<sqinter> y) \<squnion> (x \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (y \<squnion> z) = x \<sqinter> y \<squnion> x \<sqinter> z
[PROOF STEP]
by (simp add: distrib.inf_sup_distrib)
[PROOF STATE]
proof (state)
this:
x \<sqinter> (y \<squnion> z) = x \<sqinter> y \<squnion> x \<sqinter> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter> (y \<squnion> z) = x \<sqinter> y \<squnion> x \<sqinter> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "\<dots> = (y \<sqinter> x) \<squnion> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> y \<squnion> x \<sqinter> z = y \<sqinter> x \<squnion> y \<sqinter> z
[PROOF STEP]
by (simp add: B inf_commute)
[PROOF STATE]
proof (state)
this:
x \<sqinter> y \<squnion> x \<sqinter> z = y \<sqinter> x \<squnion> y \<sqinter> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqinter> y \<squnion> x \<sqinter> z = y \<sqinter> x \<squnion> y \<sqinter> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "\<dots> = y \<sqinter> (x \<squnion> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<sqinter> x \<squnion> y \<sqinter> z = y \<sqinter> (x \<squnion> z)
[PROOF STEP]
by (simp add: distrib.inf_sup_distrib)
[PROOF STATE]
proof (state)
this:
y \<sqinter> x \<squnion> y \<sqinter> z = y \<sqinter> (x \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y \<sqinter> x \<squnion> y \<sqinter> z = y \<sqinter> (x \<squnion> z)

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have "\<dots> = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<sqinter> (x \<squnion> z) = y
[PROOF STEP]
by (simp add: C)
[PROOF STATE]
proof (state)
this:
y \<sqinter> (x \<squnion> z) = y

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>); x \<sqinter> z = y \<sqinter> z; x \<squnion> z = y \<squnion> z\<rbrakk> \<Longrightarrow> x = y
 2. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x = y
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x = y

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

goal (1 subgoal):
 1. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
assume A: "(\<forall>x y z:: 'a. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y)"
[PROOF STATE]
proof (state)
this:
\<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y

goal (1 subgoal):
 1. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
have B: "!! x y z :: 'a. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<Longrightarrow> x = y
[PROOF STEP]
by (cut_tac A, blast)
[PROOF STATE]
proof (state)
this:
?x \<sqinter> ?z = ?y \<sqinter> ?z \<and> ?x \<squnion> ?z = ?y \<squnion> ?z \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<forall>x y z. x \<sqinter> z = y \<sqinter> z \<and> x \<squnion> z = y \<squnion> z \<longrightarrow> x = y \<Longrightarrow> class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
show "class.distrib_lattice (\<sqinter>) ((\<le>)::'a \<Rightarrow> 'a \<Rightarrow> bool) (<) (\<squnion>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)
[PROOF STEP]
apply (unfold distrib_not_N5_M5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a b c. \<not> N5_lattice a b c) \<and> (\<forall>a b c. \<not> M5_lattice a b c)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b c. N5_lattice a b c \<Longrightarrow> False
 2. \<And>a b c. M5_lattice a b c \<Longrightarrow> False
[PROOF STEP]
apply (unfold N5_lattice_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b c. a \<sqinter> c = b \<sqinter> c \<and> a < b \<and> a \<squnion> c = b \<squnion> c \<Longrightarrow> False
 2. \<And>a b c. M5_lattice a b c \<Longrightarrow> False
[PROOF STEP]
apply (cut_tac x = a and y = b and z = c in B)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a b c. a \<sqinter> c = b \<sqinter> c \<and> a < b \<and> a \<squnion> c = b \<squnion> c \<Longrightarrow> a \<sqinter> c = b \<sqinter> c \<and> a \<squnion> c = b \<squnion> c
 2. \<And>a b c. \<lbrakk>a \<sqinter> c = b \<sqinter> c \<and> a < b \<and> a \<squnion> c = b \<squnion> c; a = b\<rbrakk> \<Longrightarrow> False
 3. \<And>a b c. M5_lattice a b c \<Longrightarrow> False
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. M5_lattice a b c \<Longrightarrow> False
[PROOF STEP]
apply (unfold M5_lattice_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. a \<sqinter> b = b \<sqinter> c \<and> c \<sqinter> a = b \<sqinter> c \<and> a \<squnion> b = b \<squnion> c \<and> c \<squnion> a = b \<squnion> c \<and> a \<sqinter> b < a \<squnion> b \<Longrightarrow> False
[PROOF STEP]
apply (cut_tac x = a and y = b and z = c in B)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b c. a \<sqinter> b = b \<sqinter> c \<and> c \<sqinter> a = b \<sqinter> c \<and> a \<squnion> b = b \<squnion> c \<and> c \<squnion> a = b \<squnion> c \<and> a \<sqinter> b < a \<squnion> b \<Longrightarrow> a \<sqinter> c = b \<sqinter> c \<and> a \<squnion> c = b \<squnion> c
 2. \<And>a b c. \<lbrakk>a \<sqinter> b = b \<sqinter> c \<and> c \<sqinter> a = b \<sqinter> c \<and> a \<squnion> b = b \<squnion> c \<and> c \<squnion> a = b \<squnion> c \<and> a \<sqinter> b < a \<squnion> b; a = b\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (simp_all add: inf_commute sup_commute)
[PROOF STATE]
proof (state)
this:
class.distrib_lattice (\<sqinter>) (\<le>) (<) (\<squnion>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma projection_cadjoint:
  fixes M :: \<open>'a::chilbert_space set\<close>
  assumes \<open>closed_csubspace M\<close>
  shows \<open>(projection M)\<^sup>\<dagger> = projection M\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection M\<^sup>\<dagger> = projection M
[PROOF STEP]
using is_projection_on_cadjoint assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_projection_on ?\<pi> ?M; closed_csubspace ?M\<rbrakk> \<Longrightarrow> ?\<pi>\<^sup>\<dagger> = ?\<pi>
closed_csubspace M

goal (1 subgoal):
 1. projection M\<^sup>\<dagger> = projection M
[PROOF STEP]
by (metis closed_csubspace.closed closed_csubspace.subspace csubspace_is_convex empty_iff orthog_proj_exists projection_is_projection_on)


[STATEMENT]
lemma meet_cont[cont2cont,simp]:"cont f \<Longrightarrow> cont g \<Longrightarrow> cont (\<lambda>x. (f x \<sqinter> (g x::'a::cont_binary_meet)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. f x \<sqinter> g x)
[PROOF STEP]
apply (rule cont2cont_case_prod[where g = "\<lambda> x. (f x, g x)" and f = "\<lambda> p x y . x \<sqinter> y", simplified])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>b. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>a. a \<sqinter> b)
 2. \<And>a. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont ((\<sqinter>) a)
 3. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. (f x, g x))
[PROOF STEP]
apply (rule meet_cont1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont ((\<sqinter>) a)
 2. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. (f x, g x))
[PROOF STEP]
apply (rule meet_cont2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cont f; cont g\<rbrakk> \<Longrightarrow> cont (\<lambda>x. (f x, g x))
[PROOF STEP]
apply (metis cont2cont_Pair)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma erf_conv_erfc: "erf z = 1 - erfc z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf z = (1::'a) - erfc z
[PROOF STEP]
by (simp add: erfc_def)


[STATEMENT]
lemma set_of_uminus: "set_of (-X) = {- x | x. x \<in> set_of X}"
  for X :: "'a :: ordered_ab_group_add interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (- X) = {- x |x. x \<in>\<^sub>i X}
[PROOF STEP]
by (auto simp: set_of_eq simp: le_minus_iff minus_le_iff
      intro!: exI[where x="-x" for x])


[STATEMENT]
lemma norm_v_eq_0: "norm_v v = 0 \<longleftrightarrow> v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_vector cmod v = 0) = (v = 0)
[PROOF STEP]
by (auto simp: map_vector_def vec_eq_iff)


[STATEMENT]
lemma tuple_partial_image_closed:
  assumes "length fs > 0"
  assumes "is_function_tuple Q\<^sub>p n fs"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n+l\<^esup>)"
  shows "tuple_partial_image n fs x \<in> carrier (Q\<^sub>p\<^bsup>length fs + l\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_partial_image n fs x \<in> carrier (Q\<^sub>p\<^bsup>length fs + l\<^esup>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < length fs
is_function_tuple Q\<^sub>p n fs
x \<in> carrier (Q\<^sub>p\<^bsup>n + l\<^esup>)

goal (1 subgoal):
 1. tuple_partial_image n fs x \<in> carrier (Q\<^sub>p\<^bsup>length fs + l\<^esup>)
[PROOF STEP]
unfolding tuple_partial_image_def
[PROOF STATE]
proof (prove)
using this:
0 < length fs
is_function_tuple Q\<^sub>p n fs
x \<in> carrier (Q\<^sub>p\<^bsup>n + l\<^esup>)

goal (1 subgoal):
 1. function_tuple_eval Q\<^sub>p n fs (take n x) @ drop n x \<in> carrier (Q\<^sub>p\<^bsup>length fs + l\<^esup>)
[PROOF STEP]
by (meson cartesian_power_concat(1) cartesian_power_drop
      function_tuple_eval_closed le_add1 take_closed)


[STATEMENT]
lemma tseytin_tran_few_clauses: "card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
have "size Bot = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size \<bottom> = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size \<bottom> = 1

goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
(* just a thing to keep in mind. *)
[PROOF STATE]
proof (state)
this:
size \<bottom> = 1

goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
have ws: "{c \<triangleright> D |D. D = {c1} \<or> D = {c2}} = {{c,c1},{c,c2}}" for c1 c2 c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c \<triangleright> D |D. D = {c1} \<or> D = {c2}} = {{c, c1}, {c, c2}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{?c2 \<triangleright> D |D. D = {?c1.2} \<or> D = {?c2.2}} = {{?c2, ?c1.2}, {?c2, ?c2.2}}

goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
have grr: "Suc (card S) \<le> c \<Longrightarrow> card (a \<triangleright> S) \<le> c" for a S c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card S) \<le> c \<Longrightarrow> card (a \<triangleright> S) \<le> c
[PROOF STEP]
by(cases "finite S"; simp add: card_insert_le_m1)
[PROOF STATE]
proof (state)
this:
Suc (card ?S3) \<le> ?c3 \<Longrightarrow> card (?a3 \<triangleright> ?S3) \<le> ?c3

goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
have *: "card (\<Union>a\<in>set (tseytin_tran1 (Atom \<circ> S) F). cnf (nnf a)) \<le> 3 * size F" for S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>a\<in>set (tseytin_tran1 (Atom \<circ> S) F). cnf (nnf a)) \<le> 3 * size F
[PROOF STEP]
by(induction F; simp add: biimp_def; ((intro grr card_Un_le[THEN le_trans] | simp add: ws)+)?)
[PROOF STATE]
proof (state)
this:
card (\<Union>a\<in>set (tseytin_tran1 (Atom \<circ> ?S3) F). cnf (nnf a)) \<le> 3 * size F

goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1
[PROOF STEP]
unfolding tseytin_tran_def tseytin_toatom_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (cnf (nnf \<^bold>\<And>(Atom \<circ> the \<circ> map_of (map (\<lambda>(a, b). (b, a)) (tseytin_assmt F))) F # tseytin_tran1 (Atom \<circ> the \<circ> map_of (map (\<lambda>(a, b). (b, a)) (tseytin_assmt F))) F)) \<le> 3 * size F + 1
[PROOF STEP]
by(clarsimp simp: nnf_BigAnd cnf_BigAnd; intro grr; simp add: comp_assoc *)
[PROOF STATE]
proof (state)
this:
card (cnf (nnf (tseytin_tran F))) \<le> 3 * size F + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap:
  "F (image_mset (\<lambda>i. F (image_mset (g i) B)) A) =
    F (image_mset (\<lambda>j. F (image_mset (\<lambda>i. g i j) A)) B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F {#F (image_mset (g i) B). i \<in># A#} = F {#F {#g i j. i \<in># A#}. j \<in># B#}
[PROOF STEP]
apply (induction A, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x A. F {#F (image_mset (g i) B). i \<in># A#} = F {#F {#g i j. i \<in># A#}. j \<in># B#} \<Longrightarrow> F {#F (image_mset (g i) B). i \<in># add_mset x A#} = F {#F {#g i j. i \<in># add_mset x A#}. j \<in># B#}
[PROOF STEP]
apply (induction B, auto simp add: F_image_mset_product ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_complex_in_o_x_axis_disc [simp]:
  shows "of_complex z \<in> disc o_x_axis \<longleftrightarrow> Im z < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_complex z \<in> disc o_x_axis) = (Im z < 0)
[PROOF STEP]
unfolding disc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_complex z \<in> Collect (in_ocircline o_x_axis)) = (Im z < 0)
[PROOF STEP]
by auto (transfer, transfer, simp add: vec_cnj_def)+


[STATEMENT]
lemma poly_number_rootat: "poly_inf (real_of_rat_poly p) = real_of_rat (poly_number_rootat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_inf (real_of_rat_poly p) = real_of_rat (poly_number_rootat p)
[PROOF STEP]
unfolding poly_inf_def poly_number_rootat_def of_int_hom.degree_map_poly_hom of_rat_hom.coeff_map_poly_hom
    real_of_rat_sgn
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (sgn (coeff p (degree (real_of_rat_poly p)))) = real_of_rat (sgn (lead_coeff p))
[PROOF STEP]
by simp


[STATEMENT]
lemma ordinal_less_plusR: "0 < y \<Longrightarrow> x < x + (y::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x < x + y
[PROOF STEP]
by (drule_tac ordinal_plus_strict_monoR, simp)


[STATEMENT]
lemma atLeastatMost_psubset_iff:
  "{a\<le>\<^sub>a..\<le>\<^sub>ab} < {c\<le>\<^sub>a..\<le>\<^sub>ad} \<longleftrightarrow>
    ((\<not> a \<le>\<^sub>a b) \<or> c \<le>\<^sub>a a \<and> b \<le>\<^sub>a d \<and> (c <\<^sub>a a \<or> b <\<^sub>a d)) \<and> c \<le>\<^sub>a d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a\<le>\<^sub>a..\<le>\<^sub>ab} \<subset> {c\<le>\<^sub>a..\<le>\<^sub>ad}) = ((\<not> a \<le>\<^sub>a b \<or> c \<le>\<^sub>a a \<and> b \<le>\<^sub>a d \<and> (c <\<^sub>a a \<or> b <\<^sub>a d)) \<and> c \<le>\<^sub>a d)
[PROOF STEP]
by (simp add: psubset_eq set_eq_iff less_le_not_le)
    (blast intro: order_trans)


[STATEMENT]
lemma ProjInd_aHom1:"\<lbrakk>\<forall>j\<in> I. aGroup (A j); f \<in> carrier (a\<Pi>\<^bsub>I\<^esub> A) \<rightarrow> B;
      bij_to f (carrier (a\<Pi>\<^bsub>I\<^esub> A)) (B::'d set)\<rbrakk> \<Longrightarrow>
        \<forall>j\<in>I. (ProjInd I A f j) \<in> aHom (Ag_ind (a\<Pi>\<^bsub>I\<^esub> A) f) (A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<in>I. aGroup (A j); f \<in> carrier (a\<Pi>\<^bsub>I\<^esub> A) \<rightarrow> B; bij_to f (carrier (a\<Pi>\<^bsub>I\<^esub> A)) B\<rbrakk> \<Longrightarrow> \<forall>j\<in>I. ProjInd I A f j \<in> aHom (Ag_ind (a\<Pi>\<^bsub>I\<^esub> A) f) (A j)
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<forall>j\<in>I. aGroup (A j); f \<in> carrier (a\<Pi>\<^bsub>I\<^esub> A) \<rightarrow> B; bij_to f (carrier (a\<Pi>\<^bsub>I\<^esub> A)) B; j \<in> I\<rbrakk> \<Longrightarrow> ProjInd I A f j \<in> aHom (Ag_ind (a\<Pi>\<^bsub>I\<^esub> A) f) (A j)
[PROOF STEP]
apply (simp add:ProjInd_aHom)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ball_subseteq:
    "(Ball s1 (\<lambda>x. x\<in>s2)) \<longleftrightarrow> s1 \<subseteq> s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s1. x \<in> s2) = (s1 \<subseteq> s2)
[PROOF STEP]
by blast


[STATEMENT]
lemma synth_payload:
  "Y \<inter> payload = {} \<Longrightarrow> synth (X \<union> Y) \<subseteq> synth X \<union> -payload"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y \<inter> payload = {} \<Longrightarrow> synth (X \<union> Y) \<subseteq> synth X \<union> - payload
[PROOF STEP]
by (rule, erule synth.induct) (auto)


[STATEMENT]
lemma greaterThanLessThan_eq_iff:
  fixes r s t u::real
  shows "({r<..<s} = {t<..<u}) = (r \<ge> s \<and> u \<le> t \<or> r = t \<and> s = u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({r<..<s} = {t<..<u}) = (s \<le> r \<and> u \<le> t \<or> r = t \<and> s = u)
[PROOF STEP]
by (metis cInf_greaterThanLessThan cSup_greaterThanLessThan greaterThanLessThan_empty_iff not_le)


[STATEMENT]
lemma dvd_imp_multiplicity_le:
  assumes "a dvd b" "b \<noteq> 0"
  shows   "multiplicity p a \<le> multiplicity p b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p a \<le> multiplicity p b
[PROOF STEP]
proof (cases "is_unit p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_unit p \<Longrightarrow> multiplicity p a \<le> multiplicity p b
 2. \<not> is_unit p \<Longrightarrow> multiplicity p a \<le> multiplicity p b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> is_unit p

goal (2 subgoals):
 1. is_unit p \<Longrightarrow> multiplicity p a \<le> multiplicity p b
 2. \<not> is_unit p \<Longrightarrow> multiplicity p a \<le> multiplicity p b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a dvd b
b \<noteq> (0::'a)
\<not> is_unit p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a dvd b
b \<noteq> (0::'a)
\<not> is_unit p

goal (1 subgoal):
 1. multiplicity p a \<le> multiplicity p b
[PROOF STEP]
by (intro multiplicity_geI ) (auto intro: dvd_trans[OF multiplicity_dvd' assms(1)])
[PROOF STATE]
proof (state)
this:
multiplicity p a \<le> multiplicity p b

goal (1 subgoal):
 1. is_unit p \<Longrightarrow> multiplicity p a \<le> multiplicity p b
[PROOF STEP]
qed (insert assms, auto simp: multiplicity_unit_left)


[STATEMENT]
lemma weight_bind_spmf: "weight_spmf (x \<bind> f) = lebesgue_integral (measure_spmf x) (weight_spmf \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weight_spmf (x \<bind> f) = integral\<^sup>L (measure_spmf x) (weight_spmf \<circ> f)
[PROOF STEP]
unfolding weight_spmf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (measure_spmf (x \<bind> f)) UNIV = integral\<^sup>L (measure_spmf x) ((\<lambda>p. Sigma_Algebra.measure (measure_spmf p) UNIV) \<circ> f)
[PROOF STEP]
by(simp add: measure_spmf_bind o_def measure_spmf.measure_bind[where N="count_space UNIV"])


[STATEMENT]
lemma Ana_Fu_keys_length_eq:
  assumes "length T = length S"
  shows "length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
proof (cases "arity\<^sub>f f = length T \<and> arity\<^sub>f f > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
 2. \<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f) \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f

goal (2 subgoals):
 1. arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
 2. \<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f) \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f

goal (1 subgoal):
 1. length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f
length T = length S

goal (1 subgoal):
 1. length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
by (cases "Ana\<^sub>f f") auto
[PROOF STATE]
proof (state)
this:
length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))

goal (1 subgoal):
 1. \<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f) \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f) \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f)

goal (1 subgoal):
 1. \<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f) \<Longrightarrow> length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f)

goal (1 subgoal):
 1. length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> (arity\<^sub>f f = length T \<and> 0 < arity\<^sub>f f)
length T = length S

goal (1 subgoal):
 1. length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
length (fst (Ana (Fun (Fu f) T))) = length (fst (Ana (Fun (Fu f) S)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma
  fixes A :: "'a::comm_monoid_add set"
  shows insert_set_plus: "(insert a A) + B = (A+B) \<union> (((+)a) ` B)" and set_plus_insert: "B + (insert a A) = (B+A) \<union> (((+)a) ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a A + B = A + B \<union> (+) a ` B &&& B + insert a A = B + A \<union> (+) a ` B
[PROOF STEP]
using add.commute
[PROOF STATE]
proof (prove)
using this:
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. insert a A + B = A + B \<union> (+) a ` B &&& B + insert a A = B + A \<union> (+) a ` B
[PROOF STEP]
by (auto simp: set_plus_def)


[STATEMENT]
lemma clauseTrueIffContainsTrueLiteral:
  fixes clause :: Clause and valuation :: Valuation
  shows "clauseTrue clause valuation = (\<exists> literal. literal el clause \<and> literalTrue literal valuation)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clauseTrue clause valuation = (\<exists>literal. literal el clause \<and> literalTrue literal valuation)
[PROOF STEP]
by (induct clause) auto