[STATEMENT]
lemma Ord_cases_lemma:
  assumes "Ord k" shows "k = 0 \<or> (\<exists>j. k = succ j) \<or> Limit k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
proof (cases "Limit k")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
 2. \<not> Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> Limit k

goal (2 subgoals):
 1. Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
 2. \<not> Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
have "succ j \<in> elts k" if  "\<forall>j. k \<noteq> succ j" "j \<in> elts k" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.succ j \<in> elts k
[PROOF STEP]
by (metis Ord_in_Ord Ord_linear Ord_succ assms elts_succ insertE mem_not_sym that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>j. k \<noteq> ZFC_in_HOL.succ j; ?j \<in> elts k\<rbrakk> \<Longrightarrow> ZFC_in_HOL.succ ?j \<in> elts k

goal (2 subgoals):
 1. Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
 2. \<not> Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Ord k
\<lbrakk>\<forall>j. k \<noteq> ZFC_in_HOL.succ j; ?j \<in> elts k\<rbrakk> \<Longrightarrow> ZFC_in_HOL.succ ?j \<in> elts k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ord k
\<lbrakk>\<forall>j. k \<noteq> ZFC_in_HOL.succ j; ?j \<in> elts k\<rbrakk> \<Longrightarrow> ZFC_in_HOL.succ ?j \<in> elts k

goal (1 subgoal):
 1. k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
by (auto simp: Limit_def mem_0_Ord)
[PROOF STATE]
proof (state)
this:
k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k

goal (1 subgoal):
 1. Limit k \<Longrightarrow> k = 0 \<or> (\<exists>j. k = ZFC_in_HOL.succ j) \<or> Limit k
[PROOF STEP]
qed auto


[STATEMENT]
lemma siterate_smap: "siterate f x = x ## (smap f (siterate f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. siterate f x = x ## smap f (siterate f x)
[PROOF STEP]
by transfer (rule iterates_lmap)


[STATEMENT]
lemma poincare_distance_formula:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc"
  shows "poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)" (is "?P u v")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
proof (rule wlog_x_axis)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
 4. \<And>x. \<lbrakk>is_real x; 0 \<le> Re x; Re x < 1\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
 4. \<And>x. \<lbrakk>is_real x; 0 \<le> Re x; Re x < 1\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
assume *: "is_real x" "0 \<le> Re x" "Re x < 1"
[PROOF STATE]
proof (state)
this:
is_real x
0 \<le> Re x
Re x < 1

goal (4 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
 4. \<And>x. \<lbrakk>is_real x; 0 \<le> Re x; Re x < 1\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
show "?P  0\<^sub>h (of_complex x)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
have "of_complex x \<in> unit_disc" "of_complex x \<in> circline_set x_axis" "cmod x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex x \<in> unit_disc &&& of_complex x \<in> circline_set x_axis &&& cmod x < 1
[PROOF STEP]
using * cmod_eq_Re
[PROOF STATE]
proof (prove)
using this:
is_real x
0 \<le> Re x
Re x < 1
is_real ?z \<Longrightarrow> cmod ?z = \<bar>Re ?z\<bar>

goal (1 subgoal):
 1. of_complex x \<in> unit_disc &&& of_complex x \<in> circline_set x_axis &&& cmod x < 1
[PROOF STEP]
by (auto simp add: circline_set_x_axis)
[PROOF STATE]
proof (state)
this:
of_complex x \<in> unit_disc
of_complex x \<in> circline_set x_axis
cmod x < 1

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
hence "?lhs = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>"
[PROOF STATE]
proof (prove)
using this:
of_complex x \<in> unit_disc
of_complex x \<in> circline_set x_axis
cmod x < 1

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
using poincare_distance_zero_x_axis[of "of_complex x"]
[PROOF STATE]
proof (prove)
using this:
of_complex x \<in> unit_disc
of_complex x \<in> circline_set x_axis
cmod x < 1
\<lbrakk>of_complex x \<in> unit_disc; of_complex x \<in> circline_set x_axis\<rbrakk> \<Longrightarrow> poincare_distance 0\<^sub>h (of_complex x) = (let x' = to_complex (of_complex x) in \<bar>ln (Re ((1 - x') / (1 + x')))\<bar>)

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
have "?rhs = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
let ?x = "1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "0 \<le> 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)
[PROOF STEP]
by (smt \<open>cmod x < 1\<close> divide_nonneg_nonneg norm_ge_zero power_le_one zero_le_power2)
[PROOF STATE]
proof (state)
this:
0 \<le> 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
hence arcosh_real_gt: "1 \<le> ?x"
[PROOF STATE]
proof (prove)
using this:
0 \<le> 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)

goal (1 subgoal):
 1. 1 \<le> 1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 \<le> 1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "?rhs = arcosh ?x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "... = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * (cmod x) / (1 - (cmod x)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
have "1 - (cmod x)\<^sup>2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2
[PROOF STEP]
using \<open>cmod x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
cmod x < 1

goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2
[PROOF STEP]
by (smt norm_not_less_zero one_power2 power2_eq_imp_eq power_mono)
[PROOF STATE]
proof (state)
this:
0 < 1 - (cmod x)\<^sup>2

goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
hence 1: "?x = (1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
0 < 1 - (cmod x)\<^sup>2

goal (1 subgoal):
 1. 1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2) = (1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2) = (1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2)

goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
have 2: "?x\<^sup>2 - 1 = (4 * (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))\<^sup>2 - 1 = 4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2
[PROOF STEP]
using \<open>1 - (cmod x)\<^sup>2 > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < 1 - (cmod x)\<^sup>2

goal (1 subgoal):
 1. (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))\<^sup>2 - 1 = 4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2
[PROOF STEP]
apply (subst 1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2))\<^sup>2 - 1 = 4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2
[PROOF STEP]
unfolding power_divide
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> (1 + (cmod x)\<^sup>2)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2 - 1 = 4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2
[PROOF STEP]
by (subst divide_diff_eq_iff, simp, simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
(1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))\<^sup>2 - 1 = 4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
using \<open>1 - (cmod x)\<^sup>2 > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < 1 - (cmod x)\<^sup>2

goal (1 subgoal):
 1. arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst arcosh_real_def[OF arcosh_real_gt])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ln (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2) + sqrt ((1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))\<^sup>2 - 1)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst 2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ln (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2) + sqrt (4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst 1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + sqrt (4 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst real_sqrt_divide)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + sqrt (4 * (cmod x)\<^sup>2) / sqrt ((1 - (cmod x)\<^sup>2)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst real_sqrt_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 - (cmod x)\<^sup>2 \<Longrightarrow> ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + sqrt 4 * sqrt ((cmod x)\<^sup>2) / sqrt ((1 - (cmod x)\<^sup>2)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arcosh (1 + 2 * (cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "... = ln (((1 + (cmod x))\<^sup>2) / (1 - (cmod x)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (subst add_divide_distrib[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((1 + (cmod x)\<^sup>2 + 2 * cmod x) / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))
[PROOF STEP]
apply (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln ((1 + (cmod x)\<^sup>2) / (1 - (cmod x)\<^sup>2) + 2 * cmod x / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "... = ln ((1 + cmod x) / (1 - (cmod x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x) / (1 - cmod x))
[PROOF STEP]
using \<open>cmod x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
cmod x < 1

goal (1 subgoal):
 1. ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x) / (1 - cmod x))
[PROOF STEP]
using square_diff_square_factored[of 1 "cmod x"]
[PROOF STATE]
proof (prove)
using this:
cmod x < 1
1 * 1 - cmod x * cmod x = (1 + cmod x) * (1 - cmod x)

goal (1 subgoal):
 1. ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x) / (1 - cmod x))
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x) / (1 - cmod x))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x)\<^sup>2 / (1 - (cmod x)\<^sup>2)) = ln ((1 + cmod x) / (1 - cmod x))

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "... = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have *: "Re ((1 - x) / (1 + x)) \<le> 1" "Re ((1 - x) / (1 + x)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((1 - x) / (1 + x)) \<le> 1 &&& 0 < Re ((1 - x) / (1 + x))
[PROOF STEP]
using \<open>is_real x\<close> \<open>Re x \<ge> 0\<close> \<open>Re x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
is_real x
0 \<le> Re x
Re x < 1

goal (1 subgoal):
 1. Re ((1 - x) / (1 + x)) \<le> 1 &&& 0 < Re ((1 - x) / (1 + x))
[PROOF STEP]
using complex_is_Real_iff
[PROOF STATE]
proof (prove)
using this:
is_real x
0 \<le> Re x
Re x < 1
(?z \<in> \<real>) = is_real ?z

goal (1 subgoal):
 1. Re ((1 - x) / (1 + x)) \<le> 1 &&& 0 < Re ((1 - x) / (1 + x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re ((1 - x) / (1 + x)) \<le> 1
0 < Re ((1 - x) / (1 + x))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
hence "\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = - ln (Re ((1 - x) / (1 + x)))"
[PROOF STATE]
proof (prove)
using this:
Re ((1 - x) / (1 + x)) \<le> 1
0 < Re ((1 - x) / (1 + x))

goal (1 subgoal):
 1. \<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = - ln (Re ((1 - x) / (1 + x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = - ln (Re ((1 - x) / (1 + x)))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
hence "\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))"
[PROOF STATE]
proof (prove)
using this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = - ln (Re ((1 - x) / (1 + x)))

goal (1 subgoal):
 1. \<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))
[PROOF STEP]
using ln_div[of 1 "Re ((1 - x)/(1 + x))"] * \<open>is_real x\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = - ln (Re ((1 - x) / (1 + x)))
\<lbrakk>0 < 1; 0 < Re ((1 - x) / (1 + x))\<rbrakk> \<Longrightarrow> ln (1 / Re ((1 - x) / (1 + x))) = ln 1 - ln (Re ((1 - x) / (1 + x)))
Re ((1 - x) / (1 + x)) \<le> 1
0 < Re ((1 - x) / (1 + x))
is_real x

goal (1 subgoal):
 1. \<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))
[PROOF STEP]
by (simp add: complex_is_Real_iff)
[PROOF STATE]
proof (state)
this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))
[PROOF STEP]
using \<open>Re x \<ge> 0\<close> \<open>is_real x\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re x
is_real x

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))
[PROOF STEP]
using cmod_eq_Re
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re x
is_real x
is_real ?z \<Longrightarrow> cmod ?z = \<bar>Re ?z\<bar>

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
have "(1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))
[PROOF STEP]
using \<open>is_real x\<close> \<open>Re x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
is_real x
Re x < 1

goal (1 subgoal):
 1. (1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))
[PROOF STEP]
by (smt Re_divide_real eq_iff_diff_eq_0 minus_complex.simps one_complex.simps plus_complex.simps)
[PROOF STATE]
proof (state)
this:
(1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))
ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))
(1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>ln (Re ((1 - x) / (1 + x)))\<bar> = ln (Re ((1 + x) / (1 - x)))
ln ((1 + cmod x) / (1 - cmod x)) = ln ((1 + Re x) / (1 - Re x))
(1 + Re x) / (1 - Re x) = Re ((1 + x) / (1 - x))

goal (1 subgoal):
 1. ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ln ((1 + cmod x) / (1 - cmod x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poincare_distance 0\<^sub>h (of_complex x) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>
poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x)) = \<bar>ln (Re ((1 - x) / (1 + x)))\<bar>

goal (1 subgoal):
 1. poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poincare_distance 0\<^sub>h (of_complex x) = poincare_distance_formula (to_complex 0\<^sub>h) (to_complex (of_complex x))

goal (3 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
fix M u v
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
assume *: "unit_disc_fix M"  "u \<in> unit_disc" "v \<in> unit_disc"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M
u \<in> unit_disc
v \<in> unit_disc

goal (3 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
assume "?P (moebius_pt M u) (moebius_pt M v)"
[PROOF STATE]
proof (state)
this:
poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))

goal (3 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
 3. \<And>M u v. \<lbrakk>unit_disc_fix M; u \<in> unit_disc; v \<in> unit_disc; poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))\<rbrakk> \<Longrightarrow> poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
thus "?P u v"
[PROOF STATE]
proof (prove)
using this:
poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))

goal (1 subgoal):
 1. poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
using *(1-3)
[PROOF STATE]
proof (prove)
using this:
poincare_distance (moebius_pt M u) (moebius_pt M v) = poincare_distance_formula (to_complex (moebius_pt M u)) (to_complex (moebius_pt M v))
unit_disc_fix M
u \<in> unit_disc
v \<in> unit_disc

goal (1 subgoal):
 1. poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)
[PROOF STEP]
by (simp del: poincare_distance_formula_def)
[PROOF STATE]
proof (state)
this:
poincare_distance u v = poincare_distance_formula (to_complex u) (to_complex v)

goal (2 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> unit_disc
 2. v \<in> unit_disc
[PROOF STEP]
show "u \<in> unit_disc" "v \<in> unit_disc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> unit_disc &&& v \<in> unit_disc
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
this:
u \<in> unit_disc
v \<in> unit_disc

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_bind_singleton:
  assumes "finite S"
  assumes "inj_on f S"
  shows "card (S \<bind> (\<lambda>x. {f x})) = card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S \<bind> (\<lambda>x. {f x})) = card S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
inj_on f S

goal (1 subgoal):
 1. card (S \<bind> (\<lambda>x. {f x})) = card S
[PROOF STEP]
by (auto simp add: card_bind_constant inj_on_impl_disjoint_family_on_singleton)


[STATEMENT]
lemma PSP_Unless:
     "[| F \<in> A LeadsTo A'; F \<in> B Unless B' |]
      ==> F \<in> (A \<inter> B) LeadsTo ((A' \<inter> B) \<union> B')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto>w A'; F \<in> B Unless B'\<rbrakk> \<Longrightarrow> F \<in> A \<inter> B \<longmapsto>w A' \<inter> B \<union> B'
[PROOF STEP]
apply (unfold Unless_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto>w A'; F \<in> B - B' Co B \<union> B'\<rbrakk> \<Longrightarrow> F \<in> A \<inter> B \<longmapsto>w A' \<inter> B \<union> B'
[PROOF STEP]
apply (drule PSP, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> B - B' Co B \<union> B'; F \<in> A \<inter> (B \<union> B') \<longmapsto>w A' \<inter> (B - B') \<union> (B \<union> B' - (B - B'))\<rbrakk> \<Longrightarrow> F \<in> A \<inter> B \<longmapsto>w A' \<inter> B \<union> B'
[PROOF STEP]
apply (blast intro: LeadsTo_Diff LeadsTo_weaken subset_imp_LeadsTo)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "(0::real) \<le> x \<longrightarrow> 1 - x \<le> 1 / (1 + x + x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<longrightarrow> 1 - x \<le> 1 / (1 + x + x\<^sup>2)
[PROOF STEP]
by sos


[STATEMENT]
lemma q_odd: "odd q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd q
[PROOF STEP]
using kyber_spec_axioms kyber_spec_def
 prime_odd_int
[PROOF STATE]
proof (prove)
using this:
kyber_spec TYPE('a) TYPE('k) n q k n'
kyber_spec TYPE(?'a) TYPE(?'k) ?n ?q ?k ?n' \<equiv> ((?n = 2 ^ ?n' \<and> 0 < ?n') \<and> 2 < ?q \<and> ?q mod 4 = 1) \<and> (prime ?q \<and> int CARD(?'a) = ?q) \<and> int CARD(?'k) = int ?k \<and> qr_poly' TYPE(?'a) = Polynomial.monom 1 (nat ?n) + 1
\<lbrakk>prime ?p; 2 < ?p\<rbrakk> \<Longrightarrow> odd ?p

goal (1 subgoal):
 1. odd q
[PROOF STEP]
by blast


[STATEMENT]
lemma ratfps_gcd_altdef: "gcd (f :: 'a :: field_gcd ratfps) g =
  (if f = 0 \<and> g = 0 then 0 else
   if f = 0 then ratfps_of_poly (monom 1 (ratfps_subdegree g)) else
   if g = 0 then ratfps_of_poly (monom 1 (ratfps_subdegree f)) else
     ratfps_of_poly (monom 1 (min (ratfps_subdegree f) (ratfps_subdegree g))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd f g = (if f = 0 \<and> g = 0 then 0 else if f = 0 then ratfps_of_poly (monom (1::'a) (ratfps_subdegree g)) else if g = 0 then ratfps_of_poly (monom (1::'a) (ratfps_subdegree f)) else ratfps_of_poly (monom (1::'a) (min (ratfps_subdegree f) (ratfps_subdegree g))))
[PROOF STEP]
by (simp add: ratfps_gcd normalize_ratfps_def)


[STATEMENT]
lemma f_2_lemma_1: "f_2 (f_2 x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f_2 (f_2 x) = x
[PROOF STEP]
by (simp add: f_2_def)


[STATEMENT]
lemma steps_height:
  assumes "finite A"
  shows   "steps A f 0 up 0 = up * Max\<^sub>0 (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
have "steps A f 0 up 0 = lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. steps A f 0 up 0 = lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0
[PROOF STEP]
by (subst steps_lsteps) simp
[PROOF STATE]
proof (state)
this:
steps A f 0 up 0 = lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0

goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
steps A f 0 up 0 = lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0

goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
have "\<dots> = up * Max (f ` A \<union> {0})" if "A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
using assms that
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
by (subst lsteps_height) auto
[PROOF STATE]
proof (state)
this:
A \<noteq> {} \<Longrightarrow> lsteps (rev (sorted_list_of_set A)) f 0 up 0 + up * 0 = up * Max (f ` A \<union> {0})

goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {} \<Longrightarrow> steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {} \<Longrightarrow> steps A f 0 up 0 = up * Max (f ` A \<union> {0})

goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {} \<Longrightarrow> steps A f 0 up 0 = up * Max (f ` A \<union> {0})
finite A

goal (1 subgoal):
 1. steps A f 0 up 0 = up * Max (f ` A \<union> {0})
[PROOF STEP]
by (cases "A = {}") (auto)
[PROOF STATE]
proof (state)
this:
steps A f 0 up 0 = up * Max (f ` A \<union> {0})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma record_call_simp: "(record_call x \<cdot> f) x' = (if x = x' then two_pred \<cdot> (f x') else f x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (record_call x\<cdot>f) x' = (if x = x' then two_pred\<cdot>(f x') else f x')
[PROOF STEP]
unfolding record_call_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Lambda> ce. (\<lambda>y. if x = y then two_pred\<cdot>(ce y) else ce y))\<cdot>f) x' = (if x = x' then two_pred\<cdot>(f x') else f x')
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_limit_aux:
  fixes p :: "real poly"
  defines "n \<equiv> degree p"
  shows "((\<lambda>x. poly p x / x ^ n) \<longlongrightarrow> coeff p n) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. poly p x / x ^ n) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
proof (subst filterlim_cong, rule refl, rule refl)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in at_infinity. poly p x / x ^ n = ?g x
 2. (?g \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
show "eventually (\<lambda>x. poly p x / x^n = (\<Sum>i\<le>n. coeff p i / x^(n-i)))
            at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
proof (rule eventually_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eventually ?P at_infinity
 2. \<And>x. ?P x \<Longrightarrow> poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
show "eventually (\<lambda>x::real. x \<noteq> 0) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. x \<noteq> 0
[PROOF STEP]
by (simp add: eventually_at_infinity, rule exI[of _ 1], auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. x \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
assume [simp]: "x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
show "poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))
[PROOF STEP]
by (simp add: n_def sum_divide_distrib power_diff poly_altdef)
[PROOF STATE]
proof (state)
this:
poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. poly p x / x ^ n = (\<Sum>i\<le>n. coeff p i / x ^ (n - i))

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
let ?a = "\<lambda>i. if i = n then coeff p n else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
have "\<forall>i\<in>{..n}. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> ?a i) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{..n}. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..n} \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {..n} \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
assume "i \<in> {..n}"
[PROOF STATE]
proof (state)
this:
i \<in> {..n}

goal (1 subgoal):
 1. \<And>i. i \<in> {..n} \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
hence "i \<le> n"
[PROOF STATE]
proof (prove)
using this:
i \<in> {..n}

goal (1 subgoal):
 1. i \<le> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<le> n

goal (1 subgoal):
 1. \<And>i. i \<in> {..n} \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
show "((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> ?a i) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
proof (cases "i = n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
 2. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i = n

goal (2 subgoals):
 1. i = n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
 2. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = n

goal (1 subgoal):
 1. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
by (intro tendstoI, subst eventually_at_infinity,
                         intro exI[of _ 1], simp add: dist_real_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<noteq> n

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
hence "n - i > 0"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> n

goal (1 subgoal):
 1. 0 < n - i
[PROOF STEP]
using \<open>i \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
i \<noteq> n
i \<le> n

goal (1 subgoal):
 1. 0 < n - i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < n - i

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
from tendsto_inverse_0 and divide_real_def[of 1]
[PROOF STATE]
proof (chain)
picking this:
(inverse \<longlongrightarrow> (0::?'a)) at_infinity
1 / ?y = 1 * inverse ?y
[PROOF STEP]
have "((\<lambda>x. 1 / x :: real) \<longlongrightarrow> 0) at_infinity"
[PROOF STATE]
proof (prove)
using this:
(inverse \<longlongrightarrow> (0::?'a)) at_infinity
1 / ?y = 1 * inverse ?y

goal (1 subgoal):
 1. ((/) 1 \<longlongrightarrow> 0) at_infinity
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((/) 1 \<longlongrightarrow> 0) at_infinity

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
from tendsto_power[OF this, of "n - i"]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (1 / x) ^ (n - i)) \<longlongrightarrow> 0 ^ (n - i)) at_infinity
[PROOF STEP]
have "((\<lambda>x::real. 1 / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (1 / x) ^ (n - i)) \<longlongrightarrow> 0 ^ (n - i)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. 1 / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity
[PROOF STEP]
using \<open>n - i > 0\<close>
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (1 / x) ^ (n - i)) \<longlongrightarrow> 0 ^ (n - i)) at_infinity
0 < n - i

goal (1 subgoal):
 1. ((\<lambda>x. 1 / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity
[PROOF STEP]
by (simp add: power_0_left power_one_over)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. 1 / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
from tendsto_mult_right_zero[OF this, of "coeff p i"]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. coeff p i * (1 / x ^ (n - i))) \<longlongrightarrow> 0) at_infinity
[PROOF STEP]
have "((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. coeff p i * (1 / x ^ (n - i))) \<longlongrightarrow> 0) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> 0) at_infinity
i \<noteq> n

goal (1 subgoal):
 1. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{..n}. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
hence "((\<lambda>x. \<Sum>i\<le>n. coeff p i / x^(n-i)) \<longlongrightarrow> (\<Sum>i\<le>n. ?a i)) at_infinity"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{..n}. ((\<lambda>x. coeff p i / x ^ (n - i)) \<longlongrightarrow> (if i = n then coeff p n else 0)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> (\<Sum>i\<le>n. if i = n then coeff p n else 0)) at_infinity
[PROOF STEP]
by (force intro!: tendsto_sum)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> (\<Sum>i\<le>n. if i = n then coeff p n else 0)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> (\<Sum>i\<le>n. if i = n then coeff p n else 0)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
have "(\<Sum>i\<le>n. ?a i) = coeff p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. if i = n then coeff p n else 0) = coeff p n
[PROOF STEP]
by (subst sum.delta, simp_all)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. if i = n then coeff p n else 0) = coeff p n

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
show "((\<lambda>x. \<Sum>i\<le>n. coeff p i / x^(n-i)) \<longlongrightarrow> coeff p n) at_infinity"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>i\<le>n. coeff p i / x ^ (n - i)) \<longlongrightarrow> coeff p n) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma K_imp_trans:
  assumes \<open>A \<turnstile> (p \<^bold>\<longrightarrow> q)\<close>  \<open>A \<turnstile> (q \<^bold>\<longrightarrow> r)\<close>
  shows  \<open>A \<turnstile> (p \<^bold>\<longrightarrow> r)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<turnstile> p \<^bold>\<longrightarrow> r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<turnstile> p \<^bold>\<longrightarrow> r
[PROOF STEP]
have \<open>tautology  ((p \<^bold>\<longrightarrow> q) \<^bold>\<longrightarrow> ( (q \<^bold>\<longrightarrow> r) \<^bold>\<longrightarrow>  (p \<^bold>\<longrightarrow> r)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tautology ((p \<^bold>\<longrightarrow> q) \<^bold>\<longrightarrow> (q \<^bold>\<longrightarrow> r) \<^bold>\<longrightarrow> p \<^bold>\<longrightarrow> r)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
tautology ((p \<^bold>\<longrightarrow> q) \<^bold>\<longrightarrow> (q \<^bold>\<longrightarrow> r) \<^bold>\<longrightarrow> p \<^bold>\<longrightarrow> r)

goal (1 subgoal):
 1. A \<turnstile> p \<^bold>\<longrightarrow> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tautology ((p \<^bold>\<longrightarrow> q) \<^bold>\<longrightarrow> (q \<^bold>\<longrightarrow> r) \<^bold>\<longrightarrow> p \<^bold>\<longrightarrow> r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
tautology ((p \<^bold>\<longrightarrow> q) \<^bold>\<longrightarrow> (q \<^bold>\<longrightarrow> r) \<^bold>\<longrightarrow> p \<^bold>\<longrightarrow> r)

goal (1 subgoal):
 1. A \<turnstile> p \<^bold>\<longrightarrow> r
[PROOF STEP]
by (meson A1 R1 assms(1) assms(2))
[PROOF STATE]
proof (state)
this:
A \<turnstile> p \<^bold>\<longrightarrow> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alt_group_inv_equality:
  assumes "p \<in> carrier (alt_group n)" shows "inv\<^bsub>(alt_group n)\<^esub> p = inv' p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
have "inv' p \<circ> p = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv' p \<circ> p = id
[PROOF STEP]
using assms permutes_inv_o(2) alt_group_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (alt_group n)
?p permutes ?S \<Longrightarrow> inv' ?p \<circ> ?p = id
alt_group ?n = sym_group ?n\<lparr>carrier := {p. p permutes {1..?n} \<and> evenperm p}\<rparr>

goal (1 subgoal):
 1. inv' p \<circ> p = id
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv' p \<circ> p = id

goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
hence "(inv' p) \<otimes>\<^bsub>(alt_group n)\<^esub> p = one (alt_group n)"
[PROOF STATE]
proof (prove)
using this:
inv' p \<circ> p = id

goal (1 subgoal):
 1. inv' p \<otimes>\<^bsub>alt_group n\<^esub> p = \<one>\<^bsub>alt_group n\<^esub>
[PROOF STEP]
by (simp add: alt_group_def sym_group_def)
[PROOF STATE]
proof (state)
this:
inv' p \<otimes>\<^bsub>alt_group n\<^esub> p = \<one>\<^bsub>alt_group n\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inv' p \<otimes>\<^bsub>alt_group n\<^esub> p = \<one>\<^bsub>alt_group n\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
using group.inv_equality[OF alt_group_is_group]
[PROOF STATE]
proof (prove)
using this:
inv' p \<otimes>\<^bsub>alt_group n\<^esub> p = \<one>\<^bsub>alt_group n\<^esub>
\<lbrakk>?y \<otimes>\<^bsub>alt_group ?n1\<^esub> ?x = \<one>\<^bsub>alt_group ?n1\<^esub>; ?x \<in> carrier (alt_group ?n1); ?y \<in> carrier (alt_group ?n1)\<rbrakk> \<Longrightarrow> inv\<^bsub>alt_group ?n1\<^esub> ?x = ?y

goal (1 subgoal):
 1. inv\<^bsub>alt_group n\<^esub> p = inv' p
[PROOF STEP]
by (simp add: assms alt_group_inv_closed)
[PROOF STATE]
proof (state)
this:
inv\<^bsub>alt_group n\<^esub> p = inv' p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma signed_measure_finite_subset:
  assumes "E \<in> sets M"
    and "\<bar>\<mu> E\<bar> < \<infinity>"
    and "A\<in> sets M"
    and "A\<subseteq> E"
  shows "\<bar>\<mu> A\<bar> < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<mu> A\<bar> < \<infinity>
[PROOF STEP]
proof (rule finite_subset)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<bar>\<mu> ?E\<bar> < \<infinity>
 2. A \<subseteq> ?E
 3. \<mu> ?E = \<mu> A + \<mu> (?E - A)
[PROOF STEP]
show "\<bar>\<mu> E\<bar> < \<infinity>" "A\<subseteq> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<mu> E\<bar> < \<infinity> &&& A \<subseteq> E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
A \<in> sets M
A \<subseteq> E

goal (1 subgoal):
 1. \<bar>\<mu> E\<bar> < \<infinity> &&& A \<subseteq> E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>\<mu> E\<bar> < \<infinity>
A \<subseteq> E

goal (1 subgoal):
 1. \<mu> E = \<mu> A + \<mu> (E - A)
[PROOF STEP]
show "\<mu> E = \<mu> A + \<mu> (E - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> E = \<mu> A + \<mu> (E - A)
[PROOF STEP]
using assms
      sgn_meas signed_measure_add[of M \<mu> A "E - A"]
[PROOF STATE]
proof (prove)
using this:
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
A \<in> sets M
A \<subseteq> E
signed_measure M \<mu>
\<lbrakk>signed_measure M \<mu>; A \<in> sets M; E - A \<in> sets M; A \<inter> (E - A) = {}\<rbrakk> \<Longrightarrow> \<mu> (A \<union> (E - A)) = \<mu> A + \<mu> (E - A)

goal (1 subgoal):
 1. \<mu> E = \<mu> A + \<mu> (E - A)
[PROOF STEP]
by (metis Diff_disjoint Diff_partition sets.Diff)
[PROOF STATE]
proof (state)
this:
\<mu> E = \<mu> A + \<mu> (E - A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in topology) nhds_inter:
  assumes nhdU: "U \<in> nhds x"
  and     nhdV: "V \<in> nhds x"
  shows "(U \<inter> V) \<in> nhds x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from nhdU
[PROOF STATE]
proof (chain)
picking this:
U \<in> nhds x
[PROOF STEP]
obtain u where
    Usub: "U \<subseteq> carrier" and
    uT:   "u open" and
    xu:   "x \<in> u" and
    usub: "u \<subseteq> U"
[PROOF STATE]
proof (prove)
using this:
U \<in> nhds x

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>U \<subseteq> carrier; u open; x \<in> u; u \<subseteq> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<subseteq> carrier
u open
x \<in> u
u \<subseteq> U

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from nhdV
[PROOF STATE]
proof (chain)
picking this:
V \<in> nhds x
[PROOF STEP]
obtain v where
    Vsub: "V \<subseteq> carrier" and
    vT: "v open" and
    xv: "x \<in> v" and
    vsub: "v \<subseteq> V"
[PROOF STATE]
proof (prove)
using this:
V \<in> nhds x

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>V \<subseteq> carrier; v open; x \<in> v; v \<subseteq> V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier
v open
x \<in> v
v \<subseteq> V

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from Usub Vsub
[PROOF STATE]
proof (chain)
picking this:
U \<subseteq> carrier
V \<subseteq> carrier
[PROOF STEP]
have "U \<inter> V \<subseteq> carrier"
[PROOF STATE]
proof (prove)
using this:
U \<subseteq> carrier
V \<subseteq> carrier

goal (1 subgoal):
 1. U \<inter> V \<subseteq> carrier
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<inter> V \<subseteq> carrier

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
U \<inter> V \<subseteq> carrier

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from uT vT
[PROOF STATE]
proof (chain)
picking this:
u open
v open
[PROOF STEP]
have "u \<inter> v open"
[PROOF STATE]
proof (prove)
using this:
u open
v open

goal (1 subgoal):
 1. u \<inter> v open
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
u \<inter> v open

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
u \<inter> v open

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from xu xv
[PROOF STATE]
proof (chain)
picking this:
x \<in> u
x \<in> v
[PROOF STEP]
have "x \<in> u \<inter> v"
[PROOF STATE]
proof (prove)
using this:
x \<in> u
x \<in> v

goal (1 subgoal):
 1. x \<in> u \<inter> v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<in> u \<inter> v

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> u \<inter> v

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
from usub vsub
[PROOF STATE]
proof (chain)
picking this:
u \<subseteq> U
v \<subseteq> V
[PROOF STEP]
have "u \<inter> v \<subseteq> U \<inter> V"
[PROOF STATE]
proof (prove)
using this:
u \<subseteq> U
v \<subseteq> V

goal (1 subgoal):
 1. u \<inter> v \<subseteq> U \<inter> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<inter> v \<subseteq> U \<inter> V

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
U \<inter> V \<subseteq> carrier
u \<inter> v open
x \<in> u \<inter> v
u \<inter> v \<subseteq> U \<inter> V
[PROOF STEP]
show  ?thesis
[PROOF STATE]
proof (prove)
using this:
U \<inter> V \<subseteq> carrier
u \<inter> v open
x \<in> u \<inter> v
u \<inter> v \<subseteq> U \<inter> V

goal (1 subgoal):
 1. U \<inter> V \<in> nhds x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<inter> V \<in> nhds x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "rec_InfTree leaf node Leaf = leaf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_InfTree leaf node InfTree.Leaf = leaf
[PROOF STEP]
nitpick [card = 1-3, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_InfTree leaf node InfTree.Leaf = leaf
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma subrel_runiq:
  assumes "runiq Q" "P \<subseteq> Q"
  shows "runiq P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. runiq P
[PROOF STEP]
using assms runiq_def
[PROOF STATE]
proof (prove)
using this:
runiq Q
P \<subseteq> Q
runiq ?R = (\<forall>X. trivial X \<longrightarrow> trivial (?R `` X))

goal (1 subgoal):
 1. runiq P
[PROOF STEP]
by (metis Image_mono subsetI trivial_subset)


[STATEMENT]
lemma complex_interval_tendsto_neq: assumes "(\<lambda> i. f i) \<longlonglongrightarrow>\<^sub>c a"
  and "a \<noteq> b"
shows "\<exists> n. \<not> b \<in>\<^sub>c f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
from assms(1)[unfolded complex_interval_tendsto_def o_def]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. Re_interval (f x)) \<longlonglongrightarrow>\<^sub>i Re a \<and> (\<lambda>x. Im_interval (f x)) \<longlonglongrightarrow>\<^sub>i Im a
[PROOF STEP]
have cvg: "(\<lambda>x. Re_interval (f x)) \<longlonglongrightarrow>\<^sub>i Re a" "(\<lambda>x. Im_interval (f x)) \<longlonglongrightarrow>\<^sub>i Im a"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. Re_interval (f x)) \<longlonglongrightarrow>\<^sub>i Re a \<and> (\<lambda>x. Im_interval (f x)) \<longlonglongrightarrow>\<^sub>i Im a

goal (1 subgoal):
 1. (\<lambda>x. Re_interval (f x)) \<longlonglongrightarrow>\<^sub>i Re a &&& (\<lambda>x. Im_interval (f x)) \<longlonglongrightarrow>\<^sub>i Im a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Re_interval (f x)) \<longlonglongrightarrow>\<^sub>i Re a
(\<lambda>x. Im_interval (f x)) \<longlonglongrightarrow>\<^sub>i Im a

goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
[PROOF STEP]
have "Re a \<noteq> Re b \<or> Im a \<noteq> Im b"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. Re a \<noteq> Re b \<or> Im a \<noteq> Im b
[PROOF STEP]
using complex.expand
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
Re ?complex = Re ?complex' \<and> Im ?complex = Im ?complex' \<Longrightarrow> ?complex = ?complex'

goal (1 subgoal):
 1. Re a \<noteq> Re b \<or> Im a \<noteq> Im b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Re a \<noteq> Re b \<or> Im a \<noteq> Im b

goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Re a \<noteq> Re b \<or> Im a \<noteq> Im b

goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re a \<noteq> Re b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
 2. Im a \<noteq> Im b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
assume "Re a \<noteq> Re b"
[PROOF STATE]
proof (state)
this:
Re a \<noteq> Re b

goal (2 subgoals):
 1. Re a \<noteq> Re b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
 2. Im a \<noteq> Im b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
from interval_tendsto_neq[OF cvg(1) this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. \<not> Re b \<in>\<^sub>i Re_interval (f n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n. \<not> Re b \<in>\<^sub>i Re_interval (f n)

goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
unfolding in_complex_interval_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. \<not> Re b \<in>\<^sub>i Re_interval (f n)

goal (1 subgoal):
 1. \<exists>n. \<not> (case f n of Complex_Interval r i \<Rightarrow> Re b \<in>\<^sub>i r \<and> Im b \<in>\<^sub>i i)
[PROOF STEP]
by (metis (no_types, lifting) complex_interval.case_eq_if)
[PROOF STATE]
proof (state)
this:
\<exists>n. \<not> b \<in>\<^sub>c f n

goal (1 subgoal):
 1. Im a \<noteq> Im b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im a \<noteq> Im b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
assume "Im a \<noteq> Im b"
[PROOF STATE]
proof (state)
this:
Im a \<noteq> Im b

goal (1 subgoal):
 1. Im a \<noteq> Im b \<Longrightarrow> \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
from interval_tendsto_neq[OF cvg(2) this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. \<not> Im b \<in>\<^sub>i Im_interval (f n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n. \<not> Im b \<in>\<^sub>i Im_interval (f n)

goal (1 subgoal):
 1. \<exists>n. \<not> b \<in>\<^sub>c f n
[PROOF STEP]
unfolding in_complex_interval_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. \<not> Im b \<in>\<^sub>i Im_interval (f n)

goal (1 subgoal):
 1. \<exists>n. \<not> (case f n of Complex_Interval r i \<Rightarrow> Re b \<in>\<^sub>i r \<and> Im b \<in>\<^sub>i i)
[PROOF STEP]
by (metis (no_types, lifting) complex_interval.case_eq_if)
[PROOF STATE]
proof (state)
this:
\<exists>n. \<not> b \<in>\<^sub>c f n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>n. \<not> b \<in>\<^sub>c f n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primes_omega_mult_coprime:
  assumes "coprime x y" "x > 0 \<or> y > 0"
  shows   "primes_omega (x * y) = primes_omega x + primes_omega y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
proof (cases "x = 0 \<or> y = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (x = 0 \<or> y = 0)

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
hence "prime_factors (x * y) = prime_factors x \<union> prime_factors y"
[PROOF STATE]
proof (prove)
using this:
\<not> (x = 0 \<or> y = 0)

goal (1 subgoal):
 1. prime_factors (x * y) = prime_factors x \<union> prime_factors y
[PROOF STEP]
by (subst prime_factorization_mult) auto
[PROOF STATE]
proof (state)
this:
prime_factors (x * y) = prime_factors x \<union> prime_factors y

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors (x * y) = prime_factors x \<union> prime_factors y

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
prime_factors (x * y) = prime_factors x \<union> prime_factors y

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
have "prime_factors x \<inter> prime_factors y = set_mset (prime_factorization (gcd x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = prime_factors (gcd x y)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> (x = 0 \<or> y = 0)

goal (1 subgoal):
 1. prime_factors x \<inter> prime_factors y = prime_factors (gcd x y)
[PROOF STEP]
by (subst prime_factorization_gcd) auto
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = prime_factors (gcd x y)

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factors x \<inter> prime_factors y = prime_factors (gcd x y)

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
have "gcd x y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd x y = 1
[PROOF STEP]
using \<open>coprime x y\<close>
[PROOF STATE]
proof (prove)
using this:
coprime x y

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

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factors x \<inter> prime_factors y = prime_factors 1
[PROOF STEP]
have "card (prime_factors x \<union> prime_factors y) = primes_omega x + primes_omega y"
[PROOF STATE]
proof (prove)
using this:
prime_factors x \<inter> prime_factors y = prime_factors 1

goal (1 subgoal):
 1. card (prime_factors x \<union> prime_factors y) = primes_omega x + primes_omega y
[PROOF STEP]
unfolding primes_omega_def
[PROOF STATE]
proof (prove)
using this:
prime_factors x \<inter> prime_factors y = prime_factors 1

goal (1 subgoal):
 1. card (prime_factors x \<union> prime_factors y) = card (prime_factors x) + card (prime_factors y)
[PROOF STEP]
by (intro card_Un_disjoint) (use False in auto)
[PROOF STATE]
proof (state)
this:
card (prime_factors x \<union> prime_factors y) = primes_omega x + primes_omega y

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
card (prime_factors x \<union> prime_factors y) = primes_omega x + primes_omega y

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (prime_factors (x * y)) = primes_omega x + primes_omega y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (prime_factors (x * y)) = primes_omega x + primes_omega y

goal (1 subgoal):
 1. primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
by (simp add: primes_omega_def)
[PROOF STATE]
proof (state)
this:
primes_omega (x * y) = primes_omega x + primes_omega y

goal (1 subgoal):
 1. x = 0 \<or> y = 0 \<Longrightarrow> primes_omega (x * y) = primes_omega x + primes_omega y
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma cryptinverts_hilf1: "prime p \<Longrightarrow> (m * m ^(k * pred p)) mod p = m mod p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
[PROOF STEP]
apply (cases "m mod p = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime p; m mod p = 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
 2. \<lbrakk>prime p; m mod p \<noteq> 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
[PROOF STEP]
apply (simp add: mod_mult_left_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime p; m mod p = 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = 0
 2. \<lbrakk>prime p; m mod p \<noteq> 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
[PROOF STEP]
apply (simp only: mult.commute [of k "pred p"]
    power_mult mod_mult_right_eq [of "m" "(m^pred p)^k" "p"]
    remainderexp [of "m^pred p" "p" "k", symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>prime p; m mod p = 0\<rbrakk> \<Longrightarrow> m * (m ^ pred p) ^ k mod p = 0
 2. \<lbrakk>prime p; m mod p \<noteq> 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
[PROOF STEP]
apply (insert fermat [of p m], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; 0 < m mod p; m ^ (p - Suc 0) mod p = Suc 0\<rbrakk> \<Longrightarrow> m * m ^ (k * pred p) mod p = m mod p
[PROOF STEP]
apply (simp add: mult.commute [of k] power_mult pred_unfold)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; 0 < m mod p; m ^ (p - Suc 0) mod p = Suc 0\<rbrakk> \<Longrightarrow> m * (m ^ (p - Suc 0)) ^ k mod p = m mod p
[PROOF STEP]
by (metis One_nat_def mod_mult_right_eq mult.right_neutral power_Suc_0 power_mod)


[STATEMENT]
lemma lset_ltake: "lset (ltake n xs) \<subseteq> lset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lset (ltake n xs) \<subseteq> lset xs
[PROOF STEP]
proof(rule subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lset (ltake n xs) \<Longrightarrow> x \<in> lset xs
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> lset (ltake n xs) \<Longrightarrow> x \<in> lset xs
[PROOF STEP]
assume "x \<in> lset (ltake n xs)"
[PROOF STATE]
proof (state)
this:
x \<in> lset (ltake n xs)

goal (1 subgoal):
 1. \<And>x. x \<in> lset (ltake n xs) \<Longrightarrow> x \<in> lset xs
[PROOF STEP]
thus "x \<in> lset xs"
[PROOF STATE]
proof (prove)
using this:
x \<in> lset (ltake n xs)

goal (1 subgoal):
 1. x \<in> lset xs
[PROOF STEP]
proof(induct "ltake n xs" arbitrary: xs n rule: lset_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs xsa n. LCons x xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa
 2. \<And>x' xs xsa n. \<lbrakk>x \<in> lset xs; x \<noteq> x'; \<And>xsa n. xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa; LCons x' xs = ltake n xsa\<rbrakk> \<Longrightarrow> x \<in> lset xsa
[PROOF STEP]
case find
[PROOF STATE]
proof (state)
this:
LCons x xs_ = ltake n xs

goal (2 subgoals):
 1. \<And>xs xsa n. LCons x xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa
 2. \<And>x' xs xsa n. \<lbrakk>x \<in> lset xs; x \<noteq> x'; \<And>xsa n. xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa; LCons x' xs = ltake n xsa\<rbrakk> \<Longrightarrow> x \<in> lset xsa
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
LCons x xs_ = ltake n xs

goal (1 subgoal):
 1. x \<in> lset xs
[PROOF STEP]
by(cases xs)(simp, cases n rule: enat_coexhaust, simp_all)
[PROOF STATE]
proof (state)
this:
x \<in> lset xs

goal (1 subgoal):
 1. \<And>x' xs xsa n. \<lbrakk>x \<in> lset xs; x \<noteq> x'; \<And>xsa n. xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa; LCons x' xs = ltake n xsa\<rbrakk> \<Longrightarrow> x \<in> lset xsa
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x' xs xsa n. \<lbrakk>x \<in> lset xs; x \<noteq> x'; \<And>xsa n. xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa; LCons x' xs = ltake n xsa\<rbrakk> \<Longrightarrow> x \<in> lset xsa
[PROOF STEP]
case step
[PROOF STATE]
proof (state)
this:
x \<in> lset xs_
x \<noteq> x'_
xs_ = ltake ?n ?xs \<Longrightarrow> x \<in> lset ?xs
LCons x'_ xs_ = ltake n xs

goal (1 subgoal):
 1. \<And>x' xs xsa n. \<lbrakk>x \<in> lset xs; x \<noteq> x'; \<And>xsa n. xs = ltake n xsa \<Longrightarrow> x \<in> lset xsa; LCons x' xs = ltake n xsa\<rbrakk> \<Longrightarrow> x \<in> lset xsa
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
x \<in> lset xs_
x \<noteq> x'_
xs_ = ltake ?n ?xs \<Longrightarrow> x \<in> lset ?xs
LCons x'_ xs_ = ltake n xs

goal (1 subgoal):
 1. x \<in> lset xs
[PROOF STEP]
by(cases xs)(simp, cases n rule: enat_coexhaust, simp_all)
[PROOF STATE]
proof (state)
this:
x \<in> lset xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> lset xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_interval_Ipoly: "real_interval (Ipoly xs p) = Ipoly (map real_interval xs) (map_poly real_interval p)"
  if "num_params p \<le> length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_interval (Ipoly xs p) = Ipoly (map real_interval xs) (map_poly real_interval p)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
num_params p \<le> length xs

goal (1 subgoal):
 1. real_interval (Ipoly xs p) = Ipoly (map real_interval xs) (map_poly real_interval p)
[PROOF STEP]
by (induction p)
    (auto simp: real_interval_plus real_interval_minus real_interval_times
      real_interval_uminus real_interval_power)


[STATEMENT]
lemma insert_nth_take_drop[simp]: "insert_nth n x xs = take n xs @ [x] @ drop n xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert_nth n x xs = take n xs @ [x] @ drop n xs
[PROOF STEP]
proof (induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. insert_nth 0 x xs = take 0 xs @ [x] @ drop 0 xs
 2. \<And>n xs. (\<And>xs. insert_nth n x xs = take n xs @ [x] @ drop n xs) \<Longrightarrow> insert_nth (Suc n) x xs = take (Suc n) xs @ [x] @ drop (Suc n) xs
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
insert_nth n_ x ?xs = take n_ ?xs @ [x] @ drop n_ ?xs

goal (2 subgoals):
 1. \<And>xs. insert_nth 0 x xs = take 0 xs @ [x] @ drop 0 xs
 2. \<And>n xs. (\<And>xs. insert_nth n x xs = take n xs @ [x] @ drop n xs) \<Longrightarrow> insert_nth (Suc n) x xs = take (Suc n) xs @ [x] @ drop (Suc n) xs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
insert_nth n_ x ?xs = take n_ ?xs @ [x] @ drop n_ ?xs

goal (1 subgoal):
 1. insert_nth (Suc n_) x xs = take (Suc n_) xs @ [x] @ drop (Suc n_) xs
[PROOF STEP]
by (cases xs) auto
[PROOF STATE]
proof (state)
this:
insert_nth (Suc n_) x xs = take (Suc n_) xs @ [x] @ drop (Suc n_) xs

goal (1 subgoal):
 1. \<And>xs. insert_nth 0 x xs = take 0 xs @ [x] @ drop 0 xs
[PROOF STEP]
qed simp


[STATEMENT]
lemma equivp_aeseq_eq: "equivp aeseq_eq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivp aeseq_eq
[PROOF STEP]
proof(rule equivpI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. reflp aeseq_eq
 2. symp aeseq_eq
 3. transp aeseq_eq
[PROOF STEP]
show "reflp aeseq_eq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflp aeseq_eq
[PROOF STEP]
by(simp add: reflp_def aeseq_eq.simps)
[PROOF STATE]
proof (state)
this:
reflp aeseq_eq

goal (2 subgoals):
 1. symp aeseq_eq
 2. transp aeseq_eq
[PROOF STEP]
show "symp aeseq_eq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symp aeseq_eq
[PROOF STEP]
by(simp add: symp_def aeseq_eq.simps eq_commute)
[PROOF STATE]
proof (state)
this:
symp aeseq_eq

goal (1 subgoal):
 1. transp aeseq_eq
[PROOF STEP]
have "finite {n. f n \<noteq> h n}" if "finite {n. f n \<noteq> g n}" "finite {n. g n \<noteq> h n}"
    for f g h :: "nat \<Rightarrow> 'b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {n. f n \<noteq> h n}
[PROOF STEP]
using finite_subset[of "{n. f n \<noteq> h n}" "{n. f n \<noteq> g n} \<union> {n. g n \<noteq> h n}"] that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{n. f n \<noteq> h n} \<subseteq> {n. f n \<noteq> g n} \<union> {n. g n \<noteq> h n}; finite ({n. f n \<noteq> g n} \<union> {n. g n \<noteq> h n})\<rbrakk> \<Longrightarrow> finite {n. f n \<noteq> h n}
finite {n. f n \<noteq> g n}
finite {n. g n \<noteq> h n}

goal (1 subgoal):
 1. finite {n. f n \<noteq> h n}
[PROOF STEP]
by(fastforce intro: finite_subset)
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite {n. ?f3 n \<noteq> ?g3 n}; finite {n. ?g3 n \<noteq> ?h3 n}\<rbrakk> \<Longrightarrow> finite {n. ?f3 n \<noteq> ?h3 n}

goal (1 subgoal):
 1. transp aeseq_eq
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite {n. ?f3 n \<noteq> ?g3 n}; finite {n. ?g3 n \<noteq> ?h3 n}\<rbrakk> \<Longrightarrow> finite {n. ?f3 n \<noteq> ?h3 n}
[PROOF STEP]
show "transp aeseq_eq"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {n. ?f3 n \<noteq> ?g3 n}; finite {n. ?g3 n \<noteq> ?h3 n}\<rbrakk> \<Longrightarrow> finite {n. ?f3 n \<noteq> ?h3 n}

goal (1 subgoal):
 1. transp aeseq_eq
[PROOF STEP]
by(auto simp add: transp_def aeseq_eq.simps)
[PROOF STATE]
proof (state)
this:
transp aeseq_eq

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antisym_VWO: "antisym VWO"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. antisym VWO
[PROOF STEP]
using VWO
[PROOF STATE]
proof (prove)
using this:
{(x, y). x \<in> elts y} \<subseteq> VWO \<and> Well_order VWO \<and> Field VWO = UNIV

goal (1 subgoal):
 1. antisym VWO
[PROOF STEP]
by (simp add: VWO wo_rel.ANTISYM wo_rel_def)


[STATEMENT]
lemma Field_trancl[simp]: "Field (trancl r) = Field r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Field (r\<^sup>+) = Field r
[PROOF STEP]
unfolding Field_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domain (r\<^sup>+) \<union> Range (r\<^sup>+) = Domain r \<union> Range r
[PROOF STEP]
by auto


[STATEMENT]
lemma (in Group) r_one_unique:"\<lbrakk>a \<in> carrier G; x \<in> carrier G; a \<cdot> x = a\<rbrakk>  \<Longrightarrow>
                                 x = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier G; x \<in> carrier G; a \<cdot> x = a\<rbrakk> \<Longrightarrow> x = \<one>
[PROOF STEP]
apply (frule mult_closed[of "a" "x"], assumption+,
       frule i_closed[of "a"],
       frule l_mult_eqn[of "a \<cdot> x" "a" "\<rho> a"], assumption+,
       thin_tac "a \<cdot> x = a",
       simp add:tassoc[THEN sym] l_i l_unit)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem gt_compat_App:
  shows "s' \<ge>\<^sub>t s \<Longrightarrow> t' >\<^sub>t t \<Longrightarrow> App s' t' >\<^sub>t App s t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s' \<ge>\<^sub>t s; t' >\<^sub>t t\<rbrakk> \<Longrightarrow> App s' t' >\<^sub>t App s t
[PROOF STEP]
using gt_compat_fun gt_compat_arg
[PROOF STATE]
proof (prove)
using this:
?t' >\<^sub>t ?t \<Longrightarrow> App ?s ?t' >\<^sub>t App ?s ?t
\<lbrakk>?s' >\<^sub>t ?s; ?t' \<ge>\<^sub>t ?t\<rbrakk> \<Longrightarrow> App ?s' ?t' >\<^sub>t App ?s ?t

goal (1 subgoal):
 1. \<lbrakk>s' \<ge>\<^sub>t s; t' >\<^sub>t t\<rbrakk> \<Longrightarrow> App s' t' >\<^sub>t App s t
[PROOF STEP]
by blast


[STATEMENT]
lemma integrable_mono_on_nonneg:
  fixes f :: "real \<Rightarrow> real"
  assumes mon: "mono_on {a..b} f" and 0: "\<And>x. 0 \<le> f x"
  shows "integrable (lebesgue_on {a..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "space lborel = space lebesgue" "sets borel \<subseteq> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space lborel = space lebesgue &&& sets borel \<subseteq> sets lebesgue
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue
[PROOF STEP]
have fborel: "f \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
using this:
space lborel = space lebesgue
sets borel \<subseteq> sets lebesgue

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by (metis mon borel_measurable_mono_on_fnc borel_measurable_subalgebra mono_restrict_space space_lborel space_restrict_space)
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
obtain g where g: "incseq g" and simple: "\<And>i. simple_function (lebesgue_on {a..b}) (g i)"
                and bdd: " (\<forall>x. bdd_above (range (\<lambda>i. g i x)))" and nonneg: "\<forall>i x. 0 \<le> g i x"
                and fsup: "f = (SUP i. g i)"
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>incseq g; \<And>i. simple_function (lebesgue_on {a..b}) (g i); \<forall>x. bdd_above (range (\<lambda>i. g i x)); \<forall>i x. 0 \<le> g i x; f = Sup (range g)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis borel_measurable_implies_simple_function_sequence_real 0)
[PROOF STATE]
proof (state)
this:
incseq g
simple_function (lebesgue_on {a..b}) (g ?i1)
\<forall>x. bdd_above (range (\<lambda>i. g i x))
\<forall>i x. 0 \<le> g i x
f = Sup (range g)

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have "f ` {a..b} \<subseteq> {f a..f b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {a..b} \<subseteq> {f a..f b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono_on {a..b} f
0 \<le> f ?x

goal (1 subgoal):
 1. f ` {a..b} \<subseteq> {f a..f b}
[PROOF STEP]
by (auto simp: mono_on_def)
[PROOF STATE]
proof (state)
this:
f ` {a..b} \<subseteq> {f a..f b}

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have g_le_f: "g i x \<le> f x" for i x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
have "bdd_above ((\<lambda>h. h x) ` range g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
using bdd cSUP_lessD linorder_not_less
[PROOF STATE]
proof (prove)
using this:
\<forall>x. bdd_above (range (\<lambda>i. g i x))
\<lbrakk>bdd_above (?f ` ?A); Sup (?f ` ?A) < ?y; ?i \<in> ?A\<rbrakk> \<Longrightarrow> ?f ?i < ?y
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>h. h x) ` range g)

goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bdd_above ((\<lambda>h. h x) ` range g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bdd_above ((\<lambda>h. h x) ` range g)

goal (1 subgoal):
 1. g i x \<le> f x
[PROOF STEP]
by (metis SUP_apply UNIV_I bdd cSUP_upper fsup)
[PROOF STATE]
proof (state)
this:
g i x \<le> f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ?i1 ?x1 \<le> f ?x1
[PROOF STEP]
have gfb: "g i x \<le> f b" if "x \<in> {a..b}" for i x
[PROOF STATE]
proof (prove)
using this:
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. g i x \<le> f b
[PROOF STEP]
by (smt (verit, best) mon atLeastAtMost_iff mono_on_def that)
[PROOF STATE]
proof (state)
this:
?x1 \<in> {a..b} \<Longrightarrow> g ?i1 ?x1 \<le> f b

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
have g_le: "g i x \<le> g j x" if "i\<le>j"  for i j x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i x \<le> g j x
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
incseq g

goal (1 subgoal):
 1. g i x \<le> g j x
[PROOF STEP]
by (simp add: incseq_def le_funD that)
[PROOF STATE]
proof (state)
this:
?i1 \<le> ?j1 \<Longrightarrow> g ?i1 ?x1 \<le> g ?j1 ?x1

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
show "integrable (lebesgue_on {a..b}) ( f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) f
[PROOF STEP]
proof (rule integrable_dominated_convergence)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
 2. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 3. integrable (lebesgue_on {a..b}) ?w
 4. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 5. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
show "f \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
using fborel
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on {a..b})

goal (4 subgoals):
 1. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 4. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
have "\<And>x. (\<lambda>i. g i x) \<longlonglongrightarrow> (SUP h \<in> range g. h  x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>i. g i x) \<longlonglongrightarrow> (SUP h\<in>range g. h x)
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x a. a < (SUP h\<in>range g. h x) \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. a < g xa x
 2. \<And>x a. (SUP h\<in>range g. h x) < a \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. g xa x < a
[PROOF STEP]
show "\<forall>\<^sub>F i in sequentially. y < g i x"
        if "y < (SUP h\<in>range g. h x)" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
y < (SUP h\<in>range g. h x)
[PROOF STEP]
obtain h where h: "h \<in> range g" "y < h x"
[PROOF STATE]
proof (prove)
using this:
y < (SUP h\<in>range g. h x)

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> range g; y < h x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using g_le_f
[PROOF STATE]
proof (prove)
using this:
y < (SUP h\<in>range g. h x)
g ?i1 ?x1 \<le> f ?x1

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> range g; y < h x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm)less_cSUP_iff) fastforce+
[PROOF STATE]
proof (state)
this:
h \<in> range g
y < h x

goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<in> range g
y < h x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<in> range g
y < h x

goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. y < g i x
[PROOF STEP]
by (smt (verit, ccfv_SIG) eventually_sequentially g_le imageE)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F i in sequentially. y < g i x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y1 < (SUP h\<in>range g. h ?x1) \<Longrightarrow> \<forall>\<^sub>F i in sequentially. ?y1 < g i ?x1

goal (1 subgoal):
 1. \<And>x a. (SUP h\<in>range g. h x) < a \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. g xa x < a
[PROOF STEP]
show "\<forall>\<^sub>F i in sequentially. g i x < y"
        if "(SUP h\<in>range g. h x) < y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. g i x < y
[PROOF STEP]
by (smt (verit, best) that Sup_apply g_le_f always_eventually fsup image_cong)
[PROOF STATE]
proof (state)
this:
(SUP h\<in>range g. h ?x1) < ?y1 \<Longrightarrow> \<forall>\<^sub>F i in sequentially. g i ?x1 < ?y1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)

goal (4 subgoals):
 1. \<And>i. ?s i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. AE x in lebesgue_on {a..b}. (\<lambda>i. ?s i x) \<longlonglongrightarrow> f x
 4. \<And>i. AE x in lebesgue_on {a..b}. norm (?s i x) \<le> ?w x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)
[PROOF STEP]
show "AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. g i ?x1) \<longlonglongrightarrow> (SUP h\<in>range g. h ?x1)

goal (1 subgoal):
 1. AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x
[PROOF STEP]
by (simp add: fsup)
[PROOF STATE]
proof (state)
this:
AE x in lebesgue_on {a..b}. (\<lambda>i. g i x) \<longlonglongrightarrow> f x

goal (3 subgoals):
 1. \<And>i. g i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. g i \<in> borel_measurable (lebesgue_on {a..b})
 2. integrable (lebesgue_on {a..b}) ?w
 3. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
show "g i \<in> borel_measurable (lebesgue_on {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
using borel_measurable_simple_function simple
[PROOF STATE]
proof (prove)
using this:
simple_function ?M ?f \<Longrightarrow> ?f \<in> borel_measurable ?M
simple_function (lebesgue_on {a..b}) (g ?i1)

goal (1 subgoal):
 1. g i \<in> borel_measurable (lebesgue_on {a..b})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g i \<in> borel_measurable (lebesgue_on {a..b})

goal (2 subgoals):
 1. integrable (lebesgue_on {a..b}) ?w
 2. \<And>i. AE x in lebesgue_on {a..b}. norm (g i x) \<le> ?w x
[PROOF STEP]
show "AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b
[PROOF STEP]
by (simp add: gfb nonneg Measure_Space.AE_I' [of "{}"])
[PROOF STATE]
proof (state)
this:
AE x in lebesgue_on {a..b}. norm (g i x) \<le> f b

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) (\<lambda>x. f b)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on {a..b}) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma X_I_hermitian:
  shows "hermitian X_I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian X_I
[PROOF STEP]
unfolding X_I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian (X \<Otimes> 1\<^sub>m 2)
[PROOF STEP]
using tensor_mat_hermitian[of X 2 "1\<^sub>m 2" 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>X \<in> carrier_mat 2 2; 1\<^sub>m 2 \<in> carrier_mat 2 2; 0 < 2; 0 < 2; hermitian X; hermitian (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> hermitian (X \<Otimes> 1\<^sub>m 2)

goal (1 subgoal):
 1. hermitian (X \<Otimes> 1\<^sub>m 2)
[PROOF STEP]
by (simp add: X_carrier X_hermitian hermitian_one)


[STATEMENT]
lemma inf_pres_conj: "x \<in> conjunctive \<Longrightarrow> y \<in> conjunctive \<Longrightarrow> x \<sqinter> y \<in> conjunctive"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> conjunctive; y \<in> conjunctive\<rbrakk> \<Longrightarrow> x \<sqinter> y \<in> conjunctive
[PROOF STEP]
apply (subst conjunctive_def, safe)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ya z. \<lbrakk>x \<in> conjunctive; y \<in> conjunctive\<rbrakk> \<Longrightarrow> x \<sqinter> y * (ya \<sqinter> z) = x \<sqinter> y * ya \<sqinter> (x \<sqinter> y * z)
[PROOF STEP]
apply (simp add: inf_comp conjunctiveD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ya z. \<lbrakk>x \<in> conjunctive; y \<in> conjunctive\<rbrakk> \<Longrightarrow> x * ya \<sqinter> (x * z) \<sqinter> (y * ya \<sqinter> (y * z)) = x * ya \<sqinter> (y * ya) \<sqinter> (x * z \<sqinter> (y * z))
[PROOF STEP]
by (metis (opaque_lifting, no_types) inf_assoc inf_left_commute)


[STATEMENT]
lemma map_partial_pullback_union:
"map_partial_pullback m f l (S1 \<union> S2) = (map_partial_pullback m f l S1) \<union> (map_partial_pullback m f l S2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_partial_pullback m f l (S1 \<union> S2) = map_partial_pullback m f l S1 \<union> map_partial_pullback m f l S2
[PROOF STEP]
unfolding map_partial_pullback_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> (S1 \<union> S2) = map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> S1 \<union> map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> S2
[PROOF STEP]
by simp


[STATEMENT]
lemma signed_take_bit_int_eq_self_iff:
  \<open>signed_take_bit n k = k \<longleftrightarrow> - (2 ^ n) \<le> k \<and> k < 2 ^ n\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (signed_take_bit n k = k) = (- (2 ^ n) \<le> k \<and> k < 2 ^ n)
[PROOF STEP]
by (auto simp add: signed_take_bit_eq_take_bit_shift take_bit_int_eq_self_iff algebra_simps)


[STATEMENT]
lemma relevant_props: assumes "\<forall>s \<in> props p. i1 s = i2 s" shows "eval i1 p = eval i2 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval i1 p = eval i2 p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>props p. i1 s = i2 s

goal (1 subgoal):
 1. eval i1 p = eval i2 p
[PROOF STEP]
by (induct p) (simp_all, metis)


[STATEMENT]
lemma unit_vec_int_bounds: "set (unit_vecs n) \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int (max 1 Bnd))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (unit_vecs n) \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int (max 1 Bnd))
[PROOF STEP]
unfolding unit_vecs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (unit_vec n) [0..<n]) \<subseteq> \<int>\<^sub>v \<inter> Bounded_vec (of_int (max 1 Bnd))
[PROOF STEP]
by (auto simp: Bounded_vec_def)