[STATEMENT]
lemma ex_iter': "(\<exists>n. R (iter g a n)) = (R a | (\<exists>n. R (iter g (g a) n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>n. R (iter g a n)) = (R a \<or> (\<exists>n. R (iter g (g a) n)))
[PROOF STEP]
apply(rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>n. R (iter g a n) \<Longrightarrow> R a \<or> (\<exists>n. R (iter g (g a) n))
 2. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(erule exE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. R (iter g a n) \<Longrightarrow> R a \<or> (\<exists>n. R (iter g (g a) n))
 2. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(case_tac n)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. \<lbrakk>R (iter g a n); n = 0\<rbrakk> \<Longrightarrow> R a \<or> (\<exists>n. R (iter g (g a) n))
 2. \<And>n nat. \<lbrakk>R (iter g a n); n = Suc nat\<rbrakk> \<Longrightarrow> R a \<or> (\<exists>n. R (iter g (g a) n))
 3. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n nat. \<lbrakk>R (iter g a n); n = Suc nat\<rbrakk> \<Longrightarrow> R a \<or> (\<exists>n. R (iter g (g a) n))
 2. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(rule disjI2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n nat. \<lbrakk>R (iter g a n); n = Suc nat\<rbrakk> \<Longrightarrow> \<exists>n. R (iter g (g a) n)
 2. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(rule_tac x=nat in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n nat. \<lbrakk>R (iter g a n); n = Suc nat\<rbrakk> \<Longrightarrow> R (iter g (g a) nat)
 2. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(simp add: iter)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R a \<or> (\<exists>n. R (iter g (g a) n)) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. R a \<Longrightarrow> \<exists>n. R (iter g a n)
 2. \<exists>n. R (iter g (g a) n) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(rule_tac x=0 in exI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. R (iter g (g a) n) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(erule exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. R (iter g (g a) n) \<Longrightarrow> \<exists>n. R (iter g a n)
[PROOF STEP]
apply(rule_tac x="Suc n" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. R (iter g (g a) n) \<Longrightarrow> R (iter g a (Suc n))
[PROOF STEP]
apply(simp add: iter)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done

    \<comment> \<open>version suitable for computation\<close>


[STATEMENT]
lemma distinct_impl_card_eq_length:
  "finite (relations t) \<Longrightarrow> height t \<le> n \<Longrightarrow> distinct_relations t
    \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
proof(induction n arbitrary: t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>t. \<lbrakk>finite (relations t); height t \<le> 0; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
finite (relations t)
height t \<le> 0
distinct_relations t

goal (2 subgoals):
 1. \<And>t. \<lbrakk>finite (relations t); height t \<le> 0; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (relations t)
height t \<le> 0
distinct_relations t
[PROOF STEP]
obtain r where "Relation r = t"
[PROOF STATE]
proof (prove)
using this:
finite (relations t)
height t \<le> 0
distinct_relations t

goal (1 subgoal):
 1. (\<And>r. Relation r = t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using height_0_rel
[PROOF STATE]
proof (prove)
using this:
finite (relations t)
height t \<le> 0
distinct_relations t
height ?t = 0 \<Longrightarrow> \<exists>r. ?t = Relation r

goal (1 subgoal):
 1. (\<And>r. Relation r = t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Relation r = t

goal (2 subgoals):
 1. \<And>t. \<lbrakk>finite (relations t); height t \<le> 0; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Relation r = t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Relation r = t

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
using distinct_relations_def
[PROOF STATE]
proof (prove)
using this:
Relation r = t
distinct_relations ?t = distinct (inorder ?t)

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = length (inorder t)

goal (1 subgoal):
 1. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
finite (relations t)
height t \<le> Suc n
distinct_relations t

goal (1 subgoal):
 1. \<And>n t. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
finite (relations t)
height t \<le> Suc n
distinct_relations t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
finite (relations t)
height t \<le> Suc n
distinct_relations t

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
proof(cases "height t = Suc n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height t = Suc n

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
height t = Suc n
[PROOF STEP]
have "0 < height t"
[PROOF STATE]
proof (prove)
using this:
height t = Suc n

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

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < height t
[PROOF STEP]
obtain l r where join[simp]: "Join l r = t"
[PROOF STATE]
proof (prove)
using this:
0 < height t

goal (1 subgoal):
 1. (\<And>l r. Join l r = t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using height_gt_0_join
[PROOF STATE]
proof (prove)
using this:
0 < height t
0 < height ?t \<Longrightarrow> \<exists>l r. ?t = Join l r

goal (1 subgoal):
 1. (\<And>l r. Join l r = t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Join l r = t

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Join l r = t
[PROOF STEP]
have 0: "finite (relations l) \<and> finite (relations r)"
[PROOF STATE]
proof (prove)
using this:
Join l r = t

goal (1 subgoal):
 1. finite (relations l) \<and> finite (relations r)
[PROOF STEP]
using Suc.prems(1) finite_trans
[PROOF STATE]
proof (prove)
using this:
Join l r = t
finite (relations t)
finite (relations (Join ?l ?r)) \<Longrightarrow> finite (relations ?l) \<and> finite (relations ?r)

goal (1 subgoal):
 1. finite (relations l) \<and> finite (relations r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (relations l) \<and> finite (relations r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have 1: "height l \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height l \<le> n
[PROOF STEP]
using True join
[PROOF STATE]
proof (prove)
using this:
height t = Suc n
Join l r = t

goal (1 subgoal):
 1. height l \<le> n
[PROOF STEP]
by (metis height_decr_l less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
height l \<le> n

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have 2: "height r \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height r \<le> n
[PROOF STEP]
using True join
[PROOF STATE]
proof (prove)
using this:
height t = Suc n
Join l r = t

goal (1 subgoal):
 1. height r \<le> n
[PROOF STEP]
by (metis height_decr_r less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
height r \<le> n

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have "Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r)
              = Finite_Set.card (relations l) + Finite_Set.card (relations r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
[PROOF STEP]
using card_Un_Int join 0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> Finite_Set.card ?A + Finite_Set.card ?B = Finite_Set.card (?A \<union> ?B) + Finite_Set.card (?A \<inter> ?B)
Join l r = t
finite (relations l) \<and> finite (relations r)

goal (1 subgoal):
 1. Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
[PROOF STEP]
by (metis JoinTree.joinTree.simps(16))
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r) = Finite_Set.card (relations l) + Finite_Set.card (relations r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
[PROOF STEP]
have "Finite_Set.card (relations t)
              = Finite_Set.card (relations l) + Finite_Set.card (relations r)"
[PROOF STATE]
proof (prove)
using this:
Finite_Set.card (relations t) + Finite_Set.card (relations l \<inter> relations r) = Finite_Set.card (relations l) + Finite_Set.card (relations r)

goal (1 subgoal):
 1. Finite_Set.card (relations t) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
[PROOF STEP]
by (simp add: local.Suc.prems(3) distinct_relations_disjoint)
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = Finite_Set.card (relations l) + Finite_Set.card (relations r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = Finite_Set.card (relations l) + Finite_Set.card (relations r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have "length (inorder t)
              = length (inorder l) + length (inorder r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (inorder t) = length (inorder l) + length (inorder r)
[PROOF STEP]
by (metis JoinTree.inorder.simps(2) join length_append)
[PROOF STATE]
proof (state)
this:
length (inorder t) = length (inorder l) + length (inorder r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (inorder t) = length (inorder l) + length (inorder r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have "Finite_Set.card (relations l) = length (inorder l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.card (relations l) = length (inorder l)
[PROOF STEP]
using Suc.IH Suc.prems(3) distinct_trans_l 0 1 join
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
distinct_relations t
distinct_relations (Join ?l ?r) \<Longrightarrow> distinct_relations ?l
finite (relations l) \<and> finite (relations r)
height l \<le> n
Join l r = t

goal (1 subgoal):
 1. Finite_Set.card (relations l) = length (inorder l)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations l) = length (inorder l)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations l) = length (inorder l)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
have "Finite_Set.card (relations r) = length (inorder r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.card (relations r) = length (inorder r)
[PROOF STEP]
using Suc.IH Suc.prems(3) distinct_trans_r 0 2 join
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
distinct_relations t
distinct_relations (Join ?l ?r) \<Longrightarrow> distinct_relations ?r
finite (relations l) \<and> finite (relations r)
height r \<le> n
Join l r = t

goal (1 subgoal):
 1. Finite_Set.card (relations r) = length (inorder r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations r) = length (inorder r)

goal (2 subgoals):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t = Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
 2. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Finite_Set.card (relations t) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
length (inorder t) = length (inorder l) + length (inorder r)
Finite_Set.card (relations l) = length (inorder l)
Finite_Set.card (relations r) = length (inorder r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Finite_Set.card (relations t) = Finite_Set.card (relations l) + Finite_Set.card (relations r)
length (inorder t) = length (inorder l) + length (inorder r)
Finite_Set.card (relations l) = length (inorder l)
Finite_Set.card (relations r) = length (inorder r)

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = length (inorder t)

goal (1 subgoal):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
height t \<noteq> Suc n

goal (1 subgoal):
 1. \<lbrakk>\<And>t. \<lbrakk>finite (relations t); height t \<le> n; distinct_relations t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t); finite (relations t); height t \<le> Suc n; distinct_relations t; height t \<noteq> Suc n\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
height t \<noteq> Suc n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
height t \<noteq> Suc n

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
height t \<noteq> Suc n
\<lbrakk>finite (relations ?t); height ?t \<le> n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)
finite (relations t)
height t \<le> Suc n
distinct_relations t

goal (1 subgoal):
 1. Finite_Set.card (relations t) = length (inorder t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = length (inorder t)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Finite_Set.card (relations t) = length (inorder t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gt_antisym: "t >\<^sub>t s \<Longrightarrow> \<not> s >\<^sub>t t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t >\<^sub>t s \<Longrightarrow> \<not> s >\<^sub>t t
[PROOF STEP]
using gt_irrefl gt_trans
[PROOF STATE]
proof (prove)
using this:
\<not> ?s >\<^sub>t ?s
\<lbrakk>?u >\<^sub>t ?t; ?t >\<^sub>t ?s\<rbrakk> \<Longrightarrow> ?u >\<^sub>t ?s

goal (1 subgoal):
 1. t >\<^sub>t s \<Longrightarrow> \<not> s >\<^sub>t t
[PROOF STEP]
by blast


[STATEMENT]
lemma eq_game_trans: "eq_game a b \<Longrightarrow> eq_game b c \<Longrightarrow> eq_game a c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>eq_game a b; eq_game b c\<rbrakk> \<Longrightarrow> eq_game a c
[PROOF STEP]
by (auto simp add: eq_game_def intro: ge_game_trans)


[STATEMENT]
lemma riesz_frechet_representation_unique:
  \<comment> \<open>Theorem 3.4 in @{cite conway2013course}\<close>
  fixes f::\<open>'a::complex_inner \<Rightarrow> complex\<close>
  assumes \<open>\<And>x. f x = (t \<bullet>\<^sub>C x)\<close>
  assumes \<open>\<And>x. f x = (u \<bullet>\<^sub>C x)\<close>
  shows \<open>t = u\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = u
[PROOF STEP]
by (metis add_diff_cancel_left' assms(1) assms(2) cinner_diff_left cinner_gt_zero_iff diff_add_cancel diff_zero)


[STATEMENT]
lemma index_remove_nth: "distinct xs \<Longrightarrow> x \<in> set xs \<Longrightarrow> index (remove_nth i xs) x = (if index xs x < i then index xs x else if i = index xs x then length xs - 1 else index xs x - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> index (remove_nth i xs) x = (if index xs x < i then index xs x else if i = index xs x then length xs - 1 else index xs x - 1)
[PROOF STEP]
by (induct i xs rule: remove_nth.induct) (auto simp: not_less intro!: Suc_pred split: if_splits)


[STATEMENT]
lemma back_edges_tree_pathes_disjoint:
    "back_edges s \<inter> (tree_edges s)\<^sup>+ = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. back_edges s \<inter> (tree_edges s)\<^sup>+ = {}
[PROOF STEP]
using back_edge_disc tree_path_disc
[PROOF STATE]
proof (prove)
using this:
(?v, ?w) \<in> back_edges s \<Longrightarrow> \<delta> s ?w \<le> \<delta> s ?v
(?v, ?w) \<in> (tree_edges s)\<^sup>+ \<Longrightarrow> \<delta> s ?v < \<delta> s ?w

goal (1 subgoal):
 1. back_edges s \<inter> (tree_edges s)\<^sup>+ = {}
[PROOF STEP]
by force


[STATEMENT]
lemma N_nonneg: "N n \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> N n
[PROOF STEP]
by (rule sums_le[OF _ sums_zero N_sums]) (use q_gt_1 in auto)


[STATEMENT]
lemma fttf_4: assumes dx: "dim_vec x = 4"
  and be: "x $ 0 = False \<and> x $ 1 = True \<and> x $ 2 = True \<and> x $ 3 = False"
  shows "ceros_of_boolean_input x = {0,3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 3}
[PROOF STEP]
using dx be
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = True \<and> x $ 2 = True \<and> x $ 3 = False

goal (1 subgoal):
 1. ceros_of_boolean_input x = {0, 3}
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = True \<and> x $ 2 = True \<and> x $ 3 = False

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 3}
[PROOF STEP]
using less_4_cases
[PROOF STATE]
proof (prove)
using this:
dim_vec x = 4
x $ 0 = False \<and> x $ 1 = True \<and> x $ 2 = True \<and> x $ 3 = False
?n < 4 \<Longrightarrow> ?n = 0 \<or> ?n = 1 \<or> ?n = 2 \<or> ?n = 3

goal (1 subgoal):
 1. {xa. xa < dim_vec x \<and> x $ xa = False} = {0, 3}
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_deriv_lr_inverse:
  fixes   x y :: "'a::ring_1"
  assumes "x * f$0 = 1" "f$0 * y = 1"
  \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close>
  shows   "fps_deriv (fps_left_inverse f x) =
            - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x"
  and     "fps_deriv (fps_right_inverse f y) =
            - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_left_inverse f x) = - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x &&& fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_deriv (fps_left_inverse f x) = - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x
 2. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
define L where "L \<equiv> fps_left_inverse f x"
[PROOF STATE]
proof (state)
this:
L \<equiv> fps_left_inverse f x

goal (2 subgoals):
 1. fps_deriv (fps_left_inverse f x) = - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x
 2. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
hence "fps_deriv (L * f) = 0"
[PROOF STATE]
proof (prove)
using this:
L \<equiv> fps_left_inverse f x

goal (1 subgoal):
 1. fps_deriv (L * f) = 0
[PROOF STEP]
using fps_left_inverse[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
L \<equiv> fps_left_inverse f x
fps_left_inverse f x * f = 1

goal (1 subgoal):
 1. fps_deriv (L * f) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (L * f) = 0

goal (2 subgoals):
 1. fps_deriv (fps_left_inverse f x) = - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x
 2. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x * f $ 0 = (1::'a)
f $ 0 * y = (1::'a)
fps_deriv (L * f) = 0
[PROOF STEP]
show "fps_deriv L = - L * fps_deriv f * L"
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
f $ 0 * y = (1::'a)
fps_deriv (L * f) = 0

goal (1 subgoal):
 1. fps_deriv L = - L * fps_deriv f * L
[PROOF STEP]
using fps_right_inverse'[OF assms]
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
f $ 0 * y = (1::'a)
fps_deriv (L * f) = 0
f * fps_left_inverse f x = 1

goal (1 subgoal):
 1. fps_deriv L = - L * fps_deriv f * L
[PROOF STEP]
by    (simp add: minus_unique mult.assoc L_def)
[PROOF STATE]
proof (state)
this:
fps_deriv L = - L * fps_deriv f * L

goal (1 subgoal):
 1. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
define R where "R \<equiv> fps_right_inverse f y"
[PROOF STATE]
proof (state)
this:
R \<equiv> fps_right_inverse f y

goal (1 subgoal):
 1. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
hence "fps_deriv (f * R) = 0"
[PROOF STATE]
proof (prove)
using this:
R \<equiv> fps_right_inverse f y

goal (1 subgoal):
 1. fps_deriv (f * R) = 0
[PROOF STEP]
using fps_right_inverse[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
R \<equiv> fps_right_inverse f y
f * fps_right_inverse f y = 1

goal (1 subgoal):
 1. fps_deriv (f * R) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (f * R) = 0

goal (1 subgoal):
 1. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
hence 1: "f * fps_deriv R + fps_deriv f * R = 0"
[PROOF STATE]
proof (prove)
using this:
fps_deriv (f * R) = 0

goal (1 subgoal):
 1. f * fps_deriv R + fps_deriv f * R = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f * fps_deriv R + fps_deriv f * R = 0

goal (1 subgoal):
 1. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
have "R * f * fps_deriv R = - R * fps_deriv f * R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R * f * fps_deriv R = - R * fps_deriv f * R
[PROOF STEP]
using iffD2[OF eq_neg_iff_add_eq_0, OF 1]
[PROOF STATE]
proof (prove)
using this:
f * fps_deriv R = - (fps_deriv f * R)

goal (1 subgoal):
 1. R * f * fps_deriv R = - R * fps_deriv f * R
[PROOF STEP]
by (simp add: mult.assoc)
[PROOF STATE]
proof (state)
this:
R * f * fps_deriv R = - R * fps_deriv f * R

goal (1 subgoal):
 1. fps_deriv (fps_right_inverse f y) = - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y
[PROOF STEP]
thus "fps_deriv R = - R * fps_deriv f * R"
[PROOF STATE]
proof (prove)
using this:
R * f * fps_deriv R = - R * fps_deriv f * R

goal (1 subgoal):
 1. fps_deriv R = - R * fps_deriv f * R
[PROOF STEP]
using fps_left_inverse'[OF assms]
[PROOF STATE]
proof (prove)
using this:
R * f * fps_deriv R = - R * fps_deriv f * R
fps_right_inverse f y * f = 1

goal (1 subgoal):
 1. fps_deriv R = - R * fps_deriv f * R
[PROOF STEP]
by (simp add: R_def)
[PROOF STATE]
proof (state)
this:
fps_deriv R = - R * fps_deriv f * R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_projection_on_unique:
  fixes M :: \<open>'a::complex_inner set\<close>
  assumes \<open>convex M\<close>
  assumes "is_projection_on \<pi>\<^sub>1 M"
  assumes "is_projection_on \<pi>\<^sub>2 M"
  shows "\<pi>\<^sub>1 = \<pi>\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>\<^sub>1 = \<pi>\<^sub>2
[PROOF STEP]
using smallest_dist_unique[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?r; is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?s\<rbrakk> \<Longrightarrow> ?r = ?s

goal (1 subgoal):
 1. \<pi>\<^sub>1 = \<pi>\<^sub>2
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?r; is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?s\<rbrakk> \<Longrightarrow> ?r = ?s
is_projection_on \<pi>\<^sub>1 M
is_projection_on \<pi>\<^sub>2 M

goal (1 subgoal):
 1. \<pi>\<^sub>1 = \<pi>\<^sub>2
[PROOF STEP]
unfolding is_projection_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?r; is_arg_min (\<lambda>x. dist x ?h) (\<lambda>x. x \<in> M) ?s\<rbrakk> \<Longrightarrow> ?r = ?s
\<forall>h. is_arg_min (\<lambda>x. dist x h) (\<lambda>x. x \<in> M) (\<pi>\<^sub>1 h)
\<forall>h. is_arg_min (\<lambda>x. dist x h) (\<lambda>x. x \<in> M) (\<pi>\<^sub>2 h)

goal (1 subgoal):
 1. \<pi>\<^sub>1 = \<pi>\<^sub>2
[PROOF STEP]
by blast


[STATEMENT]
lemma split_length:
  assumes "split n v (v1,v2)"
  shows "n = int (length v1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = int (length v1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
split n v (v1, v2)

goal (1 subgoal):
 1. n = int (length v1)
[PROOF STEP]
proof(induct  "(v1,v2)" arbitrary: v1 v2 rule: split.inducts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. 0 = int (length [])
 2. \<And>m xs ys zs x. \<lbrakk>split m xs (ys, zs); m = int (length ys)\<rbrakk> \<Longrightarrow> m + 1 = int (length (x # ys))
[PROOF STEP]
case (1 xs)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>xs. 0 = int (length [])
 2. \<And>m xs ys zs x. \<lbrakk>split m xs (ys, zs); m = int (length ys)\<rbrakk> \<Longrightarrow> m + 1 = int (length (x # ys))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = int (length [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 = int (length [])

goal (1 subgoal):
 1. \<And>m xs ys zs x. \<lbrakk>split m xs (ys, zs); m = int (length ys)\<rbrakk> \<Longrightarrow> m + 1 = int (length (x # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m xs ys zs x. \<lbrakk>split m xs (ys, zs); m = int (length ys)\<rbrakk> \<Longrightarrow> m + 1 = int (length (x # ys))
[PROOF STEP]
case (2 m xs ys zs x)
[PROOF STATE]
proof (state)
this:
split m xs (ys, zs)
m = int (length ys)

goal (1 subgoal):
 1. \<And>m xs ys zs x. \<lbrakk>split m xs (ys, zs); m = int (length ys)\<rbrakk> \<Longrightarrow> m + 1 = int (length (x # ys))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
split m xs (ys, zs)
m = int (length ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
split m xs (ys, zs)
m = int (length ys)

goal (1 subgoal):
 1. m + 1 = int (length (x # ys))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m + 1 = int (length (x # ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_divide_uminus:
  fixes f g h :: "'a::{ring,inverse} fps"
  shows "(- f) / g = - (f / g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - f / g = - (f / g)
[PROOF STEP]
by    (simp add: fps_divide_def algebra_simps fps_shift_uminus)


[STATEMENT]
lemma kpower_inductl_var: "h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
assume h1: "h \<squnion> f \<circ>\<^sub>K g \<le> g"
[PROOF STATE]
proof (state)
this:
h \<squnion> f \<circ>\<^sub>K g \<le> g

goal (1 subgoal):
 1. h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<squnion> f \<circ>\<^sub>K g \<le> g
[PROOF STEP]
have h2: "f \<circ>\<^sub>K g \<le> g"
[PROOF STATE]
proof (prove)
using this:
h \<squnion> f \<circ>\<^sub>K g \<le> g

goal (1 subgoal):
 1. f \<circ>\<^sub>K g \<le> g
[PROOF STEP]
using le_sup_iff
[PROOF STATE]
proof (prove)
using this:
h \<squnion> f \<circ>\<^sub>K g \<le> g
(?x \<squnion> ?y \<le> ?z) = (?x \<le> ?z \<and> ?y \<le> ?z)

goal (1 subgoal):
 1. f \<circ>\<^sub>K g \<le> g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<circ>\<^sub>K g \<le> g

goal (1 subgoal):
 1. h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
have "h \<le> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<le> g
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
h \<squnion> f \<circ>\<^sub>K g \<le> g

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

goal (1 subgoal):
 1. h \<squnion> f \<circ>\<^sub>K g \<le> g \<Longrightarrow> kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<le> g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<le> g

goal (1 subgoal):
 1. kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
using h2 kcomp_isol kpower_inductl order_trans
[PROOF STATE]
proof (prove)
using this:
h \<le> g
f \<circ>\<^sub>K g \<le> g
?f \<le> ?g \<Longrightarrow> ?h \<circ>\<^sub>K ?f \<le> ?h \<circ>\<^sub>K ?g
?f \<circ>\<^sub>K ?g \<le> ?g \<Longrightarrow> kpower ?f ?i \<circ>\<^sub>K ?g \<le> ?g
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. kpower f i \<circ>\<^sub>K h \<le> g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
kpower f i \<circ>\<^sub>K h \<le> g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_vec_sum_list_less:
  assumes "v <\<^sub>v w"
  shows "sum_list v < sum_list w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list v < sum_list w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v <\<^sub>v w

goal (1 subgoal):
 1. sum_list v < sum_list w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v <\<^sub>v w \<Longrightarrow> sum_list v < sum_list w
[PROOF STEP]
have "length v = length w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v = length w
[PROOF STEP]
using assms less_eq_def less_imp_le
[PROOF STATE]
proof (prove)
using this:
v <\<^sub>v w
(?xs \<le>\<^sub>v ?ys) = (length ?xs = length ?ys \<and> (\<forall>i<length ?xs. ?xs ! i \<le> ?ys ! i))
?x < ?y \<Longrightarrow> ?x \<le> ?y

goal (1 subgoal):
 1. length v = length w
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length v = length w

goal (1 subgoal):
 1. v <\<^sub>v w \<Longrightarrow> sum_list v < sum_list w
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v = length w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length v = length w

goal (1 subgoal):
 1. sum_list v < sum_list w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length v = length w
v <\<^sub>v w

goal (1 subgoal):
 1. sum_list v < sum_list w
[PROOF STEP]
proof (induct v w rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. [] <\<^sub>v [] \<Longrightarrow> sum_list [] < sum_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys; x # xs <\<^sub>v y # ys\<rbrakk> \<Longrightarrow> sum_list (x # xs) < sum_list (y # ys)
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys
x # xs <\<^sub>v y # ys

goal (2 subgoals):
 1. [] <\<^sub>v [] \<Longrightarrow> sum_list [] < sum_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys; x # xs <\<^sub>v y # ys\<rbrakk> \<Longrightarrow> sum_list (x # xs) < sum_list (y # ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys
x # xs <\<^sub>v y # ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys
x # xs <\<^sub>v y # ys

goal (1 subgoal):
 1. sum_list (x # xs) < sum_list (y # ys)
[PROOF STEP]
using length_replicate less_Cons order_vec.order.strict_iff_order
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
xs <\<^sub>v ys \<Longrightarrow> sum_list xs < sum_list ys
x # xs <\<^sub>v y # ys
length (replicate ?n ?x) = ?n
(?x # ?xs <\<^sub>v ?y # ?ys) = (length ?xs = length ?ys \<and> (?x \<le> ?y \<and> ?xs <\<^sub>v ?ys \<or> ?x < ?y \<and> ?xs \<le>\<^sub>v ?ys))
(?a <\<^sub>v ?b) = (?a \<le>\<^sub>v ?b \<and> ?a \<noteq> ?b)

goal (1 subgoal):
 1. sum_list (x # xs) < sum_list (y # ys)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sum_list (x # xs) < sum_list (y # ys)

goal (1 subgoal):
 1. [] <\<^sub>v [] \<Longrightarrow> sum_list [] < sum_list []
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
sum_list v < sum_list w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_scaleR [simp]: "fst (scaleR r A) = scaleR r (fst A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (r *\<^sub>R A) = r *\<^sub>R fst A
[PROOF STEP]
unfolding scaleR_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (r *\<^sub>R fst A, r *\<^sub>R snd A) = r *\<^sub>R fst A
[PROOF STEP]
by simp


[STATEMENT]
lemma (in semiring_0) dividesE:
  assumes "p1 divides p2"
  obtains q where "poly p2 = poly (p1 *** q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>q. poly p2 = poly (p1 *** q) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p1 divides p2

goal (1 subgoal):
 1. (\<And>q. poly p2 = poly (p1 *** q) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: divides_def)

\<comment> \<open>order of a polynomial\<close>


[STATEMENT]
lemma var_list_segment_is_poly_tuple:
  assumes "i \<le>j"
  assumes "j \<le> n"
  shows "is_poly_tuple n (var_list_segment i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_poly_tuple n (var_list_segment i j)
[PROOF STEP]
apply(rule Qp_is_poly_tupleI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ia. ia < length (var_list_segment i j) \<Longrightarrow> var_list_segment i j ! ia \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
using assms var_list_segment_entry var_list_segment_length  Qp.cring_axioms pvar_closed[of  _ n]
[PROOF STATE]
proof (prove)
using this:
i \<le> j
j \<le> n
\<lbrakk>?k < ?j - ?i; ?i \<le> ?j\<rbrakk> \<Longrightarrow> var_list_segment ?i ?j ! ?k = pvar Q\<^sub>p (?i + ?k)
?i \<le> ?j \<Longrightarrow> length (var_list_segment ?i ?j) = ?j - ?i
cring Q\<^sub>p
?i < n \<Longrightarrow> pvar Q\<^sub>p ?i \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. \<And>ia. ia < length (var_list_segment i j) \<Longrightarrow> var_list_segment i j ! ia \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
by (metis (no_types, opaque_lifting)  add.commute add_lessD1 diff_add_inverse le_Suc_ex
      less_diff_conv)


[STATEMENT]
lemma succ_nodes :
  fixes A :: "('a,'b,'c) FSM"
  and   w :: "('a \<times> 'b)"
  assumes "q2 \<in> succ A w q1"
  and     "q1 \<in> nodes A"
shows "q2 \<in> nodes A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
obtain x y where "w = (x,y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. w = (x, y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson surj_pair)
[PROOF STATE]
proof (state)
this:
w = (x, y)

goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w = (x, y)
[PROOF STEP]
have "q2 \<in> successors A q1"
[PROOF STATE]
proof (prove)
using this:
w = (x, y)

goal (1 subgoal):
 1. q2 \<in> successors A q1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w = (x, y)
q2 \<in> succ A w q1
q1 \<in> nodes A

goal (1 subgoal):
 1. q2 \<in> successors A q1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q2 \<in> successors A q1

goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q2 \<in> successors A q1
[PROOF STEP]
have "q2 \<in> reachable A q1"
[PROOF STATE]
proof (prove)
using this:
q2 \<in> successors A q1

goal (1 subgoal):
 1. q2 \<in> reachable A q1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q2 \<in> reachable A q1

goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q2 \<in> reachable A q1
[PROOF STEP]
have "q2 \<in> reachable A (initial A)"
[PROOF STATE]
proof (prove)
using this:
q2 \<in> reachable A q1

goal (1 subgoal):
 1. q2 \<in> reachable A (initial A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
q2 \<in> reachable A q1
q2 \<in> succ A w q1
q1 \<in> nodes A

goal (1 subgoal):
 1. q2 \<in> reachable A (initial A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q2 \<in> reachable A (initial A)

goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q2 \<in> reachable A (initial A)
[PROOF STEP]
show "q2 \<in> nodes A"
[PROOF STATE]
proof (prove)
using this:
q2 \<in> reachable A (initial A)

goal (1 subgoal):
 1. q2 \<in> nodes A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q2 \<in> nodes A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma delete_point_index_zero:
  assumes "G \<in> {g - {x} |g. g \<in> \<G> \<and> g \<noteq> {x}}"
  and "y \<in> G" and "z \<in> G" and "z\<noteq> y"
shows "(del_point_blocks x) index {y, z} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
have "y \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<noteq> x
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
G \<in> {g - {x} |g. g \<in> \<G> \<and> g \<noteq> {x}}
y \<in> G

goal (1 subgoal):
 1. y \<noteq> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<noteq> x

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
have "z \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> x
[PROOF STEP]
using assms(1) assms(3)
[PROOF STATE]
proof (prove)
using this:
G \<in> {g - {x} |g. g \<in> \<G> \<and> g \<noteq> {x}}
z \<in> G

goal (1 subgoal):
 1. z \<noteq> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z \<noteq> x

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
obtain G' where ing: "G' \<in> \<G>" and ss: "G \<subseteq> G'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>G'. \<lbrakk>G' \<in> \<G>; G \<subseteq> G'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
G \<in> {g - {x} |g. g \<in> \<G> \<and> g \<noteq> {x}}

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

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
have "{y, z} \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y, z} \<subseteq> G
[PROOF STEP]
by (simp add: assms(2) assms(3))
[PROOF STATE]
proof (state)
this:
{y, z} \<subseteq> G

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y, z} \<subseteq> G
[PROOF STEP]
have "{y, z} \<subseteq> \<V>"
[PROOF STATE]
proof (prove)
using this:
{y, z} \<subseteq> G

goal (1 subgoal):
 1. {y, z} \<subseteq> \<V>
[PROOF STEP]
by (meson ss ing group_subset_point_subset)
[PROOF STATE]
proof (state)
this:
{y, z} \<subseteq> \<V>

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y, z} \<subseteq> \<V>
[PROOF STEP]
have "{y, z} \<subseteq> (del_point x)"
[PROOF STATE]
proof (prove)
using this:
{y, z} \<subseteq> \<V>

goal (1 subgoal):
 1. {y, z} \<subseteq> del_point x
[PROOF STEP]
using \<open>y \<noteq> x\<close> \<open>z \<noteq> x\<close> del_point_def
[PROOF STATE]
proof (prove)
using this:
{y, z} \<subseteq> \<V>
y \<noteq> x
z \<noteq> x
del_point ?p \<equiv> \<V> - {?p}

goal (1 subgoal):
 1. {y, z} \<subseteq> del_point x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{y, z} \<subseteq> del_point x

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{y, z} \<subseteq> del_point x

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
using delete_point_index_eq index_together
[PROOF STATE]
proof (prove)
using this:
{y, z} \<subseteq> del_point x
?ps \<subseteq> del_point ?p \<Longrightarrow> del_point_blocks ?p index ?ps = \<B> index ?ps
\<lbrakk>?G \<in> \<G>; ?x \<in> ?G; ?y \<in> ?G; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> \<B> index {?x, ?y} = 0

goal (1 subgoal):
 1. del_point_blocks x index {y, z} = 0
[PROOF STEP]
by (metis assms(2) assms(3) assms(4) in_mono ing ss)
[PROOF STATE]
proof (state)
this:
del_point_blocks x index {y, z} = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partition_on_map:
  assumes "inj_on f A"
  assumes "partition_on A P"
  shows "partition_on (f ` A) ((`) f ` P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
fix X Y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
assume "X \<in> P" "Y \<in> P" "f ` X \<noteq> f ` Y"
[PROOF STATE]
proof (state)
this:
X \<in> P
Y \<in> P
f ` X \<noteq> f ` Y

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X \<in> P
Y \<in> P
f ` X \<noteq> f ` Y

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
partition_on A P
[PROOF STEP]
have "\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}" and "inj_on f (\<Union>P)"
[PROOF STATE]
proof (prove)
using this:
inj_on f A
partition_on A P

goal (1 subgoal):
 1. \<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {} &&& inj_on f (\<Union> P)
[PROOF STEP]
by (auto elim!: partition_onE)
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
inj_on f (\<Union> P)

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X \<in> P
Y \<in> P
f ` X \<noteq> f ` Y
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
inj_on f (\<Union> P)
[PROOF STEP]
have "f ` X \<inter> f ` Y = {}"
[PROOF STATE]
proof (prove)
using this:
X \<in> P
Y \<in> P
f ` X \<noteq> f ` Y
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
inj_on f (\<Union> P)

goal (1 subgoal):
 1. f ` X \<inter> f ` Y = {}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
X \<in> P
Y \<in> P
f ` X \<noteq> f ` Y
\<forall>p\<in>P. \<forall>p'\<in>P. p \<noteq> p' \<longrightarrow> p \<inter> p' = {}
\<forall>x\<in>\<Union> P. \<forall>y\<in>\<Union> P. f x = f y \<longrightarrow> x = y

goal (1 subgoal):
 1. f ` X \<inter> f ` Y = {}
[PROOF STEP]
by auto (metis IntI empty_iff rev_image_eqI)+
[PROOF STATE]
proof (state)
this:
f ` X \<inter> f ` Y = {}

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?X2 \<in> P; ?Y2 \<in> P; f ` ?X2 \<noteq> f ` ?Y2\<rbrakk> \<Longrightarrow> f ` ?X2 \<inter> f ` ?Y2 = {}

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
from assms this
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
partition_on A P
\<lbrakk>?X2 \<in> P; ?Y2 \<in> P; f ` ?X2 \<noteq> f ` ?Y2\<rbrakk> \<Longrightarrow> f ` ?X2 \<inter> f ` ?Y2 = {}
[PROOF STEP]
show "partition_on (f ` A) ((`) f ` P)"
[PROOF STATE]
proof (prove)
using this:
inj_on f A
partition_on A P
\<lbrakk>?X2 \<in> P; ?Y2 \<in> P; f ` ?X2 \<noteq> f ` ?Y2\<rbrakk> \<Longrightarrow> f ` ?X2 \<inter> f ` ?Y2 = {}

goal (1 subgoal):
 1. partition_on (f ` A) ((`) f ` P)
[PROOF STEP]
by (auto intro!: partition_onI elim!: partition_onE)
[PROOF STATE]
proof (state)
this:
partition_on (f ` A) ((`) f ` P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma t_heap_of_A_bound:
  "t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1)

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
let ?lhs = "t_insert x (heap_of_A xs) + t_heap_of_A xs"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
have "?lhs \<le> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> t_insert x (heap_of_A xs) + t_heap_of_A xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> t_insert x (heap_of_A xs) + t_heap_of_A xs

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> t_insert x (heap_of_A xs) + t_heap_of_A xs

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
note Cons
[PROOF STATE]
proof (state)
this:
t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1)

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1)

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
note height_insert_ge[of "heap_of_A xs" x]
[PROOF STATE]
proof (state)
this:
height (heap_of_A xs) \<le> height (insert x (heap_of_A xs))

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
height (heap_of_A xs) \<le> height (insert x (heap_of_A xs))

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
note t_insert_height[of x "heap_of_A xs"]
[PROOF STATE]
proof (state)
this:
t_insert x (heap_of_A xs) \<le> height (heap_of_A xs) + 1

goal (2 subgoals):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
 2. \<And>a xs. t_heap_of_A xs \<le> length xs * (height (heap_of_A xs) + 1) \<Longrightarrow> t_heap_of_A (a # xs) \<le> length (a # xs) * (height (heap_of_A (a # xs)) + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>xa y. xa \<le> y \<Longrightarrow> t_insert x (heap_of_A xs) + xa \<le> t_insert x (heap_of_A xs) + y; \<And>xa y. xa \<le> y \<Longrightarrow> t_insert x (heap_of_A xs) + length xs * (xa + 1) \<le> t_insert x (heap_of_A xs) + length xs * (y + 1); \<And>xa y. xa \<le> y \<Longrightarrow> xa + length xs * (height (insert x (heap_of_A xs)) + 1) \<le> y + length xs * (height (insert x (heap_of_A xs)) + 1)\<rbrakk> \<Longrightarrow> t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> height (heap_of_A xs) + 1 + length xs * (height (insert x (heap_of_A xs)) + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>xa y. xa \<le> y \<Longrightarrow> t_insert x (heap_of_A xs) + xa \<le> t_insert x (heap_of_A xs) + y; \<And>xa y. xa \<le> y \<Longrightarrow> t_insert x (heap_of_A xs) + length xs * (xa + 1) \<le> t_insert x (heap_of_A xs) + length xs * (y + 1); \<And>xa y. xa \<le> y \<Longrightarrow> xa + length xs * (height (insert x (heap_of_A xs)) + 1) \<le> y + length xs * (height (insert x (heap_of_A xs)) + 1)\<rbrakk> \<Longrightarrow> t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> height (heap_of_A xs) + 1 + length xs * (height (insert x (heap_of_A xs)) + 1)

goal (1 subgoal):
 1. t_heap_of_A (x # xs) \<le> length (x # xs) * (height (heap_of_A (x # xs)) + 1)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> Suc (height (heap_of_A xs) + (length xs + length xs * height (insert x (heap_of_A xs)))) \<Longrightarrow> t_insert x (heap_of_A xs) + t_heap_of_A xs \<le> Suc (length xs + (height (insert x (heap_of_A xs)) + length xs * height (insert x (heap_of_A xs))))
[PROOF STEP]
apply (erule order_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (height (heap_of_A xs) + (length xs + length xs * height (insert x (heap_of_A xs)))) \<le> Suc (length xs + (height (insert x (heap_of_A xs)) + length xs * height (insert x (heap_of_A xs))))
[PROOF STEP]
apply (simp add: height_insert_ge)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
t_heap_of_A (x # xs) \<le> length (x # xs) * (height (heap_of_A (x # xs)) + 1)

goal (1 subgoal):
 1. t_heap_of_A [] \<le> length [] * (height (heap_of_A []) + 1)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma emeasure_insert_ne:
  "A \<noteq> {} \<Longrightarrow> {x} \<in> sets M \<Longrightarrow> A \<in> sets M \<Longrightarrow> x \<notin> A \<Longrightarrow> emeasure M (insert x A) = emeasure M {x} + emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; {x} \<in> sets M; A \<in> sets M; x \<notin> A\<rbrakk> \<Longrightarrow> emeasure M (insert x A) = emeasure M {x} + emeasure M A
[PROOF STEP]
by (rule emeasure_insert)


[STATEMENT]
lemma fls_deriv_zero[simp]: "fls_deriv 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv 0 = 0
[PROOF STEP]
using fls_deriv_const[of 0]
[PROOF STATE]
proof (prove)
using this:
fls_deriv (fls_const (0::?'b1)) = 0

goal (1 subgoal):
 1. fls_deriv 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma set_sorted_list_of_multiset [simp]:
  "set (sorted_list_of_multiset M) = set_mset M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (sorted_list_of_multiset M) = set_mset M
[PROOF STEP]
by (induct M) (simp_all add: set_insort_key)


[STATEMENT]
lemma meet_all_3:
  assumes "meet_3_in l m n P"
  shows "meet_in m n P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. meet_in m n P
[PROOF STEP]
using assms meet_3_in_def meet_in_def
[PROOF STATE]
proof (prove)
using this:
meet_3_in l m n P
meet_3_in ?l ?m ?n ?P \<equiv> meet_in ?l ?m ?P \<and> meet_in ?l ?n ?P
meet_in ?l ?m ?P \<equiv> incid ?P ?l \<and> incid ?P ?m

goal (1 subgoal):
 1. meet_in m n P
[PROOF STEP]
by auto


[STATEMENT]
lemma zero_prod_root_unit[simp]: "prod_root_unity ns = 0 \<longleftrightarrow> 0 \<in> set ns"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prod_root_unity ns = 0) = (0 \<in> set ns)
[PROOF STEP]
unfolding prod_root_unity_def prod_list_zero_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<in> set (map root_unity ns)) = (0 \<in> set ns)
[PROOF STEP]
by auto


[STATEMENT]
lemma product_nodes_finite[intro]:
      assumes "finite (a.nodes A)" "finite (b.nodes B)"
      shows "finite (c.nodes (product A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (c.nodes' (product A B))
[PROOF STEP]
using finite_subset product_nodes assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
c.nodes' (product ?A ?B) \<subseteq> a.nodes' ?A \<times> b.nodes' ?B
finite (a.nodes' A)
finite (b.nodes' B)

goal (1 subgoal):
 1. finite (c.nodes' (product A B))
[PROOF STEP]
by blast


[STATEMENT]
lemma cindex_poly_ubd_eventually:
  shows "\<forall>\<^sub>F r in at_top. cindexE (-r) r (\<lambda>x. poly q x/poly p x) = of_int (cindex_poly_ubd q p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
define f where "f=(\<lambda>x. poly q x/poly p x)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. poly q x / poly p x)

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
obtain R where R_def: "R>0" "proots p \<subseteq> {-R<..<R}"
    if "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "p=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p = 0\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p = 0\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that[of 1]
[PROOF STATE]
proof (prove)
using this:
p = 0
\<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < 1; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- 1<..<1}\<rbrakk> \<Longrightarrow> thesis

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

goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have "finite (proots p)"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

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

goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
from finite_ball_include[OF this,of 0]
[PROOF STATE]
proof (chain)
picking this:
\<exists>e>0. proots p \<subseteq> ball 0 e
[PROOF STEP]
obtain r where "r>0" and r_ball:"proots p \<subseteq> ball 0 r"
[PROOF STATE]
proof (prove)
using this:
\<exists>e>0. proots p \<subseteq> ball 0 e

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; proots p \<subseteq> ball 0 r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < r
proots p \<subseteq> ball 0 r

goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "proots p \<subseteq> {-r<..<r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots p \<subseteq> {- r<..<r}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> proots p \<Longrightarrow> x \<in> {- r<..<r}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> proots p \<Longrightarrow> x \<in> {- r<..<r}
[PROOF STEP]
assume "x \<in> proots p"
[PROOF STATE]
proof (state)
this:
x \<in> proots p

goal (1 subgoal):
 1. \<And>x. x \<in> proots p \<Longrightarrow> x \<in> {- r<..<r}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> proots p
[PROOF STEP]
have "x\<in>ball 0 r"
[PROOF STATE]
proof (prove)
using this:
x \<in> proots p

goal (1 subgoal):
 1. x \<in> ball 0 r
[PROOF STEP]
using r_ball
[PROOF STATE]
proof (prove)
using this:
x \<in> proots p
proots p \<subseteq> ball 0 r

goal (1 subgoal):
 1. x \<in> ball 0 r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> ball 0 r

goal (1 subgoal):
 1. \<And>x. x \<in> proots p \<Longrightarrow> x \<in> {- r<..<r}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> ball 0 r
[PROOF STEP]
have "abs x<r"
[PROOF STATE]
proof (prove)
using this:
x \<in> ball 0 r

goal (1 subgoal):
 1. \<bar>x\<bar> < r
[PROOF STEP]
using mem_ball_0
[PROOF STATE]
proof (prove)
using this:
x \<in> ball 0 r
(?x \<in> ball (0::?'a) ?e) = (norm ?x < ?e)

goal (1 subgoal):
 1. \<bar>x\<bar> < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<And>x. x \<in> proots p \<Longrightarrow> x \<in> {- r<..<r}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < r
[PROOF STEP]
show "x \<in> {- r<..<r}"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < r

goal (1 subgoal):
 1. x \<in> {- r<..<r}
[PROOF STEP]
using \<open>r>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < r
0 < r

goal (1 subgoal):
 1. x \<in> {- r<..<r}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {- r<..<r}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots p \<subseteq> {- r<..<r}

goal (1 subgoal):
 1. \<lbrakk>\<And>R. \<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < R; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}\<rbrakk> \<Longrightarrow> thesis; p \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots p \<subseteq> {- r<..<r}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots p \<subseteq> {- r<..<r}

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that[of r] False \<open>r>0\<close>
[PROOF STATE]
proof (prove)
using this:
proots p \<subseteq> {- r<..<r}
\<lbrakk>p \<noteq> 0 \<Longrightarrow> 0 < r; p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- r<..<r}\<rbrakk> \<Longrightarrow> thesis
p \<noteq> 0
0 < r

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<noteq> 0 \<Longrightarrow> 0 < R
p \<noteq> 0 \<Longrightarrow> proots p \<subseteq> {- R<..<R}

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
define l where "l=(if p=0  then 0 else cindex_poly (-R) R q p)"
[PROOF STATE]
proof (state)
this:
l = (if p = 0 then 0 else cindex_poly (- R) R q p)

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
define P where "P=(\<lambda>l. (\<forall>\<^sub>F r in at_top. cindexE (-r) r f = of_int l))"
[PROOF STATE]
proof (state)
this:
P = (\<lambda>l. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l)

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
have "P l "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P l
[PROOF STEP]
proof (cases "p=0 ")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> P l
 2. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> P l
 2. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. P l
[PROOF STEP]
unfolding P_def f_def l_def
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (if p = 0 then 0 else cindex_poly (- R) R q p)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
p = 0
p = 0

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (if p = 0 then 0 else cindex_poly (- R) R q p)
[PROOF STEP]
by (auto intro!: eventuallyI cindexE_constI)
[PROOF STATE]
proof (state)
this:
P l

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
have "P l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P l
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l
[PROOF STEP]
proof (rule eventually_at_top_linorderI[of R])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
fix r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
assume "R \<le> r"
[PROOF STATE]
proof (state)
this:
R \<le> r

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
R \<le> r
[PROOF STEP]
have "cindexE (- r) r f =  cindex_polyE (-r) r q p"
[PROOF STATE]
proof (prove)
using this:
R \<le> r

goal (1 subgoal):
 1. cindexE (- r) r f = cindex_polyE (- r) r q p
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
R \<le> r

goal (1 subgoal):
 1. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = cindex_polyE (- r) r q p
[PROOF STEP]
using R_def[OF \<open>p\<noteq>0\<close>]
[PROOF STATE]
proof (prove)
using this:
R \<le> r
0 < R
proots p \<subseteq> {- R<..<R}

goal (1 subgoal):
 1. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = cindex_polyE (- r) r q p
[PROOF STEP]
by (auto intro: cindexE_eq_cindex_polyE)
[PROOF STATE]
proof (state)
this:
cindexE (- r) r f = cindex_polyE (- r) r q p

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cindexE (- r) r f = cindex_polyE (- r) r q p

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
have "... = of_int (cindex_poly (- r) r q p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
have "jumpF_polyR q p (- r) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyR q p (- r) = 0
[PROOF STEP]
apply (rule jumpF_poly_noroot)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p (- r) \<noteq> 0
[PROOF STEP]
using \<open>R\<le>r\<close> R_def[OF \<open>p\<noteq>0\<close>]
[PROOF STATE]
proof (prove)
using this:
R \<le> r
0 < R
proots p \<subseteq> {- R<..<R}

goal (1 subgoal):
 1. poly p (- r) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyR q p (- r) = 0

goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
jumpF_polyR q p (- r) = 0

goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
have "jumpF_polyL q p r = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyL q p r = 0
[PROOF STEP]
apply (rule jumpF_poly_noroot)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p r \<noteq> 0
[PROOF STEP]
using \<open>R\<le>r\<close> R_def[OF \<open>p\<noteq>0\<close>]
[PROOF STATE]
proof (prove)
using this:
R \<le> r
0 < R
proots p \<subseteq> {- R<..<R}

goal (1 subgoal):
 1. poly p r \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p r = 0

goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
jumpF_polyR q p (- r) = 0
jumpF_polyL q p r = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF_polyR q p (- r) = 0
jumpF_polyL q p r = 0

goal (1 subgoal):
 1. cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
unfolding cindex_polyE_def
[PROOF STATE]
proof (prove)
using this:
jumpF_polyR q p (- r) = 0
jumpF_polyL q p r = 0

goal (1 subgoal):
 1. jumpF_polyR q p (- r) + real_of_int (cindex_poly (- r) r q p) - jumpF_polyL q p r = real_of_int (cindex_poly (- r) r q p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cindex_polyE (- r) r q p = real_of_int (cindex_poly (- r) r q p)

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
have "... = of_int (cindex_poly (- R) R q p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
define rs where "rs={x. poly p x = 0 \<and> - r < x \<and> x < r}"
[PROOF STATE]
proof (state)
this:
rs = {x. poly p x = 0 \<and> - r < x \<and> x < r}

goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
define Rs where "Rs={x. poly p x = 0 \<and> - R < x \<and> x < R}"
[PROOF STATE]
proof (state)
this:
Rs = {x. poly p x = 0 \<and> - R < x \<and> x < R}

goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
have "rs=Rs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rs = Rs
[PROOF STEP]
using R_def[OF \<open>p\<noteq>0\<close>] \<open>R\<le>r\<close>
[PROOF STATE]
proof (prove)
using this:
0 < R
proots p \<subseteq> {- R<..<R}
R \<le> r

goal (1 subgoal):
 1. rs = Rs
[PROOF STEP]
unfolding rs_def Rs_def
[PROOF STATE]
proof (prove)
using this:
0 < R
proots p \<subseteq> {- R<..<R}
R \<le> r

goal (1 subgoal):
 1. {x. poly p x = 0 \<and> - r < x \<and> x < r} = {x. poly p x = 0 \<and> - R < x \<and> x < R}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
rs = Rs

goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rs = Rs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rs = Rs

goal (1 subgoal):
 1. real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)
[PROOF STEP]
unfolding cindex_poly_def
[PROOF STATE]
proof (prove)
using this:
rs = Rs

goal (1 subgoal):
 1. real_of_int (\<Sum>x | poly p x = 0 \<and> - r < x \<and> x < r. jump_poly q p x) = real_of_int (\<Sum>x | poly p x = 0 \<and> - R < x \<and> x < R. jump_poly q p x)
[PROOF STEP]
by (fold rs_def Rs_def,auto)
[PROOF STATE]
proof (state)
this:
real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (cindex_poly (- r) r q p) = real_of_int (cindex_poly (- R) R q p)

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
have "... = of_int l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (cindex_poly (- R) R q p) = real_of_int l
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (cindex_poly (- R) R q p) = real_of_int (if p = 0 then 0 else cindex_poly (- R) R q p)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. real_of_int (cindex_poly (- R) R q p) = real_of_int (if p = 0 then 0 else cindex_poly (- R) R q p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int (cindex_poly (- R) R q p) = real_of_int l

goal (1 subgoal):
 1. \<And>x. R \<le> x \<Longrightarrow> cindexE (- x) x f = real_of_int l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cindexE (- r) r f = real_of_int l
[PROOF STEP]
show "cindexE (- r) r f = real_of_int l"
[PROOF STATE]
proof (prove)
using this:
cindexE (- r) r f = real_of_int l

goal (1 subgoal):
 1. cindexE (- r) r f = real_of_int l
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cindexE (- r) r f = real_of_int l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P l

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> P l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P l

goal (1 subgoal):
 1. P l
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
have "x=l" when "P x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = l
[PROOF STEP]
have "\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x"
         "\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x &&& \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l
[PROOF STEP]
using \<open>P x\<close> \<open>P l\<close>
[PROOF STATE]
proof (prove)
using this:
P x
P l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x &&& \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x
\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x &&& \<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int x
\<forall>\<^sub>F r in at_top. cindexE (- r) r f = real_of_int l

goal (1 subgoal):
 1. x = l
[PROOF STEP]
from eventually_conj[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F xa in at_top. cindexE (- xa) xa f = real_of_int x \<and> cindexE (- xa) xa f = real_of_int l
[PROOF STEP]
have "\<forall>\<^sub>F r::real in at_top. real_of_int x = real_of_int l"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F xa in at_top. cindexE (- xa) xa f = real_of_int x \<and> cindexE (- xa) xa f = real_of_int l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. real_of_int x = real_of_int l
[PROOF STEP]
by (elim eventually_mono,auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F r in at_top. real_of_int x = real_of_int l

goal (1 subgoal):
 1. x = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F r in at_top. real_of_int x = real_of_int l
[PROOF STEP]
have "real_of_int x = real_of_int l"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F r in at_top. real_of_int x = real_of_int l

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

goal (1 subgoal):
 1. x = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int x = real_of_int l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int x = real_of_int l

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P ?x \<Longrightarrow> ?x = l

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P l
P ?x \<Longrightarrow> ?x = l
[PROOF STEP]
have "P (THE x. P x)"
[PROOF STATE]
proof (prove)
using this:
P l
P ?x \<Longrightarrow> ?x = l

goal (1 subgoal):
 1. P (THE x. P x)
[PROOF STEP]
using theI[of P l]
[PROOF STATE]
proof (prove)
using this:
P l
P ?x \<Longrightarrow> ?x = l
\<lbrakk>P l; \<And>x. P x \<Longrightarrow> x = l\<rbrakk> \<Longrightarrow> P (THE x. P x)

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

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P (THE x. P x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P (THE x. P x)

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)
[PROOF STEP]
unfolding P_def f_def cindex_poly_ubd_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (THE x. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int x)

goal (1 subgoal):
 1. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (THE l. \<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F r in at_top. cindexE (- r) r (\<lambda>x. poly q x / poly p x) = real_of_int (cindex_poly_ubd q p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma residual_assoc: "x \<rightarrow> (y \<leftarrow> z) = (x \<rightarrow> y) \<leftarrow> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<rightarrow> y \<leftarrow> z = x \<rightarrow> y \<leftarrow> z
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z
 2. x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z
[PROOF STEP]
show "x \<rightarrow> (y \<leftarrow> z) \<le> (x \<rightarrow> y) \<leftarrow> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z
[PROOF STEP]
by (metis local.res_ri1 local.resl_galois local.resr_galois mult_assoc)
[PROOF STATE]
proof (state)
this:
x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z

goal (1 subgoal):
 1. x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z
[PROOF STEP]
show "(x \<rightarrow> y) \<leftarrow> z \<le> x \<rightarrow> (y \<leftarrow> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z
[PROOF STEP]
by (metis local.res_li1 local.resl_galois local.resr_galois mult_assoc)
[PROOF STATE]
proof (state)
this:
x \<rightarrow> y \<leftarrow> z \<le> x \<rightarrow> y \<leftarrow> z

goal:
No subgoals!
[PROOF STEP]
qed