[STATEMENT]
lemma inverse_aformE:
  fixes X::"real aform"
  assumes e: "e \<in> UNIV \<rightarrow> {-1 .. 1}"
    and disj: "Inf_aform' p X > 0 \<or> Sup_aform' p X < 0"
  obtains Y where
    "inverse_aform p X = Some Y"
    "inverse (aform_val e X) \<in> aform_err e Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
assume neg: "Sup_aform' p X < 0"
[PROOF STATE]
proof (state)
this:
Sup_aform' p X < 0

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from neg
[PROOF STATE]
proof (chain)
picking this:
Sup_aform' p X < 0
[PROOF STEP]
have [simp]: "Inf_aform' p X \<le> 0"
[PROOF STATE]
proof (prove)
using this:
Sup_aform' p X < 0

goal (1 subgoal):
 1. Inf_aform' p X \<le> 0
[PROOF STEP]
by (metis Inf_aform'_le_Sup_aform' dual_order.strict_trans1 less_asym not_less)
[PROOF STATE]
proof (state)
this:
Inf_aform' p X \<le> 0

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from neg disj
[PROOF STATE]
proof (chain)
picking this:
Sup_aform' p X < 0
0 < Inf_aform' p X \<or> Sup_aform' p X < 0
[PROOF STEP]
have "0 < Inf_aform' p (uminus_aform X)"
[PROOF STATE]
proof (prove)
using this:
Sup_aform' p X < 0
0 < Inf_aform' p X \<or> Sup_aform' p X < 0

goal (1 subgoal):
 1. 0 < Inf_aform' p (uminus_aform X)
[PROOF STEP]
by (auto simp: Inf_aform'_def Sup_aform'_def eucl_truncate_up_eq_eucl_truncate_down ac_simps)
[PROOF STATE]
proof (state)
this:
0 < Inf_aform' p (uminus_aform X)

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from inverse_aform'E[OF e(1) this]
[PROOF STATE]
proof (chain)
picking this:
?x = aform_val e (uminus_aform X) \<Longrightarrow> inverse ?x \<in> aform_err e (inverse_aform' p (uminus_aform X))
[PROOF STEP]
have iin: "inverse (aform_val e (uminus_aform X)) \<in> aform_err e (inverse_aform' p (uminus_aform X))"
[PROOF STATE]
proof (prove)
using this:
?x = aform_val e (uminus_aform X) \<Longrightarrow> inverse ?x \<in> aform_err e (inverse_aform' p (uminus_aform X))

goal (1 subgoal):
 1. inverse (aform_val e (uminus_aform X)) \<in> aform_err e (inverse_aform' p (uminus_aform X))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (aform_val e (uminus_aform X)) \<in> aform_err e (inverse_aform' p (uminus_aform X))

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
let ?Y = "apfst uminus_aform (inverse_aform' p (uminus_aform X))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "inverse_aform p X = Some ?Y"
      "inverse (aform_val e X) \<in> aform_err e ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_aform p X = Some (apfst uminus_aform (inverse_aform' p (uminus_aform X))) &&& inverse (aform_val e X) \<in> aform_err e (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
[PROOF STEP]
using neg iin
[PROOF STATE]
proof (prove)
using this:
Sup_aform' p X < 0
inverse (aform_val e (uminus_aform X)) \<in> aform_err e (inverse_aform' p (uminus_aform X))

goal (1 subgoal):
 1. inverse_aform p X = Some (apfst uminus_aform (inverse_aform' p (uminus_aform X))) &&& inverse (aform_val e X) \<in> aform_err e (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
[PROOF STEP]
by (auto simp: inverse_aform_def aform_err_def)
[PROOF STATE]
proof (state)
this:
inverse_aform p X = Some (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
inverse (aform_val e X) \<in> aform_err e (apfst uminus_aform (inverse_aform' p (uminus_aform X)))

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverse_aform p X = Some (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
inverse (aform_val e X) \<in> aform_err e (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse_aform p X = Some (apfst uminus_aform (inverse_aform' p (uminus_aform X)))
inverse (aform_val e X) \<in> aform_err e (apfst uminus_aform (inverse_aform' p (uminus_aform X)))

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

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Sup_aform' p X < 0 \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Sup_aform' p X < 0 \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
Sup_aform' p X < 0 \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
assume pos: "Inf_aform' p X > 0"
[PROOF STATE]
proof (state)
this:
0 < Inf_aform' p X

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from pos
[PROOF STATE]
proof (chain)
picking this:
0 < Inf_aform' p X
[PROOF STEP]
have eq: "inverse_aform p X = Some (inverse_aform' p X)"
[PROOF STATE]
proof (prove)
using this:
0 < Inf_aform' p X

goal (1 subgoal):
 1. inverse_aform p X = Some (inverse_aform' p X)
[PROOF STEP]
by (auto simp: inverse_aform_def)
[PROOF STATE]
proof (state)
this:
inverse_aform p X = Some (inverse_aform' p X)

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inverse_aform p X = Some (inverse_aform' p X)

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from inverse_aform'E[OF e(1) pos refl]
[PROOF STATE]
proof (chain)
picking this:
inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)
[PROOF STEP]
have "inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)"
[PROOF STATE]
proof (prove)
using this:
inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)

goal (1 subgoal):
 1. inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inverse_aform p X = Some (inverse_aform' p X)
inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse_aform p X = Some (inverse_aform' p X)
inverse (aform_val e X) \<in> aform_err e (inverse_aform' p X)

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

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < Inf_aform' p X \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>inverse_aform p X = Some Y; inverse (aform_val e X) \<in> aform_err e Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Sup_aform' p X < 0 \<Longrightarrow> thesis
0 < Inf_aform' p X \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup_aform' p X < 0 \<Longrightarrow> thesis
0 < Inf_aform' p X \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Sup_aform' p X < 0 \<Longrightarrow> thesis
0 < Inf_aform' p X \<Longrightarrow> thesis
e \<in> UNIV \<rightarrow> {- 1..1}
0 < Inf_aform' p X \<or> Sup_aform' p X < 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complete_treeD_node21:
  "\<lbrakk>complete r; complete (treeD l'); height r = hD l' \<rbrakk> \<Longrightarrow> complete (treeD (node21 l' a r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complete r; complete (treeD l'); height r = hD l'\<rbrakk> \<Longrightarrow> complete (treeD (node21 l' a r))
[PROOF STEP]
by(induct l' a r rule: node21.induct) auto


[STATEMENT]
lemma list_before_irrefl_eq_distinct: "irrefl (list_before_rel l) \<longleftrightarrow> distinct l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irrefl (list_before_rel l) = distinct l
[PROOF STEP]
using not_distinct_decomp[of l]
[PROOF STATE]
proof (prove)
using this:
\<not> distinct l \<Longrightarrow> \<exists>xs ys zs y. l = xs @ [y] @ ys @ [y] @ zs

goal (1 subgoal):
 1. irrefl (list_before_rel l) = distinct l
[PROOF STEP]
by (auto simp: irrefl_def list_before_rel_def)


[STATEMENT]
lemma lnth_lmap_ldropn_Suc:
  "enat (Suc n) < llength xs \<Longrightarrow> lnth (lmap f (ldropn n xs)) (Suc 0) = lnth (lmap f xs) (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enat (Suc n) < llength xs \<Longrightarrow> lnth (lmap f (ldropn n xs)) (Suc 0) = lnth (lmap f xs) (Suc n)
[PROOF STEP]
by (metis (no_types, lifting) Suc_llength ldropn_ltl leD llist.map_disc_iff lnth_lmap_ldropn
                                lnth_ltl lnull_ldropn ltl_ldropn ltl_lmap)


[STATEMENT]
theorem locked_in_different:
assumes
  "s \<in> Vinv2"
  "locked_in s r1 v"
  "locked_in s r2 w"
  "r1 < r2"
shows
  "v = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
proof-
  \<comment> \<open>To be locked, @{term v} and @{term w} must each have received votes from a quorum.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v = w
[PROOF STEP]
from assms(2-3)
[PROOF STATE]
proof (chain)
picking this:
locked_in s r1 v
locked_in s r2 w
[PROOF STEP]
obtain Q1 Q2
  where Q12: "Q1 \<in> Quorum" "Q2 \<in> Quorum" "quorum_for Q1 v (votes s r1)" "quorum_for Q2 w (votes s r2)"
[PROOF STATE]
proof (prove)
using this:
locked_in s r1 v
locked_in s r2 w

goal (1 subgoal):
 1. (\<And>Q1 Q2. \<lbrakk>Q1 \<in> Quorum; Q2 \<in> Quorum; quorum_for Q1 v (votes s r1); quorum_for Q2 w (votes s r2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp add: locked_in_def locked_in_vf_def quorum_for_def)
  \<comment> \<open>By the quorum intersection property, some process from @{term Q1} voted for @{term w}:\<close>
[PROOF STATE]
proof (state)
this:
Q1 \<in> Quorum
Q2 \<in> Quorum
quorum_for Q1 v (votes s r1)
quorum_for Q2 w (votes s r2)

goal (1 subgoal):
 1. v = w
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q1 \<in> Quorum
Q2 \<in> Quorum
quorum_for Q1 v (votes s r1)
quorum_for Q2 w (votes s r2)
[PROOF STEP]
obtain a where "a \<in> Q1" "votes s r2 a = Some w"
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> Quorum
Q2 \<in> Quorum
quorum_for Q1 v (votes s r1)
quorum_for Q2 w (votes s r2)

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> Q1; votes s r2 a = Some w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using qintersect[OF \<open>Q1 \<in> Quorum\<close> \<open>Q2 \<in> Quorum\<close>]
[PROOF STATE]
proof (prove)
using this:
Q1 \<in> Quorum
Q2 \<in> Quorum
quorum_for Q1 v (votes s r1)
quorum_for Q2 w (votes s r2)
Q1 \<inter> Q2 \<noteq> {}

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> Q1; votes s r2 a = Some w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp add: quorum_for_def)
  \<comment> \<open>But from @{term Vinv2} we conclude that @{term a} could not have defected by voting
        @{term w}, so @{term ?thesis}:\<close>
[PROOF STATE]
proof (state)
this:
a \<in> Q1
votes s r2 a = Some w

goal (1 subgoal):
 1. v = w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> Q1
votes s r2 a = Some w

goal (1 subgoal):
 1. v = w
[PROOF STEP]
using \<open>s \<in> Vinv2\<close> \<open>quorum_for Q1 v (votes s r1)\<close> \<open>r1 < r2\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> Q1
votes s r2 a = Some w
s \<in> Vinv2
quorum_for Q1 v (votes s r1)
r1 < r2

goal (1 subgoal):
 1. v = w
[PROOF STEP]
by(fastforce simp add: Vinv2_def no_defection_def quorum_for_def')
[PROOF STATE]
proof (state)
this:
v = w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fpxs_val_add_ge:
  assumes "f + g \<noteq> 0"
  shows   "fpxs_val (f + g) \<ge> min (fpxs_val f) (fpxs_val g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>(fpxs_val (f + g) \<ge> min (fpxs_val f) (fpxs_val g))" (is "\<not>(?n \<ge> _)")
[PROOF STATE]
proof (state)
this:
\<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g)

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
hence "?n < fpxs_val f" "?n < fpxs_val g"
[PROOF STATE]
proof (prove)
using this:
\<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g)

goal (1 subgoal):
 1. fpxs_val (f + g) < fpxs_val f &&& fpxs_val (f + g) < fpxs_val g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fpxs_val (f + g) < fpxs_val f
fpxs_val (f + g) < fpxs_val g

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
hence "fpxs_nth f ?n = 0" "fpxs_nth g ?n = 0"
[PROOF STATE]
proof (prove)
using this:
fpxs_val (f + g) < fpxs_val f
fpxs_val (f + g) < fpxs_val g

goal (1 subgoal):
 1. fpxs_nth f (fpxs_val (f + g)) = (0::'a) &&& fpxs_nth g (fpxs_val (f + g)) = (0::'a)
[PROOF STEP]
by (intro fpxs_nth_below_val; simp; fail)+
[PROOF STATE]
proof (state)
this:
fpxs_nth f (fpxs_val (f + g)) = (0::'a)
fpxs_nth g (fpxs_val (f + g)) = (0::'a)

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
hence "fpxs_nth (f + g) ?n = 0"
[PROOF STATE]
proof (prove)
using this:
fpxs_nth f (fpxs_val (f + g)) = (0::'a)
fpxs_nth g (fpxs_val (f + g)) = (0::'a)

goal (1 subgoal):
 1. fpxs_nth (f + g) (fpxs_val (f + g)) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fpxs_nth (f + g) (fpxs_val (f + g)) = (0::'a)

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fpxs_nth (f + g) (fpxs_val (f + g)) = (0::'a)

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
have "fpxs_nth (f + g) ?n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_nth (f + g) (fpxs_val (f + g)) \<noteq> (0::'a)
[PROOF STEP]
by (intro fpxs_nth_val_nonzero assms)
[PROOF STATE]
proof (state)
this:
fpxs_nth (f + g) (fpxs_val (f + g)) \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> min (fpxs_val f) (fpxs_val g) \<le> fpxs_val (f + g) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fpxs_nth (f + g) (fpxs_val (f + g)) = (0::'a)
fpxs_nth (f + g) (fpxs_val (f + g)) \<noteq> (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
fpxs_nth (f + g) (fpxs_val (f + g)) = (0::'a)
fpxs_nth (f + g) (fpxs_val (f + g)) \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_bit_int_less_self_iff:
  \<open>take_bit n k < k \<longleftrightarrow> 2 ^ n \<le> k\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take_bit n k < k) = (2 ^ n \<le> k)
[PROOF STEP]
by (auto simp add: less_le take_bit_int_less_eq_self_iff take_bit_int_eq_self_iff
    intro: order_trans [of 0 \<open>2 ^ n\<close> k])


[STATEMENT]
lemma decrnum:
  assumes "numbound0 t"
  shows "Inum (x # bs) t = Inum bs (decrnum t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inum (x # bs) t = Inum bs (decrnum t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
numbound0 t

goal (1 subgoal):
 1. Inum (x # bs) t = Inum bs (decrnum t)
[PROOF STEP]
by (induct t rule: decrnum.induct) (auto simp add: gr0_conv_Suc)


[STATEMENT]
lemma key_present_imp_eq_lookup_finds_value: "k \<in> fst ` set al \<Longrightarrow> \<exists>v . lookup (\<lambda>x. x=k) al = Some v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<in> fst ` set al \<Longrightarrow> \<exists>v. lookup (\<lambda>x. x = k) al = Some v
[PROOF STEP]
by (induction al) (auto simp add: rev_image_eqI)


[STATEMENT]
lemma ring_hom_one:
  fixes R (structure) and S (structure)
  shows "h \<in> ring_hom R S \<Longrightarrow> h \<one> = \<one>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<in> ring_hom R S \<Longrightarrow> h \<one> = \<one>\<^bsub>S\<^esub>
[PROOF STEP]
by (simp add: ring_hom_def)


[STATEMENT]
lemma sqmatrix_add_0_right [simp]:
  "A + 0 = (A::('a::monoid_add,'m) sqmatrix)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A + 0 = A
[PROOF STEP]
by (cases A, simp add: zero_sqmatrix_def)


[STATEMENT]
lemma less_RealD:
  assumes "cauchy Y"
  shows "x < Real Y \<Longrightarrow> \<exists>n. x < of_rat (Y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < Real Y \<Longrightarrow> \<exists>n. x < of_rat (Y n)
[PROOF STEP]
apply (erule contrapos_pp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>n. x < of_rat (Y n) \<Longrightarrow> \<not> x < Real Y
[PROOF STEP]
apply (simp add: not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. of_rat (Y n) \<le> x \<Longrightarrow> Real Y \<le> x
[PROOF STEP]
apply (erule Real_leI [OF assms])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma monoI2: "\<forall>m. \<forall>n \<ge> m. X n \<le> X m \<Longrightarrow> monoseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m n. m \<le> n \<longrightarrow> X n \<le> X m \<Longrightarrow> monoseq X
[PROOF STEP]
by (simp add: monoseq_def)


[STATEMENT]
lemma LIMSEQ_Suc: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l
[PROOF STEP]
by (drule LIMSEQ_ignore_initial_segment [where k="Suc 0"]) simp


[STATEMENT]
lemma prv_imp_monoR: "\<phi> \<in> fmla \<Longrightarrow> \<chi> \<in> fmla \<Longrightarrow> \<psi> \<in> fmla \<Longrightarrow>
prv (imp \<psi> \<chi>) \<Longrightarrow> prv (imp (imp \<chi> \<phi>) (imp \<psi> \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; \<chi> \<in> fmla; \<psi> \<in> fmla; prv (imp \<psi> \<chi>)\<rbrakk> \<Longrightarrow> prv (imp (imp \<chi> \<phi>) (imp \<psi> \<phi>))
[PROOF STEP]
by (meson imp prv_imp_mp prv_imp_trans2)


[STATEMENT]
lemma compl_compl_is_id[simp]:
  "compl (compl x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compl (compl x) = x
[PROOF STEP]
unfolding compl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- x) = x
[PROOF STEP]
by simp


[STATEMENT]
lemma empty_fset_if_fcard_le1_not_singleton: "\<lbrakk>\<forall>x. xs \<noteq> {|x|}; fcard xs \<le> 1\<rbrakk> \<Longrightarrow> xs = {||}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. xs \<noteq> {|x|}; fcard xs \<le> 1\<rbrakk> \<Longrightarrow> xs = {||}
[PROOF STEP]
using fcard0_if_le1_not_singleton
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x. ?xs \<noteq> {|x|}; fcard ?xs \<le> 1\<rbrakk> \<Longrightarrow> fcard ?xs = 0

goal (1 subgoal):
 1. \<lbrakk>\<forall>x. xs \<noteq> {|x|}; fcard xs \<le> 1\<rbrakk> \<Longrightarrow> xs = {||}
[PROOF STEP]
by auto


[STATEMENT]
lemma stranspose_nth[simp]:
    assumes "k < length ws"
    shows "smap (\<lambda> xs. xs ! k) (stranspose ws) = ws ! k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smap (\<lambda>xs. xs ! k) (stranspose ws) = ws ! k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k < length ws

goal (1 subgoal):
 1. smap (\<lambda>xs. xs ! k) (stranspose ws) = ws ! k
[PROOF STEP]
by (auto intro: eqI_snth)


[STATEMENT]
lemma poly_minus [simp]: "poly (- p) x = - poly p x"
  for x :: "'a::comm_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (- p) x = - poly p x
[PROOF STEP]
by (induct p) simp_all


[STATEMENT]
lemma derangements_add_one:
  assumes "d \<in> derangements S" "x \<notin> S" "y \<in> S"
  shows "d(x := y, inv d y := x) \<in> derangements (insert x S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d(x := y, inv d y := x) \<in> derangements (insert x S)
[PROOF STEP]
proof (rule derangementsI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. d(x := y, inv d y := x) permutes insert x S
 2. \<And>xa. xa \<in> insert x S \<Longrightarrow> (d(x := y, inv d y := x)) xa \<noteq> xa
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
d \<in> derangements S
x \<notin> S
y \<in> S
[PROOF STEP]
show "d(x := y, inv d y := x) permutes (insert x S)"
[PROOF STATE]
proof (prove)
using this:
d \<in> derangements S
x \<notin> S
y \<in> S

goal (1 subgoal):
 1. d(x := y, inv d y := x) permutes insert x S
[PROOF STEP]
by (auto intro: permutes_add_one elim: derangementsE)
[PROOF STATE]
proof (state)
this:
d(x := y, inv d y := x) permutes insert x S

goal (1 subgoal):
 1. \<And>xa. xa \<in> insert x S \<Longrightarrow> (d(x := y, inv d y := x)) xa \<noteq> xa
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> insert x S \<Longrightarrow> (d(x := y, inv d y := x)) xa \<noteq> xa
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> insert x S \<Longrightarrow> (d(x := y, inv d y := x)) xa \<noteq> xa
[PROOF STEP]
assume "z : insert x S"
[PROOF STATE]
proof (state)
this:
z \<in> insert x S

goal (1 subgoal):
 1. \<And>xa. xa \<in> insert x S \<Longrightarrow> (d(x := y, inv d y := x)) xa \<noteq> xa
[PROOF STEP]
from assms this derangements_inverse_in_image[OF assms(1), of y]
[PROOF STATE]
proof (chain)
picking this:
d \<in> derangements S
x \<notin> S
y \<in> S
z \<in> insert x S
y \<in> S \<Longrightarrow> inv d y \<in> S
[PROOF STEP]
show "(d(x := y, inv d y := x)) z \<noteq> z"
[PROOF STATE]
proof (prove)
using this:
d \<in> derangements S
x \<notin> S
y \<in> S
z \<in> insert x S
y \<in> S \<Longrightarrow> inv d y \<in> S

goal (1 subgoal):
 1. (d(x := y, inv d y := x)) z \<noteq> z
[PROOF STEP]
by (auto elim: derangementsE)
[PROOF STATE]
proof (state)
this:
(d(x := y, inv d y := x)) z \<noteq> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma find_non0':
  assumes A: "A \<in> carrier_mat m n"
  and res: "find_non0' i k A = Some j"
  shows "A $$ (j,k) \<noteq> 0" "i \<le> j" "j < dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (j, k) \<noteq> (0::'a) &&& i \<le> j &&& j < dim_row A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A $$ (j, k) \<noteq> (0::'a)
 2. i \<le> j
 3. j < dim_row A
[PROOF STEP]
let ?xs = "filter (\<lambda>j. A $$ (j,k) \<noteq> 0) [i ..< dim_row A]"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A $$ (j, k) \<noteq> (0::'a)
 2. i \<le> j
 3. j < dim_row A
[PROOF STEP]
from res[unfolded find_non0'_def Let_def]
[PROOF STATE]
proof (chain)
picking this:
(case filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] of [] \<Rightarrow> None | a # list \<Rightarrow> Some (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] ! 0)) = Some j
[PROOF STEP]
have xs: "?xs \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
(case filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] of [] \<Rightarrow> None | a # list \<Rightarrow> Some (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] ! 0)) = Some j

goal (1 subgoal):
 1. filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] \<noteq> []
[PROOF STEP]
by (cases ?xs, auto)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] \<noteq> []

goal (3 subgoals):
 1. A $$ (j, k) \<noteq> (0::'a)
 2. i \<le> j
 3. j < dim_row A
[PROOF STEP]
have j_in_xs: "j \<in> set ?xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> set (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A])
[PROOF STEP]
using res
[PROOF STATE]
proof (prove)
using this:
find_non0' i k A = Some j

goal (1 subgoal):
 1. j \<in> set (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A])
[PROOF STEP]
unfolding find_non0'_def Let_def
[PROOF STATE]
proof (prove)
using this:
(case filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] of [] \<Rightarrow> None | a # list \<Rightarrow> Some (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A] ! 0)) = Some j

goal (1 subgoal):
 1. j \<in> set (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A])
[PROOF STEP]
by (metis (no_types, lifting) length_greater_0_conv list.case(2) list.exhaust nth_mem option.simps(1) xs)
[PROOF STATE]
proof (state)
this:
j \<in> set (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A])

goal (3 subgoals):
 1. A $$ (j, k) \<noteq> (0::'a)
 2. i \<le> j
 3. j < dim_row A
[PROOF STEP]
show "A $$ (j,k) \<noteq> 0" "i \<le> j" "j < dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (j, k) \<noteq> (0::'a) &&& i \<le> j &&& j < dim_row A
[PROOF STEP]
using j_in_xs
[PROOF STATE]
proof (prove)
using this:
j \<in> set (filter (\<lambda>j. A $$ (j, k) \<noteq> (0::'a)) [i..<dim_row A])

goal (1 subgoal):
 1. A $$ (j, k) \<noteq> (0::'a) &&& i \<le> j &&& j < dim_row A
[PROOF STEP]
by auto+
[PROOF STATE]
proof (state)
this:
A $$ (j, k) \<noteq> (0::'a)
i \<le> j
j < dim_row A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aezfun_setspan_proj_add :
  "aezfun_setspan_proj A (x+y)
        = aezfun_setspan_proj A x + aezfun_setspan_proj A y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun_setspan_proj A (x + y) = aezfun_setspan_proj A x + aezfun_setspan_proj A y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aezfun_setspan_proj A (x + y) = aezfun_setspan_proj A x + aezfun_setspan_proj A y
[PROOF STEP]
have "aezfun (aezfun_setspan_proj A (x+y))
             = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A (x + y)) = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. aezfun (aezfun_setspan_proj A (x + y)) xa = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) xa
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. aezfun (aezfun_setspan_proj A (x + y)) xa = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) xa
[PROOF STEP]
show "aezfun (aezfun_setspan_proj A (x+y)) a
                     = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A (x + y)) a = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) a
[PROOF STEP]
using aezfun_setspan_projD1[of a A "x+y"] aezfun_setspan_projD2[of a A "x+y"]
            aezfun_setspan_projD1[of a A x] aezfun_setspan_projD1[of a A y]
            aezfun_setspan_projD2[of a A x] aezfun_setspan_projD2[of a A y]
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<Longrightarrow> aezfun (aezfun_setspan_proj A (x + y)) a = aezfun (x + y) a
a \<notin> A \<Longrightarrow> aezfun (aezfun_setspan_proj A (x + y)) a = (0::'a)
a \<in> A \<Longrightarrow> aezfun (aezfun_setspan_proj A x) a = aezfun x a
a \<in> A \<Longrightarrow> aezfun (aezfun_setspan_proj A y) a = aezfun y a
a \<notin> A \<Longrightarrow> aezfun (aezfun_setspan_proj A x) a = (0::'a)
a \<notin> A \<Longrightarrow> aezfun (aezfun_setspan_proj A y) a = (0::'a)

goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A (x + y)) a = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) a
[PROOF STEP]
by    (cases "a \<in> A") auto
[PROOF STATE]
proof (state)
this:
aezfun (aezfun_setspan_proj A (x + y)) a = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y) a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
aezfun (aezfun_setspan_proj A (x + y)) = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y)

goal (1 subgoal):
 1. aezfun_setspan_proj A (x + y) = aezfun_setspan_proj A x + aezfun_setspan_proj A y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
aezfun (aezfun_setspan_proj A (x + y)) = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y)

goal (1 subgoal):
 1. aezfun_setspan_proj A (x + y) = aezfun_setspan_proj A x + aezfun_setspan_proj A y
[PROOF STEP]
using aezfun_transfer
[PROOF STATE]
proof (prove)
using this:
aezfun (aezfun_setspan_proj A (x + y)) = aezfun (aezfun_setspan_proj A x + aezfun_setspan_proj A y)
aezfun ?a = aezfun ?b \<Longrightarrow> ?a = ?b

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_zero_iff'[simp]: "0 = gcd a b \<longleftrightarrow> a = 0 \<and> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) = gcd a b) = (a = (0::'a) \<and> b = (0::'a))
[PROOF STEP]
using gcd_zero_iff
[PROOF STATE]
proof (prove)
using this:
(gcd ?a ?b = (0::'a)) = (?a = (0::'a) \<and> ?b = (0::'a))

goal (1 subgoal):
 1. ((0::'a) = gcd a b) = (a = (0::'a) \<and> b = (0::'a))
[PROOF STEP]
by metis


[STATEMENT]
lemma mset_size_le1_cases[case_names empty singleton,consumes 1]: "\<lbrakk> size M \<le> Suc 0; M={#} \<Longrightarrow> P; !!m. M={#m#} \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>size M \<le> Suc 0; M = {#} \<Longrightarrow> P; \<And>m. M = {#m#} \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (cases M) auto


[STATEMENT]
lemma closed_Collect_disj:
  assumes "closed {x. P x}" "closed {x. Q x}"
  shows "closed {x. P x \<or> Q x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. P x \<or> Q x}
[PROOF STEP]
using closed_Un[OF assms]
[PROOF STATE]
proof (prove)
using this:
closed ({x. P x} \<union> {x. Q x})

goal (1 subgoal):
 1. closed {x. P x \<or> Q x}
[PROOF STEP]
by (simp add: Un_def)


[STATEMENT]
lemma open_Collect_conj:
  assumes "open {x. P x}" "open {x. Q x}"
  shows "open {x. P x \<and> Q x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {x. P x \<and> Q x}
[PROOF STEP]
using open_Int[OF assms]
[PROOF STATE]
proof (prove)
using this:
open ({x. P x} \<inter> {x. Q x})

goal (1 subgoal):
 1. open {x. P x \<and> Q x}
[PROOF STEP]
by (simp add: Int_def)


[STATEMENT]
lemma total_pseudo_ordered_subset: "B \<subseteq> A \<Longrightarrow> total_pseudo_ordered_set B (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> A \<Longrightarrow> total_pseudo_ordered_set B (\<sqsubseteq>)
[PROOF STEP]
apply (intro_locales)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> A \<Longrightarrow> connex B (\<sqsubseteq>)
 2. B \<subseteq> A \<Longrightarrow> antisymmetric B (\<sqsubseteq>)
[PROOF STEP]
using antisymmetric_subset connex_subset
[PROOF STATE]
proof (prove)
using this:
?B \<subseteq> A \<Longrightarrow> antisymmetric ?B (\<sqsubseteq>)
?B \<subseteq> A \<Longrightarrow> connex ?B (\<sqsubseteq>)

goal (2 subgoals):
 1. B \<subseteq> A \<Longrightarrow> connex B (\<sqsubseteq>)
 2. B \<subseteq> A \<Longrightarrow> antisymmetric B (\<sqsubseteq>)
[PROOF STEP]
by auto


[STATEMENT]
lemma csupport_on_mono: "csupport_on carrier f \<subseteq> csupport_on carrier g"
  if "\<And>x. x \<in> carrier \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> g x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csupport_on carrier f \<subseteq> csupport_on carrier g
[PROOF STEP]
unfolding csupport_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (support_on carrier f) \<subseteq> closure (support_on carrier g)
[PROOF STEP]
apply (rule closure_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. support_on carrier f \<subseteq> support_on carrier g
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier; f ?x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> g ?x \<noteq> (0::'c)

goal (1 subgoal):
 1. support_on carrier f \<subseteq> support_on carrier g
[PROOF STEP]
by (rule support_on_mono)


[STATEMENT]
lemma foldr_split_conv_map_fst: "foldr (\<lambda>(x, y). f x) xs = foldr f (map fst xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>(x, y). f x) xs = foldr f (map fst xs)
[PROOF STEP]
by(simp add: foldr_map o_def split_def fun_eq_iff)


[STATEMENT]
lemma reads_inside_set_subset: "reads_inside_set f a \<Longrightarrow> a \<subseteq> b \<Longrightarrow> reads_inside_set f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>reads_inside_set f a; a \<subseteq> b\<rbrakk> \<Longrightarrow> reads_inside_set f b
[PROOF STEP]
unfolding reads_inside_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>assmt1 assmt2. (\<forall>p. p \<in> a \<longrightarrow> assmt1 p = assmt2 p) \<longrightarrow> f assmt1 = f assmt2; a \<subseteq> b\<rbrakk> \<Longrightarrow> \<forall>assmt1 assmt2. (\<forall>p. p \<in> b \<longrightarrow> assmt1 p = assmt2 p) \<longrightarrow> f assmt1 = f assmt2
[PROOF STEP]
by blast


[STATEMENT]
lemma Imsm_calc:
  "$(I^{m}s)^{m}_n = ((1+i).^(n+1/m) - (n*m+1)*(1+i).^(1/m) + n*m) / (m*((1+i).^(1/m)-1))^2"
  if "i \<noteq> 0" "m \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "$(I^{m}a)^{m}_n =
    ($v^n * ((1+i).^(n+1/m) - (n*m+1)*(1+i).^(1/m) + n*m)) / (m*((1+i).^(1/m)-1))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "$(I^{m}a)^{m}_n =
      ($v.^(1/m) * (1 - (n*m+1)*$v^n + n*m*$v.^(n+1/m))) / (m*(1-$v.^(1/m)))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 0
m \<noteq> 0

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2
[PROOF STEP]
by (subst Imam_calc; simp)
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "\<dots> = (1 - (n*m+1)*$v^n + n*m*$v.^(n+1/m)) / ($v.^(1/m)*(m*($v.^(-1/m)-1))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2 = (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)
[PROOF STEP]
apply (subgoal_tac "$v.^(-1/m) = 1 / $v.^(1/m)", erule ssubst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. $v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2 = (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * (1 / $v .^ (1 / real m) - 1))\<^sup>2)
 2. $v .^ (- 1 / real m) = 1 / $v .^ (1 / real m)
[PROOF STEP]
apply ((subst power2_eq_square)+, simp add: field_simps that)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v .^ (- 1 / real m) = 1 / $v .^ (1 / real m)
[PROOF STEP]
by (simp add: powr_minus_divide)
[PROOF STATE]
proof (state)
this:
$v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2 = (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
$v .^ (1 / real m) * (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / (real m * (1 - $v .^ (1 / real m)))\<^sup>2 = (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "\<dots> =
      ($v.^(n+1/m) * ($v.^(-n-1/m) - (n*m+1)*$v.^(-1/m) + n*m)) / ($v.^(1/m)*(m*($v.^(-1/m)-1))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)
[PROOF STEP]
apply (subgoal_tac "$v.^(-n-1/m) = 1 / $v.^(n+1/m)" "$v.^(-1/m) = $v^n / $v.^(n+1/m)")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>$v .^ (real_of_int (- int n) - 1 / real m) = 1 / $v .^ (real n + 1 / real m); $v .^ (- 1 / real m) = $v ^ n / $v .^ (real n + 1 / real m)\<rbrakk> \<Longrightarrow> (1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)
 2. $v .^ (real_of_int (- int n) - 1 / real m) = 1 / $v .^ (real n + 1 / real m) \<Longrightarrow> $v .^ (- 1 / real m) = $v ^ n / $v .^ (real n + 1 / real m)
 3. $v .^ (real_of_int (- int n) - 1 / real m) = 1 / $v .^ (real n + 1 / real m)
[PROOF STEP]
apply ((erule ssubst)+, simp_all add: field_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. $v .^ (- real n - 1 / real m) = 1 / $v .^ (real n + 1 / real m) \<Longrightarrow> $v .^ - (1 / real m) = $v ^ n / $v .^ (real n + 1 / real m)
 2. $v .^ (- real n - 1 / real m) = 1 / $v .^ (real n + 1 / real m)
[PROOF STEP]
using v_pos
[PROOF STATE]
proof (prove)
using this:
0 < $v

goal (2 subgoals):
 1. $v .^ (- real n - 1 / real m) = 1 / $v .^ (real n + 1 / real m) \<Longrightarrow> $v .^ - (1 / real m) = $v ^ n / $v .^ (real n + 1 / real m)
 2. $v .^ (- real n - 1 / real m) = 1 / $v .^ (real n + 1 / real m)
[PROOF STEP]
apply (simp add: powr_diff[THEN sym] powr_realpow[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v .^ (- real n - 1 / real m) = 1 / $v .^ (real n + 1 / real m)
[PROOF STEP]
by (smt powr_minus_divide)
[PROOF STATE]
proof (state)
this:
(1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - real (n * m + 1) * $v ^ n + real (n * m) * $v .^ (real n + 1 / real m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2)

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "\<dots> =
      ($v^n * ($v.^(-n-1/m) - (n*m+1)*$v.^(-1/m) + n*m)) / ((m*($v.^(-1/m)-1))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2
[PROOF STEP]
apply (subst powr_add[of _ n "1/m"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v .^ real n * $v .^ (1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2
[PROOF STEP]
using v_pos powr_realpow
[PROOF STATE]
proof (prove)
using this:
0 < $v
0 < ?x \<Longrightarrow> ?x .^ real ?n = ?x ^ ?n

goal (1 subgoal):
 1. $v .^ real n * $v .^ (1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
$v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
$v .^ (real n + 1 / real m) * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / ($v .^ (1 / real m) * (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2) = $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
have "\<dots> =
      ($v^n * ((1+i).^(n+1/m) - (n*m+1)*(1+i).^(1/m) + n*m)) / ((m*((1+i).^(1/m)-1))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2 = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
apply (subgoal_tac "-n-1/m = -(n+1/m)" "-1/m = -(1/m)", (erule ssubst)+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. $v ^ n * ($v .^ - (real n + 1 / real m) - real (n * m + 1) * $v .^ - (1 / real m) + real (n * m)) / (real m * ($v .^ - (1 / real m) - 1))\<^sup>2 = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
 2. real_of_int (- int n) - 1 / real m = - (real n + 1 / real m) \<Longrightarrow> - 1 / real m = - (1 / real m)
 3. real_of_int (- int n) - 1 / real m = - (real n + 1 / real m)
[PROOF STEP]
apply (subst i_v_powr[THEN sym])+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2 = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
 2. real_of_int (- int n) - 1 / real m = - (real n + 1 / real m) \<Longrightarrow> - 1 / real m = - (1 / real m)
 3. real_of_int (- int n) - 1 / real m = - (real n + 1 / real m)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
$v ^ n * ($v .^ (real_of_int (- int n) - 1 / real m) - real (n * m + 1) * $v .^ (- 1 / real m) + real (n * m)) / (real m * ($v .^ (- 1 / real m) - 1))\<^sup>2 = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2 \<Longrightarrow> $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
using that v_futr_pos
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 0
m \<noteq> 0
0 < 1 + i

goal (1 subgoal):
 1. $(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2 \<Longrightarrow> $(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
apply (subst Ilsm_Ilam, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>$(I^{m}a)^{m}_n = $v ^ n * ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2; i \<noteq> 0; m \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) ^ n * $(I^{m}a)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2
[PROOF STEP]
apply (erule ssubst, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<noteq> 0; 0 < m; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) .^ (real n + 1 / real m) - (1 + real n * real m) * (1 + i) .^ (1 / real m) + real n * real m = 0 \<or> (1 + i) ^ n * $v ^ n = 1
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<noteq> 0; 0 < m; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) ^ n * $v ^ n = 1
[PROOF STEP]
by (subst power_mult_distrib[THEN sym], simp add: v_pres_def)
[PROOF STATE]
proof (state)
this:
$(I^{m}s)^{m}_n = ((1 + i) .^ (real n + 1 / real m) - real (n * m + 1) * (1 + i) .^ (1 / real m) + real (n * m)) / (real m * ((1 + i) .^ (1 / real m) - 1))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_monoid) divides_mult_rI [intro]:
  assumes ab: "a divides b"
    and carr: "a \<in> carrier G"  "b \<in> carrier G"  "c \<in> carrier G"
  shows "(a \<otimes> c) divides (b \<otimes> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> c divides b \<otimes> c
[PROOF STEP]
using carr ab
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G
a divides b

goal (1 subgoal):
 1. a \<otimes> c divides b \<otimes> c
[PROOF STEP]
by (metis divides_mult_lI m_comm)


[STATEMENT]
lemma lt_right_comm:
  assumes "A B Lt C D"
  shows "A B Lt D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B Lt D C
[PROOF STEP]
using Lt_def assms le_right_comm not_cong_1243
[PROOF STATE]
proof (prove)
using this:
?A ?B Lt ?C ?D \<equiv> ?A ?B Le ?C ?D \<and> \<not> Cong ?A ?B ?C ?D
A B Lt C D
?A ?B Le ?C ?D \<Longrightarrow> ?A ?B Le ?D ?C
\<not> Cong ?A ?B ?C ?D \<Longrightarrow> \<not> Cong ?A ?B ?D ?C

goal (1 subgoal):
 1. A B Lt D C
[PROOF STEP]
by blast


[STATEMENT]
lemma uniform_limit_tendsto_bfun:
  fixes f::"'i \<Rightarrow> 'a \<Rightarrow>\<^sub>b ('b :: metric_space)"
    and l::"'a \<Rightarrow>\<^sub>b 'b"
  assumes "uniform_limit UNIV f l F"
  shows "(f \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F
[PROOF STEP]
proof (rule tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have "e / 2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
from uniform_limitD[OF assms this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in F. \<forall>x\<in>UNIV. dist (apply_bfun (f n) x) (apply_bfun l x) < e / 2
[PROOF STEP]
have "\<forall>\<^sub>F i in F. \<forall>x. dist (f i x) (l x) < e / 2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. \<forall>x\<in>UNIV. dist (apply_bfun (f n) x) (apply_bfun l x) < e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F i in F. \<forall>x. dist (apply_bfun (f i) x) (apply_bfun l x) < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bfun (f i) x) (apply_bfun l x) < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bfun (f i) x) (apply_bfun l x) < e / 2
[PROOF STEP]
have "\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bfun (f i) x) (apply_bfun l x) < e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2
[PROOF STEP]
by eventually_elim (blast intro: dist_bound less_imp_le)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2
[PROOF STEP]
show "\<forall>\<^sub>F x in F. dist (f x) l < e"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
by eventually_elim (use \<open>0 < e\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. dist (f x) l < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fstar_fiter_id: "Inf_pres f \<Longrightarrow> fstar f = fiter_id f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
assume hyp: "Inf_pres f"
[PROOF STATE]
proof (state)
this:
Inf_pres f

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
Inf_pres f

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
fix x::"'a::complete_lattice"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
have "fstar f x = x \<sqinter> f (fstar f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fstar f x = x \<sqinter> f (fstar f x)
[PROOF STEP]
by (simp add: hyp)
[PROOF STATE]
proof (state)
this:
fstar f x = x \<sqinter> f (fstar f x)

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
hence a: "fstar f x \<le> gfp (\<lambda>y. x \<sqinter> f y)"
[PROOF STATE]
proof (prove)
using this:
fstar f x = x \<sqinter> f (fstar f x)

goal (1 subgoal):
 1. fstar f x \<le> gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
by (metis gfp_upperbound order_refl)
[PROOF STATE]
proof (state)
this:
fstar f x \<le> gfp (\<lambda>y. x \<sqinter> f y)

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
have "\<forall>y. y \<le> x \<sqinter> f y \<longrightarrow> y \<le> fstar f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<le> x \<sqinter> f y \<longrightarrow> y \<le> fstar f x
[PROOF STEP]
by (meson H_Inf_pres_fstar H_iso_cond2 Inf_pres_iso fstar_Inf_pres hyp le_infE)
[PROOF STATE]
proof (state)
this:
\<forall>y. y \<le> x \<sqinter> f y \<longrightarrow> y \<le> fstar f x

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
hence "fstar f x = gfp (\<lambda>y. x \<sqinter> f y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>y. y \<le> x \<sqinter> f y \<longrightarrow> y \<le> fstar f x

goal (1 subgoal):
 1. fstar f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
by (metis a antisym gfp_least)
[PROOF STATE]
proof (state)
this:
fstar f x = gfp (\<lambda>y. x \<sqinter> f y)

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
fstar f ?x2 = gfp (\<lambda>y. ?x2 \<sqinter> f y)

goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> fstar f = fiter_id f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fstar f ?x2 = gfp (\<lambda>y. ?x2 \<sqinter> f y)

goal (1 subgoal):
 1. fstar f = fiter_id f
[PROOF STEP]
by (simp add: fun_eq_iff Inf_pres_iso fstar_pred_char hyp)
[PROOF STATE]
proof (state)
this:
fstar f = fiter_id f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma same_genPrefix_genPrefix [simp]:
    "refl r \<Longrightarrow> ((xs@ys, xs@zs) \<in> genPrefix r) = ((ys,zs) \<in> genPrefix r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl r \<Longrightarrow> ((xs @ ys, xs @ zs) \<in> genPrefix r) = ((ys, zs) \<in> genPrefix r)
[PROOF STEP]
by (induct xs) (simp_all add: refl_on_def)


[STATEMENT]
lemma monoI2: "\<forall>m. \<forall>n \<ge> m. X n \<le> X m \<Longrightarrow> monoseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m n. m \<le> n \<longrightarrow> X n \<le> X m \<Longrightarrow> monoseq X
[PROOF STEP]
by (simp add: monoseq_def)


[STATEMENT]
lemma iT_Mult_mem_iff_0: "x \<in> (I \<otimes> 0) = (I \<noteq> {} \<and> x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> I \<otimes> 0) = (I \<noteq> {} \<and> x = 0)
[PROOF STEP]
apply (case_tac "I = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. I = {} \<Longrightarrow> (x \<in> I \<otimes> 0) = (I \<noteq> {} \<and> x = 0)
 2. I \<noteq> {} \<Longrightarrow> (x \<in> I \<otimes> 0) = (I \<noteq> {} \<and> x = 0)
[PROOF STEP]
apply (simp add: iT_Mult_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (x \<in> I \<otimes> 0) = (I \<noteq> {} \<and> x = 0)
[PROOF STEP]
apply (simp add: iT_Mult_0 iT_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_decode_encode [simp]: "list_decode (list_encode xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
proof (cases xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
 2. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
xs = []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
 2. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = []

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
xs = y # ys

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs = y # ys
[PROOF STEP]
have "list_encode xs =
      Suc (prod_encode (length ys, tuple_encode (length ys) xs))"
      (is "_ = Suc ?i")
[PROOF STATE]
proof (prove)
using this:
xs = y # ys

goal (1 subgoal):
 1. Partial_Recursive.list_encode xs = Suc (prod_encode (length ys, tuple_encode (length ys) xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_encode xs = Suc (prod_encode (length ys, tuple_encode (length ys) xs))

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Partial_Recursive.list_encode xs = Suc (prod_encode (length ys, tuple_encode (length ys) xs))
[PROOF STEP]
have "list_decode (Suc ?i) = tuple_decode (pdec1 ?i) (pdec2 ?i)"
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.list_encode xs = Suc (prod_encode (length ys, tuple_encode (length ys) xs))

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (pdec1 (prod_encode (length ys, tuple_encode (length ys) xs))) (pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (pdec1 (prod_encode (length ys, tuple_encode (length ys) xs))) (pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)))

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (pdec1 (prod_encode (length ys, tuple_encode (length ys) xs))) (pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)))

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
have "pdec1 ?i = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdec1 (prod_encode (length ys, tuple_encode (length ys) xs)) = length ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pdec1 (prod_encode (length ys, tuple_encode (length ys) xs)) = length ys

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pdec1 (prod_encode (length ys, tuple_encode (length ys) xs)) = length ys

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
have "pdec2 ?i = tuple_encode (length ys) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)) = tuple_encode (length ys) xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)) = tuple_encode (length ys) xs

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (pdec1 (prod_encode (length ys, tuple_encode (length ys) xs))) (pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)))
pdec1 (prod_encode (length ys, tuple_encode (length ys) xs)) = length ys
pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)) = tuple_encode (length ys) xs
[PROOF STEP]
have "list_decode (Suc ?i) =
      tuple_decode (length ys) (tuple_encode (length ys) xs)"
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (pdec1 (prod_encode (length ys, tuple_encode (length ys) xs))) (pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)))
pdec1 (prod_encode (length ys, tuple_encode (length ys) xs)) = length ys
pdec2 (prod_encode (length ys, tuple_encode (length ys) xs)) = tuple_encode (length ys) xs

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length ys) (tuple_encode (length ys) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length ys) (tuple_encode (length ys) xs)

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length ys) (tuple_encode (length ys) xs)

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
have "length ys = length xs - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length xs - 1
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
xs = y # ys

goal (1 subgoal):
 1. length ys = length xs - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ys = length xs - 1

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length ys) (tuple_encode (length ys) xs)
length ys = length xs - 1
[PROOF STEP]
have "list_decode (Suc ?i) =
      tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)"
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length ys) (tuple_encode (length ys) xs)
length ys = length xs - 1

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
Partial_Recursive.list_decode (Suc (prod_encode (length ys, tuple_encode (length ys) xs))) = tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs)
xs = y # ys

goal (1 subgoal):
 1. Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Partial_Recursive.list_decode (Partial_Recursive.list_encode xs) = xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vars_mult_Var:
  \<open>vars (Var x * p) = (if p = 0 then {} else insert x (vars p))\<close> for p :: \<open>int mpoly\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (Var x * p) = (if p = 0 then {} else insert x (vars p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vars (Var x * p) = (if p = 0 then {} else insert x (vars p))
[PROOF STEP]
have \<open>p \<noteq> 0 \<Longrightarrow>
    \<exists>xa. (\<exists>k. xa = monomial (Suc 0) x + k) \<and>
         lookup (mapping_of p) (xa - monomial (Suc 0) x) \<noteq> 0 \<and>
         0 < lookup xa x\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> \<exists>xa. (\<exists>k. xa = monomial (Suc 0) x + k) \<and> lookup (mapping_of p) (xa - monomial (Suc 0) x) \<noteq> 0 \<and> 0 < lookup xa x
[PROOF STEP]
by (metis (no_types, opaque_lifting) One_nat_def ab_semigroup_add_class.add.commute
     add_diff_cancel_right' aux lookup_add lookup_single_eq mapping_of_inject
     neq0_conv one_neq_zero plus_eq_zero_2 zero_mpoly.rep_eq)
[PROOF STATE]
proof (state)
this:
p \<noteq> 0 \<Longrightarrow> \<exists>xa. (\<exists>k. xa = monomial (Suc 0) x + k) \<and> lookup (mapping_of p) (xa - monomial (Suc 0) x) \<noteq> 0 \<and> 0 < lookup xa x

goal (1 subgoal):
 1. vars (Var x * p) = (if p = 0 then {} else insert x (vars p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0 \<Longrightarrow> \<exists>xa. (\<exists>k. xa = monomial (Suc 0) x + k) \<and> lookup (mapping_of p) (xa - monomial (Suc 0) x) \<noteq> 0 \<and> 0 < lookup xa x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> \<exists>xa. (\<exists>k. xa = monomial (Suc 0) x + k) \<and> lookup (mapping_of p) (xa - monomial (Suc 0) x) \<noteq> 0 \<and> 0 < lookup xa x

goal (1 subgoal):
 1. vars (Var x * p) = (if p = 0 then {} else insert x (vars p))
[PROOF STEP]
apply (auto simp: vars_def times_mpoly.rep_eq Var.rep_eq
    elim!: in_keys_timesE dest: keys_add')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. \<lbrakk>p \<noteq> 0; lookup (mapping_of p) k \<noteq> 0; 0 < lookup (monomial (Suc 0) x + k) x\<rbrakk> \<Longrightarrow> \<exists>xa\<in>keys (Var\<^sub>0 x * mapping_of p). x \<in> keys xa
 2. \<And>xa xaa k. \<lbrakk>p \<noteq> 0; xaa \<in> keys (mapping_of p); xa \<in> keys xaa; lookup (mapping_of p) k \<noteq> 0; 0 < lookup (monomial (Suc 0) x + k) x\<rbrakk> \<Longrightarrow> \<exists>x\<in>keys (Var\<^sub>0 x * mapping_of p). xa \<in> keys x
[PROOF STEP]
apply (auto simp: keys_def lookup_times_monomial_left Var.rep_eq Var\<^sub>0_def adds_def
      lookup_add eq_diff_eq'[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
vars (Var x * p) = (if p = 0 then {} else insert x (vars p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_conjugate[simp]: "i < dim_row m \<Longrightarrow> row (conjugate m) i = conjugate (row m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_row m \<Longrightarrow> row (conjugate m) i = conjugate (row m i)
[PROOF STEP]
by (auto)


[STATEMENT]
lemma atomize_cBall:
    "(\<And>x. cin x A ==> P x) == Trueprop (cBall A (\<lambda>x. P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. cin x A \<Longrightarrow> P x) \<equiv> cBall A P
[PROOF STEP]
apply (simp only: atomize_all atomize_imp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. cin x A \<longrightarrow> P x \<equiv> cBall A P
[PROOF STEP]
apply (rule equal_intr_rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. cin x A \<longrightarrow> P x \<Longrightarrow> cBall A P
 2. cBall A P \<Longrightarrow> \<forall>x. cin x A \<longrightarrow> P x
[PROOF STEP]
by (transfer, simp)+


[STATEMENT]
lemma summable_discI [intro]:
  assumes "bounded (range F)"
  shows "summable (\<lambda>t. l^t * norm (F t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>t. l ^ t * norm (F t))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>t. l ^ t * norm (F t))
[PROOF STEP]
obtain b where "norm (F x) \<le> b" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. (\<And>x. norm (F x) \<le> b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded (range F)

goal (1 subgoal):
 1. (\<And>b. (\<And>x. norm (F x) \<le> b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: bounded_iff)
[PROOF STATE]
proof (state)
this:
norm (F ?x3) \<le> b

goal (1 subgoal):
 1. summable (\<lambda>t. l ^ t * norm (F t))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (F ?x3) \<le> b

goal (1 subgoal):
 1. summable (\<lambda>t. l ^ t * norm (F t))
[PROOF STEP]
using Abel_lemma[of l 1 F b]
[PROOF STATE]
proof (prove)
using this:
norm (F ?x3) \<le> b
\<lbrakk>0 \<le> l; l < 1; \<And>n. norm (F n) * 1 ^ n \<le> b\<rbrakk> \<Longrightarrow> summable (\<lambda>n. norm (F n) * l ^ n)

goal (1 subgoal):
 1. summable (\<lambda>t. l ^ t * norm (F t))
[PROOF STEP]
by (auto simp: mult.commute)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>t. l ^ t * norm (F t))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lt_left_comm:
  assumes "A B Lt C D"
  shows "B A Lt C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B A Lt C D
[PROOF STEP]
using Lt_def assms le_comm lt_right_comm not_cong_2143
[PROOF STATE]
proof (prove)
using this:
?A ?B Lt ?C ?D \<equiv> ?A ?B Le ?C ?D \<and> \<not> Cong ?A ?B ?C ?D
A B Lt C D
?A ?B Le ?C ?D \<Longrightarrow> ?B ?A Le ?D ?C
?A ?B Lt ?C ?D \<Longrightarrow> ?A ?B Lt ?D ?C
\<not> Cong ?A ?B ?C ?D \<Longrightarrow> \<not> Cong ?B ?A ?D ?C

goal (1 subgoal):
 1. B A Lt C D
[PROOF STEP]
by blast


[STATEMENT]
lemma foldl_rule_P:
  fixes I :: "'\<sigma> \<Rightarrow> 'a list \<Rightarrow> 'a list \<Rightarrow> bool"
  \<comment> \<open>The invariant holds for the initial state, no items processed yet and all items to be processed:\<close>
  assumes initial: "I \<sigma>0 [] l0"
  \<comment> \<open>The invariant remains valid if one item from the list is processed\<close>
  assumes step: "!!l1 l2 x \<sigma>. \<lbrakk> l0=l1@x#l2; I \<sigma> l1 (x#l2) \<rbrakk> \<Longrightarrow> I (f \<sigma> x) (l1@[x]) l2"
  \<comment> \<open>The proposition follows from the invariant in the final state, i.e. all items processed and nothing to be processed\<close>
  assumes final: "!!\<sigma>. I \<sigma> l0 [] \<Longrightarrow> P \<sigma>"
  shows "P (foldl f \<sigma>0 l0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (foldl f \<sigma>0 l0)
[PROOF STEP]
using foldl_rule[of I, OF initial step]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>l1 l2 x \<sigma>. \<lbrakk>l0 = l1 @ x # l2; I \<sigma> l1 (x # l2)\<rbrakk> \<Longrightarrow> l0 = l1 @ x # l2; \<And>l1 l2 x \<sigma>. \<lbrakk>l0 = l1 @ x # l2; I \<sigma> l1 (x # l2)\<rbrakk> \<Longrightarrow> I (?\<sigma>2 x \<sigma>) l1 (x # l2)\<rbrakk> \<Longrightarrow> I (foldl (\<lambda>\<sigma> x. f (?\<sigma>2 x \<sigma>) x) \<sigma>0 l0) l0 []

goal (1 subgoal):
 1. P (foldl f \<sigma>0 l0)
[PROOF STEP]
by (simp add: final)


[STATEMENT]
lemma increment_approx_zero: "NSDERIV f x :> D \<Longrightarrow> h \<approx> 0 \<Longrightarrow> h \<noteq> 0 \<Longrightarrow> increment f x h \<approx> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>NSDERIV f x :> D; h \<approx> 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> increment f x h \<approx> 0
[PROOF STEP]
by (simp add: NSDERIV_approx incrementI2 mem_infmal_iff)


[STATEMENT]
lemma leo2_skolemise [rule_format]:
  "\<forall>P sk. (\<forall>x. P x) = False \<longrightarrow> (sk = (SOME x. \<not> P x)) \<longrightarrow> (P sk) = False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P sk. (\<forall>x. P x) = False \<longrightarrow> sk = (SOME x. \<not> P x) \<longrightarrow> P sk = False
[PROOF STEP]
by (clarify, rule polar_skolemise)


[STATEMENT]
lemma inverse_mult_eq_1':
  assumes "f$0 \<noteq> (0::'a::division_ring)"
  shows   "f * inverse f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * inverse f = 1
[PROOF STEP]
using   assms fps_right_inverse
[PROOF STATE]
proof (prove)
using this:
f $ 0 \<noteq> (0::'a)
?f $ 0 * ?y = (1::?'a) \<Longrightarrow> ?f * fps_right_inverse ?f ?y = 1

goal (1 subgoal):
 1. f * inverse f = 1
[PROOF STEP]
by      (force simp: fps_inverse_def)


[STATEMENT]
lemma iterate_eq_map_sum: "\<lbrakk>valid t; windows as xs; (case xs of [] \<Rightarrow> True | x # xs' \<Rightarrow> l t \<le> fst x \<and> r t \<le> snd x)\<rbrakk> \<Longrightarrow>
  iterate t xs = map (\<lambda>w. sum (fst w) (snd w)) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.valid t; windows as xs; case xs of [] \<Rightarrow> True | x # xs' \<Rightarrow> l t \<le> fst x \<and> r t \<le> snd x\<rbrakk> \<Longrightarrow> local.iterate t xs = map (\<lambda>w. local.sum (fst w) (snd w)) xs
[PROOF STEP]
by (induction xs arbitrary: t)
    (auto simp: valid_slide windows_def window_def val_eq_Some_sum_if_valid_neq_Leaf neq_Leaf_if_l_gt0 split: list.split)


[STATEMENT]
lemma eq_esing_up[simp]: "eq\<rho> (esing x\<cdot>(up\<cdot>a)) \<rho>1 \<rho>2 \<longleftrightarrow> eq a (\<rho>1 x) (\<rho>2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq\<rho> (esing x\<cdot>(up\<cdot>a)) \<rho>1 \<rho>2 = eq a (\<rho>1 x) (\<rho>2 x)
[PROOF STEP]
by (auto simp add: eq\<rho>.simps)


[STATEMENT]
lemma f_Exec_Stream_Acc_Output_Init_1: "
  f_Exec_Comp_Stream_Acc_Output_Init (Suc 0) output_fun trans_fun xs c =
  map output_fun (f_Exec_Comp_Stream_Init trans_fun xs c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f_Exec_Comp_Stream_Acc_Output_Init (Suc 0) output_fun trans_fun xs c = map output_fun (f_Exec_Comp_Stream_Init trans_fun xs c)
[PROOF STEP]
by (simp add: f_Exec_Comp_Stream_Acc_Output_Init_def f_Exec_Stream_Init_eq_f_Exec_Stream_Cons)


[STATEMENT]
lemma gcd'_dvd2:
  assumes "is_gcd gcd'" shows "gcd' a b dvd b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd' a b dvd b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_gcd gcd'

goal (1 subgoal):
 1. gcd' a b dvd b
[PROOF STEP]
unfolding is_gcd_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. gcd' a b dvd a \<and> gcd' a b dvd b \<and> (\<forall>d'. d' dvd a \<and> d' dvd b \<longrightarrow> d' dvd gcd' a b)

goal (1 subgoal):
 1. gcd' a b dvd b
[PROOF STEP]
by auto


[STATEMENT]
lemma insert_inorder: "sorted_less (inorder t) \<Longrightarrow> inorder (insert k x t) = ins_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_less (inorder t) \<Longrightarrow> inorder (local.insert k x t) = ins_list x (inorder t)
[PROOF STEP]
using ins_inorder
[PROOF STATE]
proof (prove)
using this:
sorted_less (inorder ?t) \<Longrightarrow> inorder_up\<^sub>i (ins ?k ?x ?t) = ins_list ?x (inorder ?t)

goal (1 subgoal):
 1. sorted_less (inorder t) \<Longrightarrow> inorder (local.insert k x t) = ins_list x (inorder t)
[PROOF STEP]
by (simp add: tree\<^sub>i_inorder)


[STATEMENT]
lemma gcd_div_unit1: "is_unit a \<Longrightarrow> gcd (b div a) c = gcd b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit a \<Longrightarrow> gcd (b div a) c = gcd b c
[PROOF STEP]
by (erule is_unitE [of _ b]) (simp add: gcd_mult_unit1)


[STATEMENT]
lemma zero_eq_numeral_mod_ring_iff [simp]:
  "(0 :: 'a :: nontriv mod_ring) = numeral a \<longleftrightarrow> 0 = (numeral a mod CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 = numeral a) = (0 = numeral a mod CARD('a))
[PROOF STEP]
using of_nat_mod_ring_eq_iff[of 0 "numeral a", where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_nat 0 = of_nat (numeral a)) = (0 mod CARD('a) = numeral a mod CARD('a))

goal (1 subgoal):
 1. (0 = numeral a) = (0 = numeral a mod CARD('a))
[PROOF STEP]
by (simp del: of_nat_mod_ring_eq_iff)


[STATEMENT]
lemma Nsub[simp]: "INum (x -\<^sub>N y) = INum x - (INum y:: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. INum (x -\<^sub>N y) = INum x - INum y
[PROOF STEP]
by (simp add: Nsub_def split_def)


[STATEMENT]
lemma dec_interp_not_Inr: "\<lbrakk>dec_interp n FO x ! i = Inr P; i \<in> FO; i < n\<rbrakk> \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dec_interp n FO x ! i = Inr P; i \<in> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
unfolding dec_interp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>map (\<lambda>i. if i \<in> FO then Inl (the_elem (positions_in_row x i)) else Inr (positions_in_row x i)) [0..<n] ! i = Inr P; i \<in> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using nth_map[of n "[0..<n]"]
[PROOF STATE]
proof (prove)
using this:
n < length [0..<n] \<Longrightarrow> map ?f [0..<n] ! n = ?f ([0..<n] ! n)

goal (1 subgoal):
 1. \<lbrakk>map (\<lambda>i. if i \<in> FO then Inl (the_elem (positions_in_row x i)) else Inr (positions_in_row x i)) [0..<n] ! i = Inr P; i \<in> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto


[STATEMENT]
lemma empty_in_lattice: "lattice L ==> {} \<in> L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice L \<Longrightarrow> {} \<in> L
[PROOF STEP]
by (force simp add: lattice_def)


[STATEMENT]
lemma all_stop_cong: "(\<forall>x. P x) = (\<forall>x. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P x) = (\<forall>x. P x)
[PROOF STEP]
by simp


[STATEMENT]
lemma polymul_commute:
  fixes p :: "'a::field_char_0 poly"
  assumes np: "isnpolyh p n0"
    and nq: "isnpolyh q n1"
  shows "p *\<^sub>p q = q *\<^sub>p p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p *\<^sub>p q = q *\<^sub>p p
[PROOF STEP]
using isnpolyh_unique[OF polymul_normh[OF np nq] polymul_normh[OF nq np]]
[PROOF STATE]
proof (prove)
using this:
(\<forall>bs. Ipoly bs (p *\<^sub>p q) = Ipoly bs (q *\<^sub>p p)) = (p *\<^sub>p q = q *\<^sub>p p)

goal (1 subgoal):
 1. p *\<^sub>p q = q *\<^sub>p p
[PROOF STEP]
by simp


[STATEMENT]
lemma le_iff_le_nth_eucl: "x \<le> y \<longleftrightarrow> (\<forall>i<DIM('a). (x $\<^sub>e i) \<le> (y $\<^sub>e i))"
  for x::"'a::executable_euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (\<forall>i<DIM('a). x $\<^sub>e i \<le> y $\<^sub>e i)
[PROOF STEP]
apply (auto simp: nth_eucl_def algebra_simps eucl_le[where 'a='a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>i<DIM('a). x \<bullet> Basis_list ! i \<le> y \<bullet> Basis_list ! i; i \<in> Basis\<rbrakk> \<Longrightarrow> x \<bullet> i \<le> y \<bullet> i
[PROOF STEP]
by (meson eucl_le eucl_le_Basis_list_iff)


[STATEMENT]
lemma nonpos_Reals_divide_I2:
    fixes a :: "'a::real_div_algebra"
    shows "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a / b \<in> \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a / b \<in> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (metis nonneg_Reals_divide_I minus_divide_left uminus_nonneg_Reals_iff)


[STATEMENT]
lemma collinear_3: "NO_MATCH 0 x \<Longrightarrow> collinear {x,y,z} \<longleftrightarrow> collinear {0, x-y, z-y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NO_MATCH (0::'a) x \<Longrightarrow> collinear {x, y, z} = collinear {0::'b, x - y, z - y}
[PROOF STEP]
by (auto simp add: collinear_def)


[STATEMENT]
lemma floor_unique: "of_int z \<le> x \<Longrightarrow> x < of_int z + 1 \<Longrightarrow> \<lfloor>x\<rfloor> = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>of_int z \<le> x; x < of_int z + (1::'a)\<rbrakk> \<Longrightarrow> \<lfloor>x\<rfloor> = z
[PROOF STEP]
using floor_correct [of x] floor_exists1 [of x]
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>x\<rfloor> \<le> x \<and> x < of_int (\<lfloor>x\<rfloor> + 1)
\<exists>!z. of_int z \<le> x \<and> x < of_int (z + 1)

goal (1 subgoal):
 1. \<lbrakk>of_int z \<le> x; x < of_int z + (1::'a)\<rbrakk> \<Longrightarrow> \<lfloor>x\<rfloor> = z
[PROOF STEP]
by auto


[STATEMENT]
lemma inf_ccsubspace_code[code]:
  \<comment> \<open>Code equation for intersection of subspaces.
     Reduced to orthogonal complement and sum of subspaces
     for which we already have code equations.\<close>
  "(A::'a::onb_enum ccsubspace) \<sqinter> B = - (- A \<squnion> - B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<sqinter> B = - (- A \<squnion> - B)
[PROOF STEP]
by (subst ortho_involution[symmetric], subst compl_inf, simp)


[STATEMENT]
lemma ereal_le_less: "ereal y \<le> a \<Longrightarrow> x < y \<Longrightarrow> ereal x < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ereal y \<le> a; x < y\<rbrakk> \<Longrightarrow> ereal x < a
[PROOF STEP]
by (simp add: dual_order.strict_trans1)


[STATEMENT]
lemma lapprox_rat: "real_of_float (lapprox_rat prec x y) \<le> real_of_int x / real_of_int y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (lapprox_rat prec x y) \<le> real_of_int x / real_of_int y
[PROOF STEP]
by (simp add: lapprox_rat.rep_eq truncate_down)


[STATEMENT]
lemma foo8:
  "\<forall>r. r \<in> set p \<and> x \<in> dom (C r) \<longrightarrow> r = a \<Longrightarrow> set p = set s \<Longrightarrow>
   \<forall>r. r \<in> set s \<and> x \<in> dom (C r) \<longrightarrow> r = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>r. r \<in> set p \<and> x \<in> dom (C r) \<longrightarrow> r = a; set p = set s\<rbrakk> \<Longrightarrow> \<forall>r. r \<in> set s \<and> x \<in> dom (C r) \<longrightarrow> r = a
[PROOF STEP]
by auto


[STATEMENT]
lemma ereal_mult_less_right:
  fixes a b c :: ereal
  assumes "b * a < c * a"
    and "0 < a"
    and "a < \<infinity>"
  shows "b < c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b < c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b * a < c * a
0 < a
a < \<infinity>

goal (1 subgoal):
 1. b < c
[PROOF STEP]
by (cases rule: ereal3_cases[of a b c])
     (auto split: if_split_asm simp: zero_less_mult_iff zero_le_mult_iff)


[STATEMENT]
lemma hurwitz_zeta_nat_conv_infsetsum:
  assumes "a > 0" and "Re s > 1"
  shows   "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
          "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s) &&& hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a
1 < Re s

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)
[PROOF STEP]
by (subst hurwitz_zeta_conv_suminf) auto
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "\<dots> = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
using abs_summable_hurwitz_zeta[of s a 0] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < Re s; 0 < real a + real 0\<rbrakk> \<Longrightarrow> (\<lambda>n. 1 / complex_of_real (real n + real a) powr s) abs_summable_on {0..}
0 < a
1 < Re s

goal (1 subgoal):
 1. (\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
by (intro infsetsum_nat' [symmetric]) (auto simp: powr_minus field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
show "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "\<dots> = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)
[PROOF STEP]
by (rule infsetsum_reindex [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "range (\<lambda>n. n + a) = {a..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>n. n + a) = {a..}
[PROOF STEP]
by (rule range_add_nat)
[PROOF STATE]
proof (state)
this:
range (\<lambda>n. n + a) = {a..}

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
show "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr -s)"
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in topological_space) nhds_generated_topology:
  "open = generate_topology T \<Longrightarrow> nhds x = (INF S\<in>{S\<in>T. x \<in> S}. principal S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open = generate_topology T \<Longrightarrow> nhds x = Inf (principal ` {S \<in> T. x \<in> S})
[PROOF STEP]
unfolding nhds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open = generate_topology T \<Longrightarrow> Inf (principal ` {S. open S \<and> x \<in> S}) = Inf (principal ` {S \<in> T. x \<in> S})
[PROOF STEP]
proof (safe intro!: antisym INF_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
assume "generate_topology T S" "x \<in> S"
[PROOF STATE]
proof (state)
this:
generate_topology T S
x \<in> S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generate_topology T S
x \<in> S
[PROOF STEP]
show "(INF S\<in>{S \<in> T. x \<in> S}. principal S) \<le> principal S"
[PROOF STATE]
proof (prove)
using this:
generate_topology T S
x \<in> S

goal (1 subgoal):
 1. Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal S
[PROOF STEP]
by induct
      (auto intro: INF_lower order_trans simp: inf_principal[symmetric] simp del: inf_principal)
[PROOF STATE]
proof (state)
this:
Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
[PROOF STEP]
qed (auto intro!: INF_lower intro: generate_topology.intros)


[STATEMENT]
lemma ord_spmf_eqD_pmf_None:
  assumes "ord_spmf (=) x y"
  shows "pmf x None \<ge> pmf y None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf y None \<le> pmf x None
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ord_spmf (=) x y

goal (1 subgoal):
 1. pmf y None \<le> pmf x None
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> ord_option (=) x y; map_pmf fst pq = x; map_pmf snd pq = y\<rbrakk> \<Longrightarrow> pmf y None \<le> pmf x None
[PROOF STEP]
apply(clarsimp simp only: ennreal_le_iff[symmetric, OF pmf_nonneg] ennreal_pmf_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> ord_option (=) x y; x = map_pmf fst pq; y = map_pmf snd pq\<rbrakk> \<Longrightarrow> integral\<^sup>N (measure_pmf pq) (indicator (snd -` {None})) \<le> integral\<^sup>N (measure_pmf pq) (indicator (fst -` {None}))
[PROOF STEP]
apply(fastforce simp add: AE_measure_pmf_iff intro!: nn_integral_mono_AE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma n_mult_left_divisibility:
  "n(x) \<le> n(y) \<longleftrightarrow> (\<exists>z . n(x) = n(y) * n(z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n x \<le> n y) = (\<exists>z. n x = n y * n z)
[PROOF STEP]
by (metis n_mult_commutative n_mult_left_lower_bound n_order)


[STATEMENT]
lemma Im1_tendsto_upperbound:
   "\<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im1 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im1 limit \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im1 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im1 limit \<le> b
[PROOF STEP]
by (blast intro: tendsto_upperbound [OF tendsto_Im1])