[STATEMENT]
theorem groupI:
  fixes G (structure)
  assumes m_closed [simp]:
      "!!x y. [| x \<in> carrier G; y \<in> carrier G |] ==> x \<otimes> y \<in> carrier G"
    and one_closed [simp]: "\<one> \<in> carrier G"
    and m_assoc:
      "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
      (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
    and l_one [simp]: "!!x. x \<in> carrier G ==> \<one> \<otimes> x = x"
    and l_inv_ex: "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>"
  shows "group G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
have l_cancel [simp]:
    "!!x y z. [| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==>
    (x \<otimes> y = x \<otimes> z) = (y = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow> (x \<otimes> y = x \<otimes> z) = (y = z)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; x \<otimes> y = x \<otimes> z\<rbrakk> \<Longrightarrow> y = z
 2. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
fix x y z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; x \<otimes> y = x \<otimes> z\<rbrakk> \<Longrightarrow> y = z
 2. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
assume eq: "x \<otimes> y = x \<otimes> z"
      and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
[PROOF STATE]
proof (state)
this:
x \<otimes> y = x \<otimes> z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; x \<otimes> y = x \<otimes> z\<rbrakk> \<Longrightarrow> y = z
 2. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
with l_inv_ex
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<otimes> y = x \<otimes> z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
[PROOF STEP]
obtain x_inv where xG: "x_inv \<in> carrier G"
      and l_inv: "x_inv \<otimes> x = \<one>"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<otimes> y = x \<otimes> z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G

goal (1 subgoal):
 1. (\<And>x_inv. \<lbrakk>x_inv \<in> carrier G; x_inv \<otimes> x = \<one>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x_inv \<in> carrier G
x_inv \<otimes> x = \<one>

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; x \<otimes> y = x \<otimes> z\<rbrakk> \<Longrightarrow> y = z
 2. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
from G eq xG
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
x \<otimes> y = x \<otimes> z
x_inv \<in> carrier G
[PROOF STEP]
have "(x_inv \<otimes> x) \<otimes> y = (x_inv \<otimes> x) \<otimes> z"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
x \<otimes> y = x \<otimes> z
x_inv \<in> carrier G

goal (1 subgoal):
 1. x_inv \<otimes> x \<otimes> y = x_inv \<otimes> x \<otimes> z
[PROOF STEP]
by (simp add: m_assoc)
[PROOF STATE]
proof (state)
this:
x_inv \<otimes> x \<otimes> y = x_inv \<otimes> x \<otimes> z

goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; x \<otimes> y = x \<otimes> z\<rbrakk> \<Longrightarrow> y = z
 2. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
with G
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
x_inv \<otimes> x \<otimes> y = x_inv \<otimes> x \<otimes> z
[PROOF STEP]
show "y = z"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
x_inv \<otimes> x \<otimes> y = x_inv \<otimes> x \<otimes> z

goal (1 subgoal):
 1. y = z
[PROOF STEP]
by (simp add: l_inv)
[PROOF STATE]
proof (state)
this:
y = z

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
fix x y z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
assume eq: "y = z"
      and G: "x \<in> carrier G"  "y \<in> carrier G"  "z \<in> carrier G"
[PROOF STATE]
proof (state)
this:
y = z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G; y = z\<rbrakk> \<Longrightarrow> x \<otimes> y = x \<otimes> z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G
[PROOF STEP]
show "x \<otimes> y = x \<otimes> z"
[PROOF STATE]
proof (prove)
using this:
y = z
x \<in> carrier G
y \<in> carrier G
z \<in> carrier G

goal (1 subgoal):
 1. x \<otimes> y = x \<otimes> z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<otimes> y = x \<otimes> z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G; ?z \<in> carrier G\<rbrakk> \<Longrightarrow> (?x \<otimes> ?y = ?x \<otimes> ?z) = (?y = ?z)

goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
have r_one:
    "!!x. x \<in> carrier G ==> x \<otimes> \<one> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
assume x: "x \<in> carrier G"
[PROOF STATE]
proof (state)
this:
x \<in> carrier G

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
with l_inv_ex
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<in> carrier G
[PROOF STEP]
obtain x_inv where xG: "x_inv \<in> carrier G"
      and l_inv: "x_inv \<otimes> x = \<one>"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<in> carrier G

goal (1 subgoal):
 1. (\<And>x_inv. \<lbrakk>x_inv \<in> carrier G; x_inv \<otimes> x = \<one>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x_inv \<in> carrier G
x_inv \<otimes> x = \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
from x xG
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
x_inv \<in> carrier G
[PROOF STEP]
have "x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
x_inv \<in> carrier G

goal (1 subgoal):
 1. x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x
[PROOF STEP]
by (simp add: m_assoc [symmetric] l_inv)
[PROOF STATE]
proof (state)
this:
x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> x \<otimes> \<one> = x
[PROOF STEP]
with x xG
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
x_inv \<in> carrier G
x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x
[PROOF STEP]
show "x \<otimes> \<one> = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
x_inv \<in> carrier G
x_inv \<otimes> (x \<otimes> \<one>) = x_inv \<otimes> x

goal (1 subgoal):
 1. x \<otimes> \<one> = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<otimes> \<one> = x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> carrier G \<Longrightarrow> ?x \<otimes> \<one> = ?x

goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
have inv_ex:
    "\<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y \<in> carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
assume x: "x \<in> carrier G"
[PROOF STATE]
proof (state)
this:
x \<in> carrier G

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
with l_inv_ex
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<in> carrier G
[PROOF STEP]
obtain y where y: "y \<in> carrier G"
      and l_inv: "y \<otimes> x = \<one>"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one>
x \<in> carrier G

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> carrier G; y \<otimes> x = \<one>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
y \<in> carrier G
y \<otimes> x = \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
from x y
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
[PROOF STEP]
have "y \<otimes> (x \<otimes> y) = y \<otimes> \<one>"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G

goal (1 subgoal):
 1. y \<otimes> (x \<otimes> y) = y \<otimes> \<one>
[PROOF STEP]
by (simp add: m_assoc [symmetric] l_inv r_one)
[PROOF STATE]
proof (state)
this:
y \<otimes> (x \<otimes> y) = y \<otimes> \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
with x y
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
y \<otimes> (x \<otimes> y) = y \<otimes> \<one>
[PROOF STEP]
have r_inv: "x \<otimes> y = \<one>"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
y \<otimes> (x \<otimes> y) = y \<otimes> \<one>

goal (1 subgoal):
 1. x \<otimes> y = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<otimes> y = \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
from x y
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
[PROOF STEP]
show "\<exists>y \<in> carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G

goal (1 subgoal):
 1. \<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>
[PROOF STEP]
by (fast intro: l_inv r_inv)
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>carrier G. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one> \<and> ?x \<otimes> y = \<one>

goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one> \<and> ?x \<otimes> y = \<one>
[PROOF STEP]
have carrier_subset_Units: "carrier G \<subseteq> Units G"
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier G \<Longrightarrow> \<exists>y\<in>carrier G. y \<otimes> ?x = \<one> \<and> ?x \<otimes> y = \<one>

goal (1 subgoal):
 1. carrier G \<subseteq> Units G
[PROOF STEP]
by (unfold Units_def) fast
[PROOF STATE]
proof (state)
this:
carrier G \<subseteq> Units G

goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
by standard (auto simp: r_one m_assoc carrier_subset_Units)
[PROOF STATE]
proof (state)
this:
Group.group G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in complete_measure) vimage_null_part_sets:
  "f \<in> M \<rightarrow>\<^sub>M N \<Longrightarrow> null_sets N \<subseteq> null_sets (distr M N f) \<Longrightarrow> A \<in> completion N \<Longrightarrow>
  f -` null_part N A \<inter> space M \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; null_sets N \<subseteq> null_sets (distr M N f); A \<in> sets (completion N)\<rbrakk> \<Longrightarrow> f -` null_part N A \<inter> space M \<in> sets M
[PROOF STEP]
using vimage_null_part_null_sets[of f N A]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; null_sets N \<subseteq> null_sets (distr M N f); A \<in> sets (completion N)\<rbrakk> \<Longrightarrow> f -` null_part N A \<inter> space M \<in> null_sets M

goal (1 subgoal):
 1. \<lbrakk>f \<in> M \<rightarrow>\<^sub>M N; null_sets N \<subseteq> null_sets (distr M N f); A \<in> sets (completion N)\<rbrakk> \<Longrightarrow> f -` null_part N A \<inter> space M \<in> sets M
[PROOF STEP]
by auto


[STATEMENT]
lemma disj_idem: "((P::'\<alpha> predicate) \<or> P) = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<or> P) = P
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma generaliseConj:
  assumes i1: "PROP Pure.prop (PROP Pure.prop (Trueprop P) \<Longrightarrow> PROP Pure.prop (Trueprop Q))"
  assumes i2: "PROP Pure.prop (PROP Pure.prop (Trueprop P') \<Longrightarrow> PROP Pure.prop (Trueprop Q'))"
  shows "PROP Pure.prop (PROP Pure.prop (Trueprop (P \<and> P')) \<Longrightarrow> (PROP Pure.prop (Trueprop (Q \<and> Q'))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<and> P') \<Longrightarrow> (Q \<and> Q')
[PROOF STEP]
using i1 i2
[PROOF STATE]
proof (prove)
using this:
(P) \<Longrightarrow> (Q)
(P') \<Longrightarrow> (Q')

goal (1 subgoal):
 1. (P \<and> P') \<Longrightarrow> (Q \<and> Q')
[PROOF STEP]
by (auto simp add: prop_def)


[STATEMENT]
lemma blaschke_unit_circle_fix':
  assumes "cmod a \<noteq> 1"
  shows "moebius_circline (blaschke a) unit_circle = unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_circline (blaschke a) unit_circle = unit_circle
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cmod a \<noteq> 1

goal (1 subgoal):
 1. moebius_circline (blaschke a) unit_circle = unit_circle
[PROOF STEP]
using blaschke_unit_circle_fix unit_circle_fix_iff
[PROOF STATE]
proof (prove)
using this:
cmod a \<noteq> 1
cmod ?a \<noteq> 1 \<Longrightarrow> unit_circle_fix (blaschke ?a)
unit_circle_fix ?M = (moebius_circline ?M unit_circle = unit_circle)

goal (1 subgoal):
 1. moebius_circline (blaschke a) unit_circle = unit_circle
[PROOF STEP]
by simp


[STATEMENT]
lemma NSDERIV_pow: "NSDERIV (\<lambda>x. x ^ n) x :> real n * (x ^ (n - Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSDERIV (\<lambda>x. x ^ n) x :> real n * x ^ (n - Suc 0)
[PROOF STEP]
by (simp add: NSDERIV_DERIV_iff DERIV_pow)


[STATEMENT]
lemma bind_pmf_mono [partial_function_mono]:
  "(\<And>y. mono_spmf (\<lambda>f. C y f)) \<Longrightarrow> mono_spmf (\<lambda>f. bind_pmf p (\<lambda>x. C x f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. monotone spmf.le_fun (ord_spmf (=)) (C y)) \<Longrightarrow> monotone spmf.le_fun (ord_spmf (=)) (\<lambda>f. p \<bind> (\<lambda>x. C x f))
[PROOF STEP]
using bind_spmf_mono[of "\<lambda>_. spmf_of_pmf p" C]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>monotone spmf.le_fun (ord_spmf (=)) (\<lambda>_. spmf_of_pmf p); \<And>y. monotone spmf.le_fun (ord_spmf (=)) (C y)\<rbrakk> \<Longrightarrow> monotone spmf.le_fun (ord_spmf (=)) (\<lambda>f. spmf_of_pmf p \<bind> (\<lambda>y. C y f))

goal (1 subgoal):
 1. (\<And>y. monotone spmf.le_fun (ord_spmf (=)) (C y)) \<Longrightarrow> monotone spmf.le_fun (ord_spmf (=)) (\<lambda>f. p \<bind> (\<lambda>x. C x f))
[PROOF STEP]
by simp


[STATEMENT]
lemma ACI_nPlus_flatten_PLUS:
  "\<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x \<in> X1 \<union> X2. \<not>(\<exists>r s. x = Plus r s)\<rbrakk>\<Longrightarrow>
  ACI_nPlus (flatten PLUS X1) (flatten PLUS X2) = flatten PLUS (X1 \<union> X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x\<in>X1 \<union> X2. \<nexists>r s. x = Plus r s\<rbrakk> \<Longrightarrow> ACI_nPlus (PLUS (sorted_list_of_set X1)) (PLUS (sorted_list_of_set X2)) = PLUS (sorted_list_of_set (X1 \<union> X2))
[PROOF STEP]
by (rule trans[OF ACI_nPlus_PLUS]) auto


[STATEMENT]
lemma interval_integral_Ico:
  "a \<le> b \<Longrightarrow> (LBINT x=a..b. f x) = (LBINT x : {a..<b}. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> interval_lebesgue_integral lborel (ereal a) (ereal b) f = set_lebesgue_integral lborel {a..<b} f
[PROOF STEP]
by (auto intro!: set_integral_discrete_difference[where X="{a, b}"]
           simp add: interval_lebesgue_integral_def einterval_iff)


[STATEMENT]
lemma cols_mat_mul:
  shows "set (cols (A * B)) = (*\<^sub>v) A ` set (cols B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols (A * B)) = (*\<^sub>v) A ` set (cols B)
[PROOF STEP]
by (simp add: cols_mat_mul_map)


[STATEMENT]
lemma compute_Some_Some_eq: "(Some x = Some y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Some x = Some y) = (x = y)
[PROOF STEP]
by auto


[STATEMENT]
lemma Ord_LeastI2_ex:
  "\<exists>a. Ord a \<and> P a \<Longrightarrow> (\<And>x. \<lbrakk>Ord x; P x\<rbrakk> \<Longrightarrow> Q x) \<Longrightarrow> Q (LEAST i. Ord i \<and> P i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>a. Ord a \<and> P a; \<And>x. \<lbrakk>Ord x; P x\<rbrakk> \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> Q (LEAST i. Ord i \<and> P i)
[PROOF STEP]
by (blast intro: Ord_LeastI_ex Ord_Least)


[STATEMENT]
lemma ennreal_real_conv_ennreal_of_enat: "ennreal (real n) = ennreal_of_enat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real n) = ennreal_of_enat (enat n)
[PROOF STEP]
by (simp add: ennreal_of_nat_eq_real_of_nat)


[STATEMENT]
lemma (in field) neg_1_not_0 [simp]: "\<ominus>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub> \<noteq> \<zero>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ominus> \<one> \<noteq> \<zero>
[PROOF STEP]
by (metis minus_minus minus_zero one_closed zero_not_one)


[STATEMENT]
lemma eventually_nonzero_ln_const_at_top [eventually_nonzero_simps]:
  "b > 0 \<Longrightarrow> eventually_nonzero at_top (\<lambda>x. ln (b * x :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> eventually_nonzero at_top (\<lambda>x. ln (b * x))
[PROOF STEP]
unfolding eventually_nonzero_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> \<forall>\<^sub>F x in at_top. ln (b * x) \<noteq> 0
[PROOF STEP]
apply (rule eventually_mono [OF eventually_gt_at_top[of "max 1 (inverse b)"]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < b; max 1 (inverse b) < x\<rbrakk> \<Longrightarrow> ln (b * x) \<noteq> 0
[PROOF STEP]
by (metis exp_ln exp_minus exp_minus_inverse less_numeral_extra(3) ln_gt_zero max_less_iff_conj mult.commute mult_strict_right_mono)


[STATEMENT]
lemma infinite_inj_infinite_image: "inj_on f Z ==> infinite (f ` Z) = infinite Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f Z \<Longrightarrow> infinite (f ` Z) = infinite Z
[PROOF STEP]
apply(rule ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f Z; infinite (f ` Z) \<noteq> infinite Z\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f Z; finite (f ` Z) = infinite Z\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(force dest: finite_imageD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tllist_all2_tnthD2:
  "\<lbrakk> tllist_all2 P Q xs ys; enat n < tlength ys \<rbrakk>
  \<Longrightarrow> P (tnth xs n) (tnth ys n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>tllist_all2 P Q xs ys; enat n < tlength ys\<rbrakk> \<Longrightarrow> P (tnth xs n) (tnth ys n)
[PROOF STEP]
by(simp add: tllist_all2_conv_all_tnth)


[STATEMENT]
lemma reflect__coplanar:
  assumes "A B Reflect C D"
  shows "Coplanar A B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar A B C D
[PROOF STEP]
by (metis (no_types) Reflect_def Tarski_neutral_dimensionless.reflectl__coplanar Tarski_neutral_dimensionless_axioms assms col_trivial_2 ncop__ncols)


[STATEMENT]
lemma hequiv_sym_rel: \<open>Hintikka A H \<Longrightarrow> sym (hequiv_rel A H)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hintikka A H \<Longrightarrow> sym (hequiv_rel A H)
[PROOF STEP]
unfolding sym_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hintikka A H \<Longrightarrow> \<forall>x y. (x, y) \<in> hequiv_rel A H \<longrightarrow> (y, x) \<in> hequiv_rel A H
[PROOF STEP]
using hequiv_sym
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Hintikka ?A ?H; ?i \<in> ?A; ?j \<in> ?A\<rbrakk> \<Longrightarrow> hequiv ?H ?i ?j = hequiv ?H ?j ?i

goal (1 subgoal):
 1. Hintikka A H \<Longrightarrow> \<forall>x y. (x, y) \<in> hequiv_rel A H \<longrightarrow> (y, x) \<in> hequiv_rel A H
[PROOF STEP]
by fast


[STATEMENT]
lemma to_vec_matrix_scalar_mult: "to_vec (x *\<^sub>S A) = x *k to_vec A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_vec (x *\<^sub>S A) = x *k to_vec A
[PROOF STEP]
by transfer (simp add: matrix_scalar_mult_def)


[STATEMENT]
lemma cartesian_product_infiniteR_imp_infinite: "\<lbrakk> infinite B; A \<noteq> {} \<rbrakk> \<Longrightarrow> infinite (A \<times> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite B; A \<noteq> {}\<rbrakk> \<Longrightarrow> infinite (A \<times> B)
[PROOF STEP]
by (blast dest: finite_cartesian_productD2)


[STATEMENT]
lemma octo_mult_scaleR_right: "x * (r *\<^sub>R y) = r *\<^sub>R (x * y :: octo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * r *\<^sub>R y = r *\<^sub>R (x * y)
[PROOF STEP]
by (simp add: octo_eq_iff octo_mult_components algebra_simps)


[STATEMENT]
lemma proj2_cart2:
  assumes "z_non_zero p"
  shows "proj2_pt (cart2_pt p) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_pt (cart2_pt p) = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proj2_pt (cart2_pt p) = p
[PROOF STEP]
from \<open>z_non_zero p\<close>
[PROOF STATE]
proof (chain)
picking this:
z_non_zero p
[PROOF STEP]
have "(proj2_rep p)$3 *\<^sub>R vector2_append1 (cart2_pt p) = proj2_rep p"
[PROOF STATE]
proof (prove)
using this:
z_non_zero p

goal (1 subgoal):
 1. proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p) = proj2_rep p
[PROOF STEP]
unfolding vector2_append1_def and cart2_pt_def and vector_def
[PROOF STATE]
proof (prove)
using this:
z_non_zero p

goal (1 subgoal):
 1. proj2_rep p $ 3 *\<^sub>R vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [proj2_rep p $ 1 / proj2_rep p $ 3, proj2_rep p $ 2 / proj2_rep p $ 3] (\<lambda>n x. 0) 1) $ 1, vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [proj2_rep p $ 1 / proj2_rep p $ 3, proj2_rep p $ 2 / proj2_rep p $ 3] (\<lambda>n x. 0) 1) $ 2, 1] (\<lambda>n x. 0) 1) = proj2_rep p
[PROOF STEP]
by (simp add: vec_eq_iff forall_3)
[PROOF STATE]
proof (state)
this:
proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p) = proj2_rep p

goal (1 subgoal):
 1. proj2_pt (cart2_pt p) = p
[PROOF STEP]
with \<open>z_non_zero p\<close>
    and proj2_abs_mult [of "(proj2_rep p)$3" "vector2_append1 (cart2_pt p)"]
[PROOF STATE]
proof (chain)
picking this:
z_non_zero p
z_non_zero p \<Longrightarrow> proj2_abs (proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p)) = proj2_abs (vector2_append1 (cart2_pt p))
proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p) = proj2_rep p
[PROOF STEP]
have "proj2_abs (vector2_append1 (cart2_pt p)) = proj2_abs (proj2_rep p)"
[PROOF STATE]
proof (prove)
using this:
z_non_zero p
z_non_zero p \<Longrightarrow> proj2_abs (proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p)) = proj2_abs (vector2_append1 (cart2_pt p))
proj2_rep p $ 3 *\<^sub>R vector2_append1 (cart2_pt p) = proj2_rep p

goal (1 subgoal):
 1. proj2_abs (vector2_append1 (cart2_pt p)) = proj2_abs (proj2_rep p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj2_abs (vector2_append1 (cart2_pt p)) = proj2_abs (proj2_rep p)

goal (1 subgoal):
 1. proj2_pt (cart2_pt p) = p
[PROOF STEP]
thus "proj2_pt (cart2_pt p) = p"
[PROOF STATE]
proof (prove)
using this:
proj2_abs (vector2_append1 (cart2_pt p)) = proj2_abs (proj2_rep p)

goal (1 subgoal):
 1. proj2_pt (cart2_pt p) = p
[PROOF STEP]
by (unfold proj2_pt_def) (simp add: proj2_abs_rep)
[PROOF STATE]
proof (state)
this:
proj2_pt (cart2_pt p) = p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_iff_aux_2:
  assumes "bijective r"
  shows "r;x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star> \<longleftrightarrow> x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>);r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r ; x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) = (x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (r ; x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) = (x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)
[PROOF STEP]
have "((x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>);r)\<^sup>T = r\<^sup>T;(x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)\<^sup>T = r\<^sup>T ; (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>)
[PROOF STEP]
by (metis conv_add conv_contrav conv_invol star_conv sup.commute)
[PROOF STATE]
proof (state)
this:
((x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)\<^sup>T = r\<^sup>T ; (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>)

goal (1 subgoal):
 1. (r ; x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) = (x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)\<^sup>T = r\<^sup>T ; (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>)

goal (1 subgoal):
 1. (r ; x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) = (x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)
[PROOF STEP]
by (metis assms conv_invol conv_iso path_iff_aux_1)
[PROOF STATE]
proof (state)
this:
(r ; x \<le> x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) = (x\<^sup>T \<le> (x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>) ; r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r01_binary_expansion_diff:
  shows "(fst (snd (r01_binary_expansion'' r n))) - (snd (snd (r01_binary_expansion'' r n))) = (1/2)^(Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r n)) - snd (snd (r01_binary_expansion'' r n)) = (1 / 2) ^ Suc n
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fst (snd (r01_binary_expansion'' r 0)) - snd (snd (r01_binary_expansion'' r 0)) = (1 / 2) ^ Suc 0
 2. \<And>n. fst (snd (r01_binary_expansion'' r n)) - snd (snd (r01_binary_expansion'' r n)) = (1 / 2) ^ Suc n \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n))) - snd (snd (r01_binary_expansion'' r (Suc n))) = (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
case (Suc n')
[PROOF STATE]
proof (state)
this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'

goal (2 subgoals):
 1. fst (snd (r01_binary_expansion'' r 0)) - snd (snd (r01_binary_expansion'' r 0)) = (1 / 2) ^ Suc 0
 2. \<And>n. fst (snd (r01_binary_expansion'' r n)) - snd (snd (r01_binary_expansion'' r n)) = (1 / 2) ^ Suc n \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n))) - snd (snd (r01_binary_expansion'' r (Suc n))) = (1 / 2) ^ Suc (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
proof(cases "r01_binary_expansion'' r n'")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'; r01_binary_expansion'' r n' = (a, b, c)\<rbrakk> \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
case 1:(fields a ur lr)
[PROOF STATE]
proof (state)
this:
r01_binary_expansion'' r n' = (a, ur, lr)

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'; r01_binary_expansion'' r n' = (a, b, c)\<rbrakk> \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
assume "fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ (Suc n')"
[PROOF STATE]
proof (state)
this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'; r01_binary_expansion'' r n' = (a, b, c)\<rbrakk> \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'
[PROOF STEP]
have 2:"ur - lr = (1/2)^(Suc n')"
[PROOF STATE]
proof (prove)
using this:
fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'

goal (1 subgoal):
 1. ur - lr = (1 / 2) ^ Suc n'
[PROOF STEP]
by (simp add: 1)
[PROOF STATE]
proof (state)
this:
ur - lr = (1 / 2) ^ Suc n'

goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>fst (snd (r01_binary_expansion'' r n')) - snd (snd (r01_binary_expansion'' r n')) = (1 / 2) ^ Suc n'; r01_binary_expansion'' r n' = (a, b, c)\<rbrakk> \<Longrightarrow> fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
have [simp]:"ur * 4 - (ur * 4 + lr * 4) / 2 = (ur - lr) * 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ur * 4 - (ur * 4 + lr * 4) / 2 = (ur - lr) * 2
[PROOF STEP]
by(simp add: division_ring_class.add_divide_distrib)
[PROOF STATE]
proof (state)
this:
ur * 4 - (ur * 4 + lr * 4) / 2 = (ur - lr) * 2

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
have "ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'
[PROOF STEP]
by(simp add: 2)
[PROOF STATE]
proof (state)
this:
ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
have "(ur * 4 + lr * 4) / 2 - lr * 4 = (1 / 2) ^ n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ur * 4 + lr * 4) / 2 - lr * 4 = (1 / 2) ^ n'
[PROOF STEP]
by(simp add: division_ring_class.add_divide_distrib ring_class.right_diff_distrib[symmetric] 2)
[PROOF STATE]
proof (state)
this:
(ur * 4 + lr * 4) / 2 - lr * 4 = (1 / 2) ^ n'

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'
(ur * 4 + lr * 4) / 2 - lr * 4 = (1 / 2) ^ n'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ur * 4 - (ur * 4 + lr * 4) / 2 = (1 / 2) ^ n'
(ur * 4 + lr * 4) / 2 - lr * 4 = (1 / 2) ^ n'

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')
[PROOF STEP]
by(simp add: 1 Let_def)
[PROOF STATE]
proof (state)
this:
fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst (snd (r01_binary_expansion'' r (Suc n'))) - snd (snd (r01_binary_expansion'' r (Suc n'))) = (1 / 2) ^ Suc (Suc n')

goal (1 subgoal):
 1. fst (snd (r01_binary_expansion'' r 0)) - snd (snd (r01_binary_expansion'' r 0)) = (1 / 2) ^ Suc 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma (in group) subgroup_order_dvd_group_order:
  assumes "subgroup H G"
  shows "order (G\<lparr>carrier := H\<rparr>) dvd order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (G\<lparr>carrier := H\<rparr>) dvd order G
[PROOF STEP]
by (metis subgroup_card_dvd_group_ord[of H] assms subgroup_card_eq_order)


[STATEMENT]
lemma cong2_per2__cong_3:
  assumes "Per A B C"
    "Per A' B' C'" and
    "Cong A C A' C'" and
    "Cong B C B' C'"
  shows "A B C Cong3 A' B' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C Cong3 A' B' C'
[PROOF STEP]
by (metis Tarski_neutral_dimensionless.Cong3_def Tarski_neutral_dimensionless_axioms assms(1) assms(2) assms(3) assms(4) cong2_per2__cong cong_3_swap)


[STATEMENT]
lemma rbl_word_mul: "rev (to_bl (x * y)) = rbl_mul (rev (to_bl x)) (rev (to_bl y))"
  for x :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (to_bl (x * y)) = rbl_mul (rev (to_bl x)) (rev (to_bl y))
[PROOF STEP]
using word_rbl_mul_induct[where xs="rev (to_bl x)" and y=y]
[PROOF STATE]
proof (prove)
using this:
length (rev (to_bl x)) \<le> size y \<Longrightarrow> rbl_mul (rev (to_bl x)) (rev (to_bl y)) = take (length (rev (to_bl x))) (rev (to_bl (of_bl (rev (rev (to_bl x))) * y)))

goal (1 subgoal):
 1. rev (to_bl (x * y)) = rbl_mul (rev (to_bl x)) (rev (to_bl y))
[PROOF STEP]
by (simp add: word_size)


[STATEMENT]
lemma prv_neg_exi_implies_all_neg:
  assumes x: "x \<in> var" and \<phi>: "\<phi> \<in> fmla" and "prv (neg (exi x \<phi>))"
  shows "prv (all x (neg \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (all x (neg \<phi>))
[PROOF STEP]
by (meson \<phi> all assms(3) exi neg prv_imp_mp prv_neg_exi_imp_all_neg x)


[STATEMENT]
lemma map_pmf_rep_eq:
  "measure_pmf (map_pmf f M) = distr (measure_pmf M) (count_space UNIV) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf (map_pmf f M) = distr (measure_pmf M) (count_space UNIV) f
[PROOF STEP]
unfolding map_pmf_def bind_pmf.rep_eq comp_def return_pmf.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf M \<bind> (\<lambda>x. return (count_space UNIV) (f (id x))) = distr (measure_pmf M) (count_space UNIV) f
[PROOF STEP]
using bind_return_distr[of M f "count_space UNIV"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>space (measure_pmf M) \<noteq> {}; measure_pmf.random_variable M (count_space UNIV) f\<rbrakk> \<Longrightarrow> measure_pmf M \<bind> return (count_space UNIV) \<circ> f = distr (measure_pmf M) (count_space UNIV) f

goal (1 subgoal):
 1. measure_pmf M \<bind> (\<lambda>x. return (count_space UNIV) (f (id x))) = distr (measure_pmf M) (count_space UNIV) f
[PROOF STEP]
by (simp add: comp_def)


[STATEMENT]
lemma real_le_eq_diff: "(x \<le> y) \<longleftrightarrow> (x-y \<le> (0::real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (x - y \<le> 0)
[PROOF STEP]
by (cases x, cases y) (simp add: real_le real_zero_def real_diff_def real_add real_minus preal_add_commute)


[STATEMENT]
lemma fds_nth_inverse:
  "fds_nth (inverse f) = dirichlet_inverse (fds_nth f) (inverse (fds_nth f 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (inverse f) = dirichlet_inverse (fds_nth f) (inverse (fds_nth f 1))
[PROOF STEP]
by (simp add: inverse_fds_def fds_nth_fds fun_eq_iff)


[STATEMENT]
lemma Bernstein_reciprocal:
  "reciprocal_poly p (Bernstein_Poly_01 i p)
    = smult (p choose i) ([:-1, 1:]^(p-i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
assume "i \<le> p"
[PROOF STATE]
proof (state)
this:
i \<le> p

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
hence "reciprocal_poly p (Bernstein_Poly_01 i p) =
         reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p)"
[PROOF STATE]
proof (prove)
using this:
i \<le> p

goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) = reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p)
[PROOF STEP]
by (auto simp: degree_Bernstein)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p)

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p)

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
have "... = reflect_poly (Bernstein_Poly_01 i p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p) = reflect_poly (Bernstein_Poly_01 i p)
[PROOF STEP]
by (rule reciprocal_degree)
[PROOF STATE]
proof (state)
this:
reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p) = reflect_poly (Bernstein_Poly_01 i p)

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reciprocal_poly (degree (Bernstein_Poly_01 i p)) (Bernstein_Poly_01 i p) = reflect_poly (Bernstein_Poly_01 i p)

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
have "... = smult (p choose i) ([:-1, 1:]^(p-i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
by (auto simp: Bernstein_Poly_01_def reflect_poly_simps monom_altdef
         pcompose_pCons reflect_poly_pCons' hom_distribs)
[PROOF STATE]
proof (state)
this:
reflect_poly (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal (2 subgoals):
 1. ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
 2. \<not> ?P \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
assume h:"\<not> i \<le> p"
[PROOF STATE]
proof (state)
this:
\<not> i \<le> p

goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
hence "reciprocal_poly p (Bernstein_Poly_01 i p) = (0::real poly)"
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> p

goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) = 0
[PROOF STEP]
by (auto simp: coeff_gt reciprocal_poly_def)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = 0

goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = 0

goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
have "... = smult (p choose i) ([:-1, 1:]^(p - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> p

goal (1 subgoal):
 1. 0 = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal (1 subgoal):
 1. \<not> i \<le> p \<Longrightarrow> reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal (1 subgoal):
 1. reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (Bernstein_Poly_01 i p) = smult (real (p choose i)) ([:- 1, 1:] ^ (p - i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Compl_eq_empty_iff: "- A = {} \<longleftrightarrow> A = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- A = {}) = (A = UNIV)
[PROOF STEP]
by auto


[STATEMENT]
lemma unitary_mult_conjugate:
  assumes "A \<in> carrier_mat n n"
  and "V\<in> carrier_mat n n"
  and "U\<in> carrier_mat n n"
  and "B\<in> carrier_mat n n"
  and "unitary V"
  and "mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B"
  shows "A = V* U * B * Complex_Matrix.adjoint (V * U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "Complex_Matrix.adjoint V *A * V \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint V * A * V \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. Complex_Matrix.adjoint V * A * V \<in> carrier_mat n n
[PROOF STEP]
by (metis adjoint_dim_row carrier_matD(2) carrier_mat_triv
        index_mult_mat(2) index_mult_mat(3))
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint V * A * V \<in> carrier_mat n n

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "A * V = V * (Complex_Matrix.adjoint V) *  (A * V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * V = V * Complex_Matrix.adjoint V * (A * V)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. A * V = V * Complex_Matrix.adjoint V * (A * V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * V = V * Complex_Matrix.adjoint V * (A * V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * V = V * Complex_Matrix.adjoint V * (A * V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * (Complex_Matrix.adjoint V *(A * V))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * Complex_Matrix.adjoint V * (A * V) = V * (Complex_Matrix.adjoint V * (A * V))
[PROOF STEP]
proof (rule assoc_mult_mat, auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * V \<in> carrier_mat (dim_row V) ?n\<^sub>4
[PROOF STEP]
show "A * V \<in> carrier_mat (dim_row V) (dim_row V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * V \<in> carrier_mat (dim_row V) (dim_row V)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. A * V \<in> carrier_mat (dim_row V) (dim_row V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * V \<in> carrier_mat (dim_row V) (dim_row V)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V * Complex_Matrix.adjoint V * (A * V) = V * (Complex_Matrix.adjoint V * (A * V))

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * Complex_Matrix.adjoint V * (A * V) = V * (Complex_Matrix.adjoint V * (A * V))

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * (Complex_Matrix.adjoint V *A * V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * (Complex_Matrix.adjoint V * (A * V)) = V * (Complex_Matrix.adjoint V * A * V)
[PROOF STEP]
by (metis adjoint_dim' assms(1) assms(2) assoc_mult_mat)
[PROOF STATE]
proof (state)
this:
V * (Complex_Matrix.adjoint V * (A * V)) = V * (Complex_Matrix.adjoint V * A * V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * (Complex_Matrix.adjoint V * (A * V)) = V * (Complex_Matrix.adjoint V * A * V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * (U * B * (Complex_Matrix.adjoint U))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * (Complex_Matrix.adjoint V * A * V) = V * (U * B * Complex_Matrix.adjoint U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. V * (Complex_Matrix.adjoint V * A * V) = V * (U * B * Complex_Matrix.adjoint U)
[PROOF STEP]
by (simp add: Complex_Matrix.adjoint_adjoint mat_conj_def)
[PROOF STATE]
proof (state)
this:
V * (Complex_Matrix.adjoint V * A * V) = V * (U * B * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * (Complex_Matrix.adjoint V * A * V) = V * (U * B * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * (U * (B * (Complex_Matrix.adjoint U)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * (U * B * Complex_Matrix.adjoint U) = V * (U * (B * Complex_Matrix.adjoint U))
[PROOF STEP]
by (metis adjoint_dim' assms(3) assms(4) assoc_mult_mat)
[PROOF STATE]
proof (state)
this:
V * (U * B * Complex_Matrix.adjoint U) = V * (U * (B * Complex_Matrix.adjoint U))

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * (U * B * Complex_Matrix.adjoint U) = V * (U * (B * Complex_Matrix.adjoint U))

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * U * (B * (Complex_Matrix.adjoint U))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * (U * (B * Complex_Matrix.adjoint U)) = V * U * (B * Complex_Matrix.adjoint U)
[PROOF STEP]
proof (rule assoc_mult_mat[symmetric], auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col V) (dim_row B)
[PROOF STEP]
show "U \<in> carrier_mat (dim_col V) (dim_row B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col V) (dim_row B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. U \<in> carrier_mat (dim_col V) (dim_row B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<in> carrier_mat (dim_col V) (dim_row B)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V * (U * (B * Complex_Matrix.adjoint U)) = V * U * (B * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * (U * (B * Complex_Matrix.adjoint U)) = V * U * (B * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * U * B * (Complex_Matrix.adjoint U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * U * (B * Complex_Matrix.adjoint U) = V * U * B * Complex_Matrix.adjoint U
[PROOF STEP]
proof (rule assoc_mult_mat[symmetric], auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B \<in> carrier_mat (dim_col U) (dim_col U)
[PROOF STEP]
show "B \<in> carrier_mat (dim_col U) (dim_col U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat (dim_col U) (dim_col U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. B \<in> carrier_mat (dim_col U) (dim_col U)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat (dim_col U) (dim_col U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V * U * (B * Complex_Matrix.adjoint U) = V * U * B * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A * V = V * U * B * Complex_Matrix.adjoint U
[PROOF STEP]
have eq: "A * V = V * U * B * (Complex_Matrix.adjoint U)"
[PROOF STATE]
proof (prove)
using this:
A * V = V * U * B * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. A * V = V * U * B * Complex_Matrix.adjoint U
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A * V = V * U * B * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "A = A * (V * Complex_Matrix.adjoint V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = A * (V * Complex_Matrix.adjoint V)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. A = A * (V * Complex_Matrix.adjoint V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A = A * (V * Complex_Matrix.adjoint V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A = A * (V * Complex_Matrix.adjoint V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = A * V * Complex_Matrix.adjoint V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (V * Complex_Matrix.adjoint V) = A * V * Complex_Matrix.adjoint V
[PROOF STEP]
proof (rule assoc_mult_mat[symmetric], auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V \<in> carrier_mat (dim_col A) (dim_col V)
[PROOF STEP]
show "V \<in> carrier_mat (dim_col A) (dim_col V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V \<in> carrier_mat (dim_col A) (dim_col V)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. V \<in> carrier_mat (dim_col A) (dim_col V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<in> carrier_mat (dim_col A) (dim_col V)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A * (V * Complex_Matrix.adjoint V) = A * V * Complex_Matrix.adjoint V

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * (V * Complex_Matrix.adjoint V) = A * V * Complex_Matrix.adjoint V

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * U * B * (Complex_Matrix.adjoint U) *
    (Complex_Matrix.adjoint V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * V * Complex_Matrix.adjoint V = V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
A * V = V * U * B * Complex_Matrix.adjoint U

goal (1 subgoal):
 1. A * V * Complex_Matrix.adjoint V = V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * V * Complex_Matrix.adjoint V = V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * V * Complex_Matrix.adjoint V = V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V * U * B * ((Complex_Matrix.adjoint U) *
    (Complex_Matrix.adjoint V))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V = V * U * B * (Complex_Matrix.adjoint U * Complex_Matrix.adjoint V)
[PROOF STEP]
proof (rule assoc_mult_mat, auto simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.adjoint U \<in> carrier_mat (dim_col B) (dim_col V)
[PROOF STEP]
show "Complex_Matrix.adjoint U \<in> carrier_mat (dim_col B) (dim_col V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint U \<in> carrier_mat (dim_col B) (dim_col V)
[PROOF STEP]
using adjoint_dim' assms
[PROOF STATE]
proof (prove)
using this:
?A \<in> carrier_mat ?n ?m \<Longrightarrow> Complex_Matrix.adjoint ?A \<in> carrier_mat ?m ?n
A \<in> carrier_mat n n
V \<in> carrier_mat n n
U \<in> carrier_mat n n
B \<in> carrier_mat n n
Complex_Matrix.unitary V
mat_conj (Complex_Matrix.adjoint V) A = mat_conj U B

goal (1 subgoal):
 1. Complex_Matrix.adjoint U \<in> carrier_mat (dim_col B) (dim_col V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint U \<in> carrier_mat (dim_col B) (dim_col V)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V = V * U * B * (Complex_Matrix.adjoint U * Complex_Matrix.adjoint V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V * U * B * Complex_Matrix.adjoint U * Complex_Matrix.adjoint V = V * U * B * (Complex_Matrix.adjoint U * Complex_Matrix.adjoint V)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
have "... = V* U * B * Complex_Matrix.adjoint (V * U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V * U * B * (Complex_Matrix.adjoint U * Complex_Matrix.adjoint V) = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
by (metis adjoint_mult assms(2) assms(3))
[PROOF STATE]
proof (state)
this:
V * U * B * (Complex_Matrix.adjoint U * Complex_Matrix.adjoint V) = V * U * B * Complex_Matrix.adjoint (V * U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A = V * U * B * Complex_Matrix.adjoint (V * U)

goal (1 subgoal):
 1. A = V * U * B * Complex_Matrix.adjoint (V * U)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A = V * U * B * Complex_Matrix.adjoint (V * U)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) Span_is_subalgebra:
  assumes "subfield K R" "set Us \<subseteq> carrier R" shows "subalgebra K (Span K Us) R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subalgebra K (Span K Us) R
[PROOF STEP]
using Span_smult_closed[OF assms] Span_is_add_subgroup[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k \<in> K; ?v \<in> Span K Us\<rbrakk> \<Longrightarrow> ?k \<otimes> ?v \<in> Span K Us
subgroup (Span K Us) (add_monoid R)

goal (1 subgoal):
 1. subalgebra K (Span K Us) R
[PROOF STEP]
unfolding subalgebra_def subalgebra_axioms_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?k \<in> K; ?v \<in> Span K Us\<rbrakk> \<Longrightarrow> ?k \<otimes> ?v \<in> Span K Us
subgroup (Span K Us) (add_monoid R)

goal (1 subgoal):
 1. subgroup (Span K Us) (add_monoid R) \<and> (\<forall>k v. k \<in> K \<longrightarrow> v \<in> Span K Us \<longrightarrow> k \<otimes> v \<in> Span K Us)
[PROOF STEP]
by auto


[STATEMENT]
lemma word_msb_sint: "msb w \<longleftrightarrow> sint w < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msb w = (sint w < 0)
[PROOF STEP]
by (simp add: msb_word_eq bit_last_iff)


[STATEMENT]
lemma unitary11_gen_cis_blaschke_rev:
  assumes "k' \<noteq> 0" and "M = k' *\<^sub>s\<^sub>m (cis \<phi>, 0, 0, 1) *\<^sub>m\<^sub>m (1, -a', -cnj a', 1)" and
          "a' * cnj a' \<noteq> 1"
  shows "\<exists> k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0  \<and>
                          M = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<and> M = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k' \<noteq> 0
M = k' *\<^sub>s\<^sub>m (cis \<phi>, 0, 0, 1) *\<^sub>m\<^sub>m (1, - a', - cnj a', 1)
a' * cnj a' \<noteq> 1

goal (1 subgoal):
 1. \<exists>k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<and> M = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a)
[PROOF STEP]
apply (rule_tac x="k'*cis(\<phi>/2)" in exI, rule_tac x="cis(\<phi>/2)" in exI, rule_tac x="-a'*cis(\<phi>/2)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k' \<noteq> 0; M = k' *\<^sub>s\<^sub>m (cis \<phi>, 0, 0, 1) *\<^sub>m\<^sub>m (1, - a', - cnj a', 1); a' * cnj a' \<noteq> 1; k' \<noteq> 0; M = k' *\<^sub>s\<^sub>m (cis \<phi>, 0, 0, 1) *\<^sub>m\<^sub>m (1, - a', - cnj a', 1); a' * cnj a' \<noteq> 1; k' \<noteq> 0; M = k' *\<^sub>s\<^sub>m (cis \<phi>, 0, 0, 1) *\<^sub>m\<^sub>m (1, - a', - cnj a', 1); a' * cnj a' \<noteq> 1\<rbrakk> \<Longrightarrow> k' * cis (\<phi> / 2) \<noteq> 0 \<and> mat_det (cis (\<phi> / 2), - a' * cis (\<phi> / 2), cnj (- a' * cis (\<phi> / 2)), cnj (cis (\<phi> / 2))) \<noteq> 0 \<and> M = (k' * cis (\<phi> / 2)) *\<^sub>s\<^sub>m (cis (\<phi> / 2), - a' * cis (\<phi> / 2), cnj (- a' * cis (\<phi> / 2)), cnj (cis (\<phi> / 2)))
[PROOF STEP]
apply (simp add: cis_mult mult.commute mult.left_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ipv6_preferred_to_compressed_pull_out_if:
    "ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = (
    if max_zero_streak [a,b,c,d,e,f,g,h] > 1 then
      List_explode (List_replace1 (replicate (max_zero_streak [a,b,c,d,e,f,g,h]) 0) [] (goup_by_zeros [a,b,c,d,e,f,g,h]))
    else
      map Some [a,b,c,d,e,f,g,h]
    )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = (if 1 < max_zero_streak [a, b, c, d, e, f, g, h] then List_explode (List_replace1 (replicate (max_zero_streak [a, b, c, d, e, f, g, h]) 0) [] (goup_by_zeros [a, b, c, d, e, f, g, h])) else map Some [a, b, c, d, e, f, g, h])
[PROOF STEP]
apply (simp only: ipv6_preferred_to_compressed.simps Let_def max_zero_streak_def List_explode_goup_by_zeros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List_explode (if 1 < foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0 then List_replace1 (replicate (foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0) 0) [] (goup_by_zeros [a, b, c, d, e, f, g, h]) else goup_by_zeros [a, b, c, d, e, f, g, h]) = (if 1 < foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0 then List_explode (List_replace1 (replicate (foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0) 0) [] (goup_by_zeros [a, b, c, d, e, f, g, h])) else map Some [a, b, c, d, e, f, g, h])
[PROOF STEP]
using List_explode_goup_by_zeros
[PROOF STATE]
proof (prove)
using this:
List_explode (goup_by_zeros ?xs) = map Some ?xs

goal (1 subgoal):
 1. List_explode (if 1 < foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0 then List_replace1 (replicate (foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0) 0) [] (goup_by_zeros [a, b, c, d, e, f, g, h]) else goup_by_zeros [a, b, c, d, e, f, g, h]) = (if 1 < foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0 then List_explode (List_replace1 (replicate (foldr (\<lambda>xs. max (length xs)) (goup_by_zeros [a, b, c, d, e, f, g, h]) 0) 0) [] (goup_by_zeros [a, b, c, d, e, f, g, h])) else map Some [a, b, c, d, e, f, g, h])
[PROOF STEP]
by presburger


[STATEMENT]
lemma cring_lucas_lehmer_ring_mod [intro]:
  assumes "m > 1"
  shows   "cring (lucas_lehmer_ring_mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (lucas_lehmer_ring_mod m)
[PROOF STEP]
proof unfold_locales
[PROOF STATE]
proof (state)
goal (15 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 2. \<And>x y z. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); z \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z = x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> (y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z)
 3. \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 4. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x = x
 5. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> = x
 6. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y = y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x
 7. carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))
 8. \<And>x y. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<in> carrier (lucas_lehmer_ring_mod m)
 9. \<And>x y z. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m); z \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z = x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z)
 10. \<one>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<in> carrier (lucas_lehmer_ring_mod m)
A total of 15 subgoals...
[PROOF STEP]
let ?neg = "\<lambda>x. if x = 0 then 0 else m - x"
[PROOF STATE]
proof (state)
goal (15 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 2. \<And>x y z. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); z \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z = x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> (y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z)
 3. \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 4. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x = x
 5. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> = x
 6. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y = y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x
 7. carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))
 8. \<And>x y. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<in> carrier (lucas_lehmer_ring_mod m)
 9. \<And>x y z. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m); z \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z = x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z)
 10. \<one>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<in> carrier (lucas_lehmer_ring_mod m)
A total of 15 subgoals...
[PROOF STEP]
have "\<exists>x\<in>carrier (lucas_lehmer_ring_mod m).
           x \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (a, b) = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<and>
           (a, b) \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub>"
    if "(a, b) \<in> carrier (lucas_lehmer_ring_mod m)" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>carrier (lucas_lehmer_ring_mod m). x \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (a, b) = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<and> (a, b) \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub>
[PROOF STEP]
using that assms
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> carrier (lucas_lehmer_ring_mod m)
1 < m

goal (1 subgoal):
 1. \<exists>x\<in>carrier (lucas_lehmer_ring_mod m). x \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (a, b) = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<and> (a, b) \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub>
[PROOF STEP]
by (intro bexI[of _ "(?neg a, ?neg b)"])
       (auto simp: lucas_lehmer_ring_mod_def lucas_lehmer_add_def)
[PROOF STATE]
proof (state)
this:
(?a, ?b) \<in> carrier (lucas_lehmer_ring_mod m) \<Longrightarrow> \<exists>x\<in>carrier (lucas_lehmer_ring_mod m). x \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (?a, ?b) = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<and> (?a, ?b) \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub>

goal (15 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 2. \<And>x y z. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); z \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z = x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> (y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z)
 3. \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 4. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x = x
 5. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> = x
 6. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y = y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x
 7. carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))
 8. \<And>x y. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<in> carrier (lucas_lehmer_ring_mod m)
 9. \<And>x y z. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m); z \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z = x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z)
 10. \<one>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<in> carrier (lucas_lehmer_ring_mod m)
A total of 15 subgoals...
[PROOF STEP]
thus "carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))"
[PROOF STATE]
proof (prove)
using this:
(?a, ?b) \<in> carrier (lucas_lehmer_ring_mod m) \<Longrightarrow> \<exists>x\<in>carrier (lucas_lehmer_ring_mod m). x \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (?a, ?b) = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<and> (?a, ?b) \<oplus>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = \<zero>\<^bsub>lucas_lehmer_ring_mod m\<^esub>

goal (1 subgoal):
 1. carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))
[PROOF STEP]
by (auto simp: Units_def)
[PROOF STATE]
proof (state)
this:
carrier (add_monoid (lucas_lehmer_ring_mod m)) \<subseteq> Units (add_monoid (lucas_lehmer_ring_mod m))

goal (14 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 2. \<And>x y z. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); z \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z = x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> (y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> z)
 3. \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))
 4. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x = x
 5. \<And>x. x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)) \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> \<one>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> = x
 6. \<And>x y. \<lbrakk>x \<in> carrier (add_monoid (lucas_lehmer_ring_mod m)); y \<in> carrier (add_monoid (lucas_lehmer_ring_mod m))\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> y = y \<otimes>\<^bsub>add_monoid (lucas_lehmer_ring_mod m)\<^esub> x
 7. \<And>x y. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<in> carrier (lucas_lehmer_ring_mod m)
 8. \<And>x y z. \<lbrakk>x \<in> carrier (lucas_lehmer_ring_mod m); y \<in> carrier (lucas_lehmer_ring_mod m); z \<in> carrier (lucas_lehmer_ring_mod m)\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z = x \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> (y \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> z)
 9. \<one>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<in> carrier (lucas_lehmer_ring_mod m)
 10. \<And>x. x \<in> carrier (lucas_lehmer_ring_mod m) \<Longrightarrow> \<one>\<^bsub>lucas_lehmer_ring_mod m\<^esub> \<otimes>\<^bsub>lucas_lehmer_ring_mod m\<^esub> x = x
A total of 14 subgoals...
[PROOF STEP]
qed (insert assms,
     auto simp: lucas_lehmer_ring_mod_def algebra_simps lucas_lehmer_mult_assoc
                lucas_lehmer_add_assoc lucas_lehmer_distrib_right lucas_lehmer_distrib_left
          intro: lucas_lehmer_mult_in_carrier lucas_lehmer_add_in_carrier
                 lucas_lehmer_add_commute lucas_lehmer_mult_commute)


[STATEMENT]
lemma "((P = Q) = R) = (P = (Q = R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P = Q) = R) = (P = (Q = R))
[PROOF STEP]
by blast


[STATEMENT]
lemma compact_lemma:
  fixes f :: "nat \<Rightarrow> 'a::euclidean_space"
  assumes "bounded (range f)"
  shows "\<forall>d\<subseteq>Basis. \<exists>l::'a. \<exists> r.
    strict_mono r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>d\<subseteq>Basis. \<exists>l r. strict_mono r \<and> (\<forall>e>0. \<forall>\<^sub>F n in sequentially. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e)
[PROOF STEP]
by (rule compact_lemma_general[where unproj="\<lambda>e. \<Sum>i\<in>Basis. e i *\<^sub>R i"])
     (auto intro!: assms bounded_linear_inner_left bounded_linear_image
       simp: euclidean_representation)


[STATEMENT]
lemma tendsto_cadd_ereal[tendsto_intros, simp, intro]:
  assumes c: "y \<noteq> - \<infinity>" "x \<noteq> - \<infinity>" and f: "(f \<longlongrightarrow> x) F" shows "((\<lambda>x. f x + y::ereal) \<longlongrightarrow> x + y) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x + y) \<longlongrightarrow> x + y) F
[PROOF STEP]
apply (intro tendsto_compose[OF _ f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. a + y) \<midarrow>x\<rightarrow> x + y
[PROOF STEP]
apply (auto intro!: order_tendstoI simp: eventually_at_topological)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. a < x + y \<Longrightarrow> \<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> x \<longrightarrow> a < xa + y)
 2. \<And>a. x + y < a \<Longrightarrow> \<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> x \<longrightarrow> xa + y < a)
[PROOF STEP]
apply (rule_tac x="{a - y <..}" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. a < x + y \<Longrightarrow> open {a - y<..} \<and> x \<in> {a - y<..} \<and> (\<forall>xa\<in>{a - y<..}. xa \<noteq> x \<longrightarrow> a < xa + y)
 2. \<And>a. x + y < a \<Longrightarrow> \<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> x \<longrightarrow> xa + y < a)
[PROOF STEP]
apply (auto split: ereal.split simp: ereal_minus_less_iff c) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. x + y < a \<Longrightarrow> \<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> x \<longrightarrow> xa + y < a)
[PROOF STEP]
apply (rule_tac x="{..< a - y}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. x + y < a \<Longrightarrow> open {..<a - y} \<and> x \<in> {..<a - y} \<and> (\<forall>xa\<in>{..<a - y}. xa \<noteq> x \<longrightarrow> xa + y < a)
[PROOF STEP]
apply (auto split: ereal.split simp: ereal_less_minus_iff c) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma well_related_singleton_refl:
  assumes "x \<sqsubseteq> x" shows "well_related_set {x} (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_related_set {x} (\<sqsubseteq>)
[PROOF STEP]
by (intro well_related_set.intro exI[of _ x], auto simp: subset_singleton_iff assms)


[STATEMENT]
lemma EM_remainder_converges_cnj_iff:
  assumes "continuous_on {of_int a..} f"
  shows   "EM_remainder_converges n (\<lambda>x. cnj (f x)) a \<longleftrightarrow> EM_remainder_converges n f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. cnj (f x)) a = EM_remainder_converges n f a
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. EM_remainder_converges n (\<lambda>x. cnj (f x)) a \<Longrightarrow> EM_remainder_converges n f a
 2. EM_remainder_converges n f a \<Longrightarrow> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
assume "EM_remainder_converges n (\<lambda>x. cnj (f x)) a"
[PROOF STATE]
proof (state)
this:
EM_remainder_converges n (\<lambda>x. cnj (f x)) a

goal (2 subgoals):
 1. EM_remainder_converges n (\<lambda>x. cnj (f x)) a \<Longrightarrow> EM_remainder_converges n f a
 2. EM_remainder_converges n f a \<Longrightarrow> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
hence "EM_remainder_converges n (\<lambda>x. cnj (cnj (f x))) a"
[PROOF STATE]
proof (prove)
using this:
EM_remainder_converges n (\<lambda>x. cnj (f x)) a

goal (1 subgoal):
 1. EM_remainder_converges n (\<lambda>x. cnj (cnj (f x))) a
[PROOF STEP]
by (rule EM_remainder_converges_cnj [rotated]) (auto intro: continuous_intros assms)
[PROOF STATE]
proof (state)
this:
EM_remainder_converges n (\<lambda>x. cnj (cnj (f x))) a

goal (2 subgoals):
 1. EM_remainder_converges n (\<lambda>x. cnj (f x)) a \<Longrightarrow> EM_remainder_converges n f a
 2. EM_remainder_converges n f a \<Longrightarrow> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
thus "EM_remainder_converges n f a"
[PROOF STATE]
proof (prove)
using this:
EM_remainder_converges n (\<lambda>x. cnj (cnj (f x))) a

goal (1 subgoal):
 1. EM_remainder_converges n f a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
EM_remainder_converges n f a

goal (1 subgoal):
 1. EM_remainder_converges n f a \<Longrightarrow> EM_remainder_converges n (\<lambda>x. cnj (f x)) a
[PROOF STEP]
qed (intro EM_remainder_converges_cnj assms)


[STATEMENT]
lemma foldseq_distr_unary:
  assumes "!! a b. g (f a b) = f (g a) (g b)"
  shows "g(foldseq f s n) = foldseq f (% x. g(s x)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
have "\<forall>s. g(foldseq f s n) = foldseq f (% x. g(s x)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>s. g (foldseq f s 0) = foldseq f (\<lambda>x. g (s x)) 0
 2. \<And>n. \<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n \<Longrightarrow> \<forall>s. g (foldseq f s (Suc n)) = foldseq f (\<lambda>x. g (s x)) (Suc n)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n \<Longrightarrow> \<forall>s. g (foldseq f s (Suc n)) = foldseq f (\<lambda>x. g (s x)) (Suc n)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n \<Longrightarrow> \<forall>s. g (f (s 0) (foldseq f (\<lambda>k. s (Suc k)) n)) = f (g (s 0)) (foldseq f (\<lambda>k. g (s (Suc k))) n)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n s. \<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n \<Longrightarrow> g (f (s 0) (foldseq f (\<lambda>k. s (Suc k)) n)) = f (g (s 0)) (foldseq f (\<lambda>k. g (s (Suc k))) n)
[PROOF STEP]
apply (drule_tac x="% k. s (Suc k)" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n s. g (foldseq f (\<lambda>a. s (Suc a)) n) = foldseq f (\<lambda>x. g (s (Suc x))) n \<Longrightarrow> g (f (s 0) (foldseq f (\<lambda>k. s (Suc k)) n)) = f (g (s 0)) (foldseq f (\<lambda>k. g (s (Suc k))) n)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
\<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n

goal (1 subgoal):
 1. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>s. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n

goal (1 subgoal):
 1. g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g (foldseq f s n) = foldseq f (\<lambda>x. g (s x)) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dotprod_gt0:
  assumes "length x = length y" and "\<exists>i<length y. x ! i > 0 \<and> y ! i > 0"
  shows "x \<bullet> y > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<bullet> y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length x = length y
\<exists>i<length y. 0 < x ! i \<and> 0 < y ! i

goal (1 subgoal):
 1. 0 < x \<bullet> y
[PROOF STEP]
by (induct x y rule: list_induct2) (fastforce simp: nth_Cons split: nat.splits)+


[STATEMENT]
lemma continuous_map_const [simp]:
   "continuous_map X Y (\<lambda>x. C) \<longleftrightarrow> topspace X = {} \<or> C \<in> topspace Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
proof (cases "topspace X = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
 2. topspace X \<noteq> {} \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace X \<noteq> {}

goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
 2. topspace X \<noteq> {} \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
proof (cases "C \<in> topspace Y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. C \<in> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
 2. C \<notin> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
C \<in> topspace Y

goal (2 subgoals):
 1. C \<in> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
 2. C \<notin> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
with openin_subopen
[PROOF STATE]
proof (chain)
picking this:
openin ?U ?S = (\<forall>x\<in>?S. \<exists>T. openin ?U T \<and> x \<in> T \<and> T \<subseteq> ?S)
C \<in> topspace Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
openin ?U ?S = (\<forall>x\<in>?S. \<exists>T. openin ?U T \<and> x \<in> T \<and> T \<subseteq> ?S)
C \<in> topspace Y

goal (1 subgoal):
 1. continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
by (auto simp: continuous_map_def)
[PROOF STATE]
proof (state)
this:
continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)

goal (1 subgoal):
 1. C \<notin> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. C \<notin> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
C \<notin> topspace Y

goal (1 subgoal):
 1. C \<notin> topspace Y \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<notin> topspace Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C \<notin> topspace Y

goal (1 subgoal):
 1. continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
unfolding continuous_map_def
[PROOF STATE]
proof (prove)
using this:
C \<notin> topspace Y

goal (1 subgoal):
 1. ((\<forall>x\<in>topspace X. C \<in> topspace Y) \<and> (\<forall>U. openin Y U \<longrightarrow> openin X {x \<in> topspace X. C \<in> U})) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)

goal (1 subgoal):
 1. topspace X = {} \<Longrightarrow> continuous_map X Y (\<lambda>x. C) = (topspace X = {} \<or> C \<in> topspace Y)
[PROOF STEP]
qed (auto simp: continuous_map_on_empty)


[STATEMENT]
lemma graph_domD: "x \<in> graph m \<Longrightarrow> fst x \<in> dom m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> graph m \<Longrightarrow> fst x \<in> dom m
[PROOF STEP]
using fst_graph_eq_dom
[PROOF STATE]
proof (prove)
using this:
fst ` graph ?m = dom ?m

goal (1 subgoal):
 1. x \<in> graph m \<Longrightarrow> fst x \<in> dom m
[PROOF STEP]
by (metis imageI)


[STATEMENT]
lemma sumset_translate_eq_left:
  assumes "A \<subseteq> G" and "B \<subseteq> G" and "x \<in> G"
  shows " (sumset {x} A = sumset {x} B) \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sumset {x} A = sumset {x} B) = (A = B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G
B \<subseteq> G
x \<in> G

goal (1 subgoal):
 1. (sumset {x} A = sumset {x} B) = (A = B)
[PROOF STEP]
by (simp add: sumset_commute sumset_translate_eq_right)


[STATEMENT]
lemma oalist_inv_rawD2:
  assumes "oalist_inv_raw xs"
  shows "sorted_wrt lt (map fst xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt lt (map fst xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
oalist_inv_raw xs

goal (1 subgoal):
 1. sorted_wrt lt (map fst xs)
[PROOF STEP]
unfolding oalist_inv_raw_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
using this:
(0::'b) \<notin> snd ` set xs \<and> sorted_wrt lt (map fst xs)

goal (1 subgoal):
 1. sorted_wrt lt (map fst xs)
[PROOF STEP]
by blast


[STATEMENT]
lemma rat_roots2: assumes "degree p = 2"
  shows "{x. poly p x = 0} = set (rat_roots2 p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
from degree2_coeffs[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a b c. p = [:c, b, a:] \<and> a \<noteq> 0
[PROOF STEP]
obtain a b c
  where p: "p = [:c, b, a:]" and a: "a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>a b c. p = [:c, b, a:] \<and> a \<noteq> 0

goal (1 subgoal):
 1. (\<And>c b a. \<lbrakk>p = [:c, b, a:]; a \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = [:c, b, a:]
a \<noteq> 0

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
note main = roots2[OF p a]
[PROOF STATE]
proof (state)
this:
{x. poly p x = 0} = {- (b / (2 * a)) + e |e. e\<^sup>2 = (b / (2 * a))\<^sup>2 - c / a}

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
have 2: "2 = Suc (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 = Suc (Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 = Suc (Suc 0)

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
have coeff: "coeff p 2 = a" "coeff p 1 = b" "coeff p 0 = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff p 2 = a &&& coeff p 1 = b &&& coeff p 0 = c
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff [:c, b, a:] 2 = a &&& coeff [:c, b, a:] 1 = b &&& coeff [:c, b, a:] 0 = c
[PROOF STEP]
by (auto simp: 2)
[PROOF STATE]
proof (state)
this:
coeff p 2 = a
coeff p 1 = b
coeff p 0 = c

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
let ?b2a = "b / (2 * a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
define b2a where "b2a = ?b2a"
[PROOF STATE]
proof (state)
this:
b2a = b / (2 * a)

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
let ?bac = "b2a^2 - c/a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
define bac where "bac = ?bac"
[PROOF STATE]
proof (state)
this:
bac = b2a\<^sup>2 - c / a

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
have roots: "(rat_roots2 p) = (map (\<lambda> e. -b2a + e) (sqrt_rat bac))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_roots2 p = map ((+) (- b2a)) (sqrt_rat bac)
[PROOF STEP]
unfolding rat_roots2_def Let_def coeff b2a_def[symmetric] bac_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((+) (- b2a)) (sqrt_rat bac) = map ((+) (- b2a)) (sqrt_rat bac)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_roots2 p = map ((+) (- b2a)) (sqrt_rat bac)

goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = 0} = set (rat_roots2 p)
[PROOF STEP]
unfolding roots main b2a_def[symmetric] bac_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {- b2a + e |e. e\<^sup>2 = bac} = set (map ((+) (- b2a)) (sqrt_rat bac))
[PROOF STEP]
by (auto simp: power2_eq_square)
[PROOF STATE]
proof (state)
this:
{x. poly p x = 0} = set (rat_roots2 p)

goal:
No subgoals!
[PROOF STEP]
qed