[STATEMENT]
lemma remove_insort_commute: "\<lbrakk> a \<noteq> b; sorted xs \<rbrakk> \<Longrightarrow> remove b (insort a xs) = insort a (remove b xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> b; sorted xs\<rbrakk> \<Longrightarrow> remove b (insort a xs) = insort a (remove b xs)
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<noteq> b; sorted []\<rbrakk> \<Longrightarrow> remove b (insort a []) = insort a (remove b [])
 2. \<And>aa xs. \<lbrakk>\<lbrakk>a \<noteq> b; sorted xs\<rbrakk> \<Longrightarrow> remove b (insort a xs) = insort a (remove b xs); a \<noteq> b; sorted (aa # xs)\<rbrakk> \<Longrightarrow> remove b (insort a (aa # xs)) = insort a (remove b (aa # xs))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>remove b (insort a xs) = insort a (remove b xs); a \<noteq> b; \<forall>x\<in>set xs. b \<le> x; sorted xs; a < b; a \<le> b\<rbrakk> \<Longrightarrow> a # xs = insort a xs
[PROOF STEP]
apply (case_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>remove b (insort a xs) = insort a (remove b xs); a \<noteq> b; \<forall>x\<in>set xs. b \<le> x; sorted xs; a < b; a \<le> b; xs = []\<rbrakk> \<Longrightarrow> a # xs = insort a xs
 2. \<And>xs aa list. \<lbrakk>remove b (insort a xs) = insort a (remove b xs); a \<noteq> b; \<forall>x\<in>set xs. b \<le> x; sorted xs; a < b; a \<le> b; xs = aa # list\<rbrakk> \<Longrightarrow> a # xs = insort a xs
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma conjuncts_qf: "qfree p \<Longrightarrow> \<forall> q\<in> set (conjuncts p). qfree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qfree p \<Longrightarrow> \<forall>q\<in>set (conjuncts p). qfree q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. qfree p \<Longrightarrow> \<forall>q\<in>set (conjuncts p). qfree q
[PROOF STEP]
assume qf: "qfree p"
[PROOF STATE]
proof (state)
this:
qfree p

goal (1 subgoal):
 1. qfree p \<Longrightarrow> \<forall>q\<in>set (conjuncts p). qfree q
[PROOF STEP]
hence "list_all qfree (conjuncts p)"
[PROOF STATE]
proof (prove)
using this:
qfree p

goal (1 subgoal):
 1. list_all qfree (conjuncts p)
[PROOF STEP]
by (induct p rule: conjuncts.induct, auto)
[PROOF STATE]
proof (state)
this:
list_all qfree (conjuncts p)

goal (1 subgoal):
 1. qfree p \<Longrightarrow> \<forall>q\<in>set (conjuncts p). qfree q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all qfree (conjuncts p)

goal (1 subgoal):
 1. \<forall>q\<in>set (conjuncts p). qfree q
[PROOF STEP]
by (simp only: list_all_iff)
[PROOF STATE]
proof (state)
this:
\<forall>q\<in>set (conjuncts p). qfree q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fract_cases_coprime [cases type: fract]:
  fixes q :: "'a :: factorial_ring_gcd fract"
  obtains (Fract) a b where "q = Fract a b" "b \<noteq> 0" "coprime a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain a b where q: "q = Fract a b" and b0: "b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases q, auto)
[PROOF STATE]
proof (state)
this:
q = Fraction_Field.Fract a b
b \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define g where g: "g = gcd a b"
[PROOF STATE]
proof (state)
this:
g = gcd a b

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define A where A: "A = a div g"
[PROOF STATE]
proof (state)
this:
A = a div g

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define B where B: "B = b div g"
[PROOF STATE]
proof (state)
this:
B = b div g

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have a: "a = A * g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = A * g
[PROOF STEP]
unfolding A g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = a div gcd a b * gcd a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = A * g

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have b: "b = B * g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = B * g
[PROOF STEP]
unfolding B g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = b div gcd a b * gcd a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b = B * g

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from b0 b
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
b = B * g
[PROOF STEP]
have 0: "B \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
b = B * g

goal (1 subgoal):
 1. B \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have q: "q = Fract A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = Fraction_Field.Fract A B
[PROOF STEP]
unfolding q a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fraction_Field.Fract (A * g) (B * g) = Fraction_Field.Fract A B
[PROOF STEP]
by (subst eq_fract, auto simp: b0 0 g)
[PROOF STATE]
proof (state)
this:
q = Fraction_Field.Fract A B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have cop: "coprime A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime A B
[PROOF STEP]
unfolding A B g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (a div gcd a b) (b div gcd a b)
[PROOF STEP]
using b0
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. coprime (a div gcd a b) (b div gcd a b)
[PROOF STEP]
by (simp add: div_gcd_coprime)
[PROOF STATE]
proof (state)
this:
coprime A B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
assume "\<And>a b. q = Fract a b \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> coprime a b \<Longrightarrow> thesis"
[PROOF STATE]
proof (state)
this:
\<lbrakk>q = Fraction_Field.Fract ?a ?b; ?b \<noteq> (0::'a); coprime ?a ?b\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = Fraction_Field.Fract a b; b \<noteq> (0::'a); coprime a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from this[OF q 0 cop]
[PROOF STATE]
proof (chain)
picking this:
thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group_action) stabilizer_one_closed:
  assumes "x \<in> E"
  shows "\<one> \<in> (stabilizer G \<phi> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<in> stabilizer G \<phi> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<one> \<in> stabilizer G \<phi> x
[PROOF STEP]
have "\<phi> \<one> x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> \<one> x = x
[PROOF STEP]
by (metis assms id_eq_one restrict_apply')
[PROOF STATE]
proof (state)
this:
\<phi> \<one> x = x

goal (1 subgoal):
 1. \<one> \<in> stabilizer G \<phi> x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<phi> \<one> x = x

goal (1 subgoal):
 1. \<one> \<in> stabilizer G \<phi> x
[PROOF STEP]
using group_def group_hom group_hom.axioms(1) stabilizer_def
[PROOF STATE]
proof (prove)
using this:
\<phi> \<one> x = x
Group.group ?G \<equiv> Group.monoid ?G \<and> Group.group_axioms ?G
group_hom G (BijGroup E) \<phi>
group_hom ?G ?H ?h \<Longrightarrow> Group.group ?G
stabilizer ?G ?\<phi> ?x = {g \<in> carrier ?G. ?\<phi> g ?x = ?x}

goal (1 subgoal):
 1. \<one> \<in> stabilizer G \<phi> x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<one> \<in> stabilizer G \<phi> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_nat_add: "x < z \<Longrightarrow> y < z \<Longrightarrow> (x + y) mod z = (if x + y < z then x + y else x + y - z)"
  for x y z :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < z; y < z\<rbrakk> \<Longrightarrow> (x + y) mod z = (if x + y < z then x + y else x + y - z)
[PROOF STEP]
apply (rule nat_mod_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x < z; y < z\<rbrakk> \<Longrightarrow> (if x + y < z then x + y else x + y - z) < z
 2. \<lbrakk>x < z; y < z\<rbrakk> \<Longrightarrow> (x + y) mod z = (if x + y < z then x + y else x + y - z) mod z
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> (x + y) mod z = x + y - z
[PROOF STEP]
apply (rule trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> (x + y) mod z = ?s56
 2. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> ?s56 = x + y - z
[PROOF STEP]
apply (rule le_mod_geq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> z \<le> x + y
 2. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> (x + y - z) mod z = x + y - z
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> (x + y - z) mod z = x + y - z
[PROOF STEP]
apply (rule nat_mod_eq')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < z; y < z; \<not> x + y < z\<rbrakk> \<Longrightarrow> x + y - z < z
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_nth_append3:
assumes h1:"\<not> i < Suc (length x)"
       and "i - Suc (length x) < Suc (length y)"
shows "(a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
 2. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
assume "i=0"
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
 2. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
with h1
[PROOF STATE]
proof (chain)
picking this:
\<not> i < Suc (length x)
i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> i < Suc (length x)
i = 0

goal (1 subgoal):
 1. (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
by (simp add: nth_append)
[PROOF STATE]
proof (state)
this:
(a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
fix ii
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
assume "i = Suc ii"
[PROOF STATE]
proof (state)
this:
i = Suc ii

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
with h1
[PROOF STATE]
proof (chain)
picking this:
\<not> i < Suc (length x)
i = Suc ii
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> i < Suc (length x)
i = Suc ii

goal (1 subgoal):
 1. (a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i
[PROOF STEP]
by (simp add: nth_append)
[PROOF STATE]
proof (state)
this:
(a # y) ! (i - Suc (length x)) = (b # x @ a # y) ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma leftmost_strategy_is_reduction_strategy:
    shows "reduction_strategy leftmost_strategy"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduction_strategy leftmost_strategy
[PROOF STEP]
proof (unfold reduction_strategy_def, intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. Ide t \<Longrightarrow> Arr (leftmost_strategy t) \<and> Arr t \<and> Src (leftmost_strategy t) = Src t
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. Ide t \<Longrightarrow> Arr (leftmost_strategy t) \<and> Arr t \<and> Src (leftmost_strategy t) = Src t
[PROOF STEP]
show "Ide t \<Longrightarrow> Coinitial (leftmost_strategy t) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ide t \<Longrightarrow> Arr (leftmost_strategy t) \<and> Arr t \<and> Src (leftmost_strategy t) = Src t
[PROOF STEP]
proof (induct t, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>Arr (leftmost_strategy t1); Arr (leftmost_strategy t2); Ide t1; Ide t2; Arr t1; Src (leftmost_strategy t1) = Src t1; Arr t2; Src (leftmost_strategy t2) = Src t2\<rbrakk> \<Longrightarrow> Arr (leftmost_strategy (t1 \<^bold>\<circ> t2))
[PROOF STEP]
show "\<And>t2. \<lbrakk>Arr (leftmost_strategy t1); Arr (leftmost_strategy t2);
                    Ide t1; Ide t2;
                    Arr t1; Src (leftmost_strategy t1) = Src t1;
                    Arr t2; Src (leftmost_strategy t2) = Src t2\<rbrakk>
                      \<Longrightarrow> Arr (leftmost_strategy (t1 \<^bold>\<circ> t2))"
              for t1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t2. \<lbrakk>Arr (leftmost_strategy t1); Arr (leftmost_strategy t2); Ide t1; Ide t2; Arr t1; Src (leftmost_strategy t1) = Src t1; Arr t2; Src (leftmost_strategy t2) = Src t2\<rbrakk> \<Longrightarrow> Arr (leftmost_strategy (t1 \<^bold>\<circ> t2))
[PROOF STEP]
by (cases t1) auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>Arr (leftmost_strategy ?t1.1); Arr (leftmost_strategy ?t2.0); Ide ?t1.1; Ide ?t2.0; Arr ?t1.1; Src (leftmost_strategy ?t1.1) = Src ?t1.1; Arr ?t2.0; Src (leftmost_strategy ?t2.0) = Src ?t2.0\<rbrakk> \<Longrightarrow> Arr (leftmost_strategy (?t1.1 \<^bold>\<circ> ?t2.0))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Ide t \<Longrightarrow> Arr (leftmost_strategy t) \<and> Arr t \<and> Src (leftmost_strategy t) = Src t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proj2_intersection_incident:
  shows "proj2_incident (proj2_intersection l m) l"
  and "proj2_incident (proj2_intersection l m) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_incident (proj2_intersection l m) l &&& proj2_incident (proj2_intersection l m) m
[PROOF STEP]
using proj2_line_through_incident(1) [of "L2P l" "L2P m"]
    and proj2_line_through_incident(2) [of "L2P m" "L2P l"]
    and proj2_incident_switch [of "L2P l"]
    and proj2_incident_switch [of "L2P m"]
[PROOF STATE]
proof (prove)
using this:
proj2_incident (L2P l) (proj2_line_through (L2P l) (L2P m))
proj2_incident (L2P m) (proj2_line_through (L2P l) (L2P m))
proj2_incident (L2P l) ?l \<Longrightarrow> proj2_incident (L2P ?l) (P2L (L2P l))
proj2_incident (L2P m) ?l \<Longrightarrow> proj2_incident (L2P ?l) (P2L (L2P m))

goal (1 subgoal):
 1. proj2_incident (proj2_intersection l m) l &&& proj2_incident (proj2_intersection l m) m
[PROOF STEP]
unfolding proj2_intersection_def
[PROOF STATE]
proof (prove)
using this:
proj2_incident (L2P l) (proj2_line_through (L2P l) (L2P m))
proj2_incident (L2P m) (proj2_line_through (L2P l) (L2P m))
proj2_incident (L2P l) ?l \<Longrightarrow> proj2_incident (L2P ?l) (P2L (L2P l))
proj2_incident (L2P m) ?l \<Longrightarrow> proj2_incident (L2P ?l) (P2L (L2P m))

goal (1 subgoal):
 1. proj2_incident (L2P (proj2_line_through (L2P l) (L2P m))) l &&& proj2_incident (L2P (proj2_line_through (L2P l) (L2P m))) m
[PROOF STEP]
by simp_all


[STATEMENT]
lemma bound_of_const[simp, intro]:
  "bound_of (\<lambda>x. c) = (c::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound_of (\<lambda>x. c) = c
[PROOF STEP]
unfolding bound_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP x. c) = c
[PROOF STEP]
by(intro antisym cSup_least cSup_upper bounded_bdd_above bounded_const, auto)


[STATEMENT]
lemma subgroup_transitive [trans]:
  assumes "subgroup K H composition unit"
    and "subgroup H G composition unit"
  shows "subgroup K G composition unit"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup K G composition unit
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subgroup K G composition unit
[PROOF STEP]
interpret K: subgroup K H composition unit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup K H composition unit
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subgroup K G composition unit
[PROOF STEP]
interpret H: subgroup H G composition unit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup H G composition unit
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subgroup K G composition unit
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup K G composition unit
[PROOF STEP]
by unfold_locales auto
[PROOF STATE]
proof (state)
this:
subgroup K G composition unit

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_to_poly_vec_times:
  assumes "distinct ts" and "length ts = dim_col A"
  shows "row_to_poly ts (v \<^sub>v* A) = ((\<Sum>i=0..<dim_row A. (v $ i) \<cdot> (row_to_poly ts (row A i)))::'t \<Rightarrow>\<^sub>0 'b::comm_semiring_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_to_poly ts (v \<^sub>v* A) = (\<Sum>i = 0..<dim_row A. v $ i \<cdot> row_to_poly ts (row A i))
[PROOF STEP]
proof (simp add: mult_vec_mat_def scalar_prod_def row_to_poly_vec_sum[OF assms], rule sum.cong, rule)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
assume "i \<in> {0..<dim_row A}"
[PROOF STATE]
proof (state)
this:
i \<in> {0..<dim_row A}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
hence "i < dim_row A"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<dim_row A}

goal (1 subgoal):
 1. i < dim_row A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < dim_row A

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
have "dim_vec (row A i) = length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (row A i) = length ts
[PROOF STEP]
by (simp add: assms(2))
[PROOF STATE]
proof (state)
this:
dim_vec (row A i) = length ts

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
have *: "vec (dim_col A) (\<lambda>j. col A j $ i) = vec (dim_col A) (\<lambda>j. A $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_col A) (\<lambda>j. col A j $ i) = vec (dim_col A) (\<lambda>j. A $$ (i, j))
[PROOF STEP]
by (rule vec_cong, rule refl, simp add: \<open>i < dim_row A\<close>)
[PROOF STATE]
proof (state)
this:
vec (dim_col A) (\<lambda>j. col A j $ i) = vec (dim_col A) (\<lambda>j. A $$ (i, j))

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
have "vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i)
[PROOF STEP]
by (simp only: vec_scalar_mult_fun)
[PROOF STATE]
proof (state)
this:
vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i)

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i)

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
have "... = v $ i \<cdot>\<^sub>v (row A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i) = v $ i \<cdot>\<^sub>v row A i
[PROOF STEP]
by (simp only: * row_def[symmetric])
[PROOF STATE]
proof (state)
this:
v $ i \<cdot>\<^sub>v vec (dim_col A) (\<lambda>j. col A j $ i) = v $ i \<cdot>\<^sub>v row A i

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_row A} \<Longrightarrow> row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ x * col A j $ x)) = v $ x \<cdot> row_to_poly ts (row A x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v row A i
[PROOF STEP]
show "row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ i * col A j $ i)) =
                  (v $ i) \<cdot> (row_to_poly ts (row A i))"
[PROOF STATE]
proof (prove)
using this:
vec (dim_col A) (\<lambda>j. v $ i * col A j $ i) = v $ i \<cdot>\<^sub>v row A i

goal (1 subgoal):
 1. row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ i * col A j $ i)) = v $ i \<cdot> row_to_poly ts (row A i)
[PROOF STEP]
by (simp add: row_to_poly_smult[OF assms(1) \<open>dim_vec (row A i) = length ts\<close>])
[PROOF STATE]
proof (state)
this:
row_to_poly ts (vec (dim_col A) (\<lambda>j. v $ i * col A j $ i)) = v $ i \<cdot> row_to_poly ts (row A i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fractrel_normalize_quot:
  "fractrel p p \<Longrightarrow> fractrel q q \<Longrightarrow>
     fractrel (normalize_quot p) (normalize_quot q) \<longleftrightarrow> fractrel p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fractrel p p; fractrel q q\<rbrakk> \<Longrightarrow> fractrel (normalize_quot p) (normalize_quot q) = fractrel p q
[PROOF STEP]
by (subst fractrel_normalize_quot_left fractrel_normalize_quot_right, simp)+ (rule refl)


[STATEMENT]
lemma is_le_rel_trans_le_left:
  assumes "is_le_rel rel"
  shows "x \<le> y \<Longrightarrow> rel y z \<Longrightarrow> x \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; rel y z\<rbrakk> \<Longrightarrow> x \<le> z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_le_rel rel

goal (1 subgoal):
 1. \<lbrakk>x \<le> y; rel y z\<rbrakk> \<Longrightarrow> x \<le> z
[PROOF STEP]
by (rule is_le_relE, auto dest: order_trans le_less_trans less_imp_le)


[STATEMENT]
lemma euler_mascheroni_convergent: "convergent (\<lambda>n. harm n - ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. harm n - ln (real n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent (\<lambda>n. harm n - ln (real n))
[PROOF STEP]
have "harm (Suc n) - ln (real (Suc n)) \<ge> 0" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
using euler_mascheroni_sequence_nonneg[of "Suc n"]
[PROOF STATE]
proof (prove)
using this:
0 < Suc n \<Longrightarrow> 0 \<le> harm (Suc n) - ln (real (Suc n))

goal (1 subgoal):
 1. 0 \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> harm (Suc ?n) - ln (real (Suc ?n))

goal (1 subgoal):
 1. convergent (\<lambda>n. harm n - ln (real n))
[PROOF STEP]
hence "convergent (\<lambda>n. harm (Suc n) - ln (Suc n))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> harm (Suc ?n) - ln (real (Suc ?n))

goal (1 subgoal):
 1. convergent (\<lambda>n. harm (Suc n) - ln (real (Suc n)))
[PROOF STEP]
by (intro Bseq_monoseq_convergent decseq_bounded[of _ 0] decseq_harm_diff_ln decseq_imp_monoseq)
       auto
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. harm (Suc n) - ln (real (Suc n)))

goal (1 subgoal):
 1. convergent (\<lambda>n. harm n - ln (real n))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. harm (Suc n) - ln (real (Suc n)))

goal (1 subgoal):
 1. convergent (\<lambda>n. harm n - ln (real n))
[PROOF STEP]
by (subst (asm) convergent_Suc_iff)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. harm n - ln (real n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stabilizer2_sub_stabilizer:
  shows "stabilizer(stabilizer A) \<subseteq> stabilizer A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
proof(cases "A \<noteq> {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
 2. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (2 subgoals):
 1. A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
 2. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {}
[PROOF STEP]
have "stabilizer(stabilizer A) \<subseteq> differenceset (stabilizer A) (stabilizer A)"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. stabilizer (stabilizer A) \<subseteq> differenceset (stabilizer A) (stabilizer A)
[PROOF STEP]
by (simp add: stabilizer_is_nonempty stabilizer_subset_group stabilizer_subset_nempty)
[PROOF STATE]
proof (state)
this:
stabilizer (stabilizer A) \<subseteq> differenceset (stabilizer A) (stabilizer A)

goal (2 subgoals):
 1. A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
 2. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
stabilizer (stabilizer A) \<subseteq> differenceset (stabilizer A) (stabilizer A)

goal (1 subgoal):
 1. stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
using differenceset_stabilizer_eq
[PROOF STATE]
proof (prove)
using this:
stabilizer (stabilizer A) \<subseteq> differenceset (stabilizer A) (stabilizer A)
differenceset (stabilizer ?A) (stabilizer ?A) = stabilizer ?A

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

goal (1 subgoal):
 1. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> A \<noteq> {}

goal (1 subgoal):
 1. \<not> A \<noteq> {} \<Longrightarrow> stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> A \<noteq> {}

goal (1 subgoal):
 1. stabilizer (stabilizer A) \<subseteq> stabilizer A
[PROOF STEP]
by (simp add: stabilizer_empty stabilizer_subset_group)
[PROOF STATE]
proof (state)
this:
stabilizer (stabilizer A) \<subseteq> stabilizer A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unit_mult[intro]:
  assumes sP: "sound P" and bP: "bounded_by 1 P"
      and sQ: "sound Q" and bQ: "bounded_by 1 Q"
  shows "bounded_by 1 (\<lambda>s. P s * Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_by 1 (\<lambda>s. P s * Q s)
[PROOF STEP]
proof(rule bounded_byI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x * Q x \<le> 1
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. P x * Q x \<le> 1
[PROOF STEP]
have "P s * Q s \<le> 1 * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P s * Q s \<le> 1 * 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sound P
bounded_by 1 P
sound Q
bounded_by 1 Q

goal (1 subgoal):
 1. P s * Q s \<le> 1 * 1
[PROOF STEP]
by(blast dest:bounded_by_mult)
[PROOF STATE]
proof (state)
this:
P s * Q s \<le> 1 * 1

goal (1 subgoal):
 1. \<And>x. P x * Q x \<le> 1
[PROOF STEP]
thus "P s * Q s \<le> 1"
[PROOF STATE]
proof (prove)
using this:
P s * Q s \<le> 1 * 1

goal (1 subgoal):
 1. P s * Q s \<le> 1
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
P s * Q s \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_minus_divide_le_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> a * c \<le> - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> (- (b / c) \<le> a) = (a * c \<le> - b)
[PROOF STEP]
unfolding minus_divide_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> (- b / c \<le> a) = (a * c \<le> - b)
[PROOF STEP]
by (rule neg_divide_le_eq)


[STATEMENT]
lemma funpow_dist_0:
  assumes "x = y" shows "funpow_dist f x y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. funpow_dist f x y = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. funpow_dist f x y = 0
[PROOF STEP]
unfolding funpow_dist_def
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. (LEAST n. (f ^^ n) x = y) = 0
[PROOF STEP]
by (intro Least_eq_0) simp


[STATEMENT]
lemma (in group) IDirProd_is_subgroup:
  assumes "Y \<subseteq> carrier G" "Z \<subseteq> carrier G"
  shows "subgroup (IDirProd G Y Z) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (IDirProd G Y Z) G
[PROOF STEP]
unfolding IDirProd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (generate G (Y \<union> Z)) G
[PROOF STEP]
using generate_is_subgroup[of "Y \<union> Z"] assms
[PROOF STATE]
proof (prove)
using this:
Y \<union> Z \<subseteq> carrier G \<Longrightarrow> subgroup (generate G (Y \<union> Z)) G
Y \<subseteq> carrier G
Z \<subseteq> carrier G

goal (1 subgoal):
 1. subgroup (generate G (Y \<union> Z)) G
[PROOF STEP]
by simp


[STATEMENT]
lemma wqo_extensions_wf_conv:
  assumes "qo_on P A"
  shows "wqo_on P A \<longleftrightarrow> (\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wqo_on P A = (\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A)
[PROOF STEP]
unfolding wqo_af_conv [OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_full_on P A = (\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A)
[PROOF STEP]
using af_trans_imp_wf [OF _ assms [THEN qo_on_imp_transp_on]]
    and almost_full_on_imp_no_antichain_on [of P A]
    and wf_and_no_antichain_imp_qo_extension_wf [of P A]
    and every_qo_extension_wf_imp_af [OF _ assms]
[PROOF STATE]
proof (prove)
using this:
almost_full_on P A \<Longrightarrow> wfp_on (strict P) A
almost_full_on P A \<Longrightarrow> \<not> antichain_on P ?f A
\<lbrakk>wfp_on (strict P) A; \<nexists>f. antichain_on P f A; \<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> ?Q x y; qo_on ?Q A\<rbrakk> \<Longrightarrow> wfp_on (strict ?Q) A
\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A \<Longrightarrow> almost_full_on P A

goal (1 subgoal):
 1. almost_full_on P A = (\<forall>Q. (\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q x y) \<and> qo_on Q A \<longrightarrow> wfp_on (strict Q) A)
[PROOF STEP]
by blast


[STATEMENT]
lemma prime_elem_not_unit' [simp]:
  "ASSUMPTION (prime_elem x) \<Longrightarrow> \<not>is_unit x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ASSUMPTION (prime_elem x) \<Longrightarrow> \<not> is_unit x
[PROOF STEP]
unfolding ASSUMPTION_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem x \<Longrightarrow> \<not> is_unit x
[PROOF STEP]
by (rule prime_elem_not_unit)


[STATEMENT]
lemma mult_scalar_not_zero:
  assumes "p \<noteq> 0" and "q \<noteq> (0::'t \<Rightarrow>\<^sub>0 'b::semiring_no_zero_divisors)"
  shows "p \<odot> q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<odot> q \<noteq> 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
assume "p \<odot> q = 0"
[PROOF STATE]
proof (state)
this:
p \<odot> q = 0

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
hence "0 = lc (p \<odot> q)"
[PROOF STATE]
proof (prove)
using this:
p \<odot> q = 0

goal (1 subgoal):
 1. (0::'b) = lc (p \<odot> q)
[PROOF STEP]
by (simp add: lc_def)
[PROOF STATE]
proof (state)
this:
(0::'b) = lc (p \<odot> q)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::'b) = lc (p \<odot> q)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
have "... = punit.lc p * lc q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (p \<odot> q) = punit.lc p * lc q
[PROOF STEP]
by (rule lc_mult_scalar)
[PROOF STATE]
proof (state)
this:
lc (p \<odot> q) = punit.lc p * lc q

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'b) = punit.lc p * lc q
[PROOF STEP]
have "punit.lc p * lc q = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'b) = punit.lc p * lc q

goal (1 subgoal):
 1. punit.lc p * lc q = (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
punit.lc p * lc q = (0::'b)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
punit.lc p * lc q = (0::'b)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have "punit.lc p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. punit.lc p \<noteq> (0::'b)
[PROOF STEP]
by (rule punit.lc_not_0)
[PROOF STATE]
proof (state)
this:
punit.lc p \<noteq> (0::'b)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
punit.lc p \<noteq> (0::'b)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
[PROOF STEP]
have "lc q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. lc q \<noteq> (0::'b)
[PROOF STEP]
by (rule lc_not_0)
[PROOF STATE]
proof (state)
this:
lc q \<noteq> (0::'b)

goal (1 subgoal):
 1. p \<odot> q = 0 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
punit.lc p * lc q = (0::'b)
punit.lc p \<noteq> (0::'b)
lc q \<noteq> (0::'b)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
punit.lc p * lc q = (0::'b)
punit.lc p \<noteq> (0::'b)
lc q \<noteq> (0::'b)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma derangementsI:
  assumes "p permutes S" "\<And>x. x \<in> S \<Longrightarrow> p x \<noteq> x"
  shows "p \<in> derangements S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> derangements S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p permutes S
?x \<in> S \<Longrightarrow> p ?x \<noteq> ?x

goal (1 subgoal):
 1. p \<in> derangements S
[PROOF STEP]
unfolding derangements_def
[PROOF STATE]
proof (prove)
using this:
p permutes S
?x \<in> S \<Longrightarrow> p ?x \<noteq> ?x

goal (1 subgoal):
 1. p \<in> {p. p permutes S \<and> (\<forall>x\<in>S. p x \<noteq> x)}
[PROOF STEP]
by auto


[STATEMENT]
lemma liminf_shift_k:
  "liminf (\<lambda>n. u (n+k)) = liminf u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + k)) = liminf u
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. liminf (\<lambda>n. u (n + 0)) = liminf u
 2. \<And>k. liminf (\<lambda>n. u (n + k)) = liminf u \<Longrightarrow> liminf (\<lambda>n. u (n + Suc k)) = liminf u
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. u (n + k)) = liminf u

goal (2 subgoals):
 1. liminf (\<lambda>n. u (n + 0)) = liminf u
 2. \<And>k. liminf (\<lambda>n. u (n + k)) = liminf u \<Longrightarrow> liminf (\<lambda>n. u (n + Suc k)) = liminf u
[PROOF STEP]
have "liminf (\<lambda>n. u (n+k+1)) = liminf (\<lambda>n. u (n+k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))
[PROOF STEP]
using liminf_shift[where ?u="\<lambda>n. u(n+k)"]
[PROOF STATE]
proof (prove)
using this:
liminf (\<lambda>n. u (n + 1 + k)) = liminf (\<lambda>n. u (n + k))

goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))

goal (2 subgoals):
 1. liminf (\<lambda>n. u (n + 0)) = liminf u
 2. \<And>k. liminf (\<lambda>n. u (n + k)) = liminf u \<Longrightarrow> liminf (\<lambda>n. u (n + Suc k)) = liminf u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))

goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + Suc k)) = liminf u
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
liminf (\<lambda>n. u (n + k + 1)) = liminf (\<lambda>n. u (n + k))
liminf (\<lambda>n. u (n + k)) = liminf u

goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + Suc k)) = liminf u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. u (n + Suc k)) = liminf u

goal (1 subgoal):
 1. liminf (\<lambda>n. u (n + 0)) = liminf u
[PROOF STEP]
qed (auto)


[STATEMENT]
lemma landau_sum:
  assumes "eventually (\<lambda>x. g1 x \<ge> (0::real)) F"
  assumes "eventually (\<lambda>x. g2 x \<ge> 0) F"
  assumes "f1 \<in> O[F](g1)"
  assumes "f2 \<in> O[F](g2)"
  shows "(\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
obtain c1 where a1: "c1 > 0" and b1: "eventually (\<lambda>x. abs (f1 x) \<le> c1 * abs (g1 x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c1. \<lbrakk>0 < c1; \<forall>\<^sub>F x in F. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
f1 \<in> O[F](g1)

goal (1 subgoal):
 1. (\<And>c1. \<lbrakk>0 < c1; \<forall>\<^sub>F x in F. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add:bigo_def, blast)
[PROOF STATE]
proof (state)
this:
0 < c1
\<forall>\<^sub>F x in F. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
obtain c2 where a2: "c2 > 0" and b2: "eventually (\<lambda>x. abs (f2 x) \<le> c2 * abs (g2 x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c2. \<lbrakk>0 < c2; \<forall>\<^sub>F x in F. \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
f2 \<in> O[F](g2)

goal (1 subgoal):
 1. (\<And>c2. \<lbrakk>0 < c2; \<forall>\<^sub>F x in F. \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add:bigo_def, blast)
[PROOF STATE]
proof (state)
this:
0 < c2
\<forall>\<^sub>F x in F. \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
have "eventually (\<lambda>x. abs (f1 x + f2 x) \<le> (max c1 c2) * abs (g1 x + g2 x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
proof (rule eventually_mono[OF eventually_conj[OF b1 eventually_conj[OF b2 eventually_conj[OF assms(1,2)]]]])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
assume a: "\<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x"
[PROOF STATE]
proof (state)
this:
\<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
have "\<bar>f1 x + f2 x\<bar> \<le> \<bar>f1 x \<bar> + \<bar>f2 x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f1 x + f2 x\<bar> \<le> \<bar>f1 x\<bar> + \<bar>f2 x\<bar>
[PROOF STEP]
using abs_triangle_ineq
[PROOF STATE]
proof (prove)
using this:
\<bar>?a + ?b\<bar> \<le> \<bar>?a\<bar> + \<bar>?b\<bar>

goal (1 subgoal):
 1. \<bar>f1 x + f2 x\<bar> \<le> \<bar>f1 x\<bar> + \<bar>f2 x\<bar>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<bar>f1 x + f2 x\<bar> \<le> \<bar>f1 x\<bar> + \<bar>f2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f1 x + f2 x\<bar> \<le> \<bar>f1 x\<bar> + \<bar>f2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
have "... \<le> c1 *  \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f1 x\<bar> + \<bar>f2 x\<bar> \<le> c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar>
[PROOF STEP]
using a add_mono
[PROOF STATE]
proof (prove)
using this:
\<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x
\<lbrakk>?a \<le> ?b; ?c \<le> ?d\<rbrakk> \<Longrightarrow> ?a + ?c \<le> ?b + ?d

goal (1 subgoal):
 1. \<bar>f1 x\<bar> + \<bar>f2 x\<bar> \<le> c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<bar>f1 x\<bar> + \<bar>f2 x\<bar> \<le> c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f1 x\<bar> + \<bar>f2 x\<bar> \<le> c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
have "... \<le> max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar> \<le> max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar>
[PROOF STEP]
by (intro add_mono mult_right_mono) auto
[PROOF STATE]
proof (state)
this:
c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar> \<le> max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c1 * \<bar>g1 x\<bar> + c2 * \<bar>g2 x\<bar> \<le> max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
have "... = max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar> = max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>)
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar> = max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>)

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max c1 c2 * \<bar>g1 x\<bar> + max c1 c2 * \<bar>g2 x\<bar> = max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>)

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
have "... \<le> max c1 c2 * (\<bar>g1 x + g2 x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>) \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
using a a1 a2
[PROOF STATE]
proof (prove)
using this:
\<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x
0 < c1
0 < c2

goal (1 subgoal):
 1. max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>) \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
by (intro mult_left_mono) auto
[PROOF STATE]
proof (state)
this:
max c1 c2 * (\<bar>g1 x\<bar> + \<bar>g2 x\<bar>) \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>

goal (1 subgoal):
 1. \<And>x. \<bar>f1 x\<bar> \<le> c1 * \<bar>g1 x\<bar> \<and> \<bar>f2 x\<bar> \<le> c2 * \<bar>g2 x\<bar> \<and> 0 \<le> g1 x \<and> 0 \<le> g2 x \<Longrightarrow> \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
show "\<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>

goal (1 subgoal):
 1. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
\<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
hence " 0 < max c1 c2 \<and> (\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>

goal (1 subgoal):
 1. 0 < max c1 c2 \<and> (\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>)
[PROOF STEP]
using a1 a2
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>
0 < c1
0 < c2

goal (1 subgoal):
 1. 0 < max c1 c2 \<and> (\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < max c1 c2 \<and> (\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>)

goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < max c1 c2 \<and> (\<forall>\<^sub>F x in F. \<bar>f1 x + f2 x\<bar> \<le> max c1 c2 * \<bar>g1 x + g2 x\<bar>)

goal (1 subgoal):
 1. (\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)
[PROOF STEP]
by (simp add: bigo_def, blast)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f1 x + f2 x) \<in> O[F](\<lambda>x. g1 x + g2 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_point_measure_finite2:
  "X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a\<in>X. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<subseteq> A; finite X\<rbrakk> \<Longrightarrow> emeasure (point_measure A f) X = sum f X
[PROOF STEP]
by (subst emeasure_point_measure)
     (auto dest: finite_subset intro!: sum.mono_neutral_left simp: less_le)


[STATEMENT]
lemma index_finsum_vec: assumes "finite F" and i: "i < n"
  and vs: "vs \<in> F \<rightarrow> carrier_vec n"
  shows "finsum_vec TYPE('a :: comm_monoid_add) n vs F $ i = sum (\<lambda> f. vs f $ i) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)
[PROOF STEP]
using \<open>finite F\<close> vs
[PROOF STATE]
proof (prove)
using this:
finite F
vs \<in> F \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)
[PROOF STEP]
proof (induct F)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vs \<in> {} \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs {} $ i = (\<Sum>f\<in>{}. vs f $ i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; vs \<in> F \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i); vs \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum_vec TYPE('a) n vs (insert x F) $ i = (\<Sum>f\<in>insert x F. vs f $ i)
[PROOF STEP]
case (insert f F)
[PROOF STATE]
proof (state)
this:
finite F
f \<notin> F
vs \<in> F \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)
vs \<in> insert f F \<rightarrow> carrier_vec n

goal (2 subgoals):
 1. vs \<in> {} \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs {} $ i = (\<Sum>f\<in>{}. vs f $ i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; vs \<in> F \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i); vs \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum_vec TYPE('a) n vs (insert x F) $ i = (\<Sum>f\<in>insert x F. vs f $ i)
[PROOF STEP]
hence IH: "finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)"
    and vs: "vs \<in> F \<rightarrow> carrier_vec n" "vs f \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
finite F
f \<notin> F
vs \<in> F \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)
vs \<in> insert f F \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i) &&& vs \<in> F \<rightarrow> carrier_vec n &&& vs f \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i)
vs \<in> F \<rightarrow> carrier_vec n
vs f \<in> carrier_vec n

goal (2 subgoals):
 1. vs \<in> {} \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs {} $ i = (\<Sum>f\<in>{}. vs f $ i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; vs \<in> F \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs F $ i = (\<Sum>f\<in>F. vs f $ i); vs \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum_vec TYPE('a) n vs (insert x F) $ i = (\<Sum>f\<in>insert x F. vs f $ i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum_vec TYPE('a) n vs (insert f F) $ i = (\<Sum>f\<in>insert f F. vs f $ i)
[PROOF STEP]
unfolding finsum_vec_insert[OF insert(1-2) vs]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vs f + finsum_vec TYPE('a) n vs F) $ i = (\<Sum>f\<in>insert f F. vs f $ i)
[PROOF STEP]
unfolding sum.insert[OF insert(1-2)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vs f + finsum_vec TYPE('a) n vs F) $ i = vs f $ i + (\<Sum>f\<in>F. vs f $ i)
[PROOF STEP]
unfolding IH[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vs f + finsum_vec TYPE('a) n vs F) $ i = vs f $ i + finsum_vec TYPE('a) n vs F $ i
[PROOF STEP]
by (rule index_add_vec, insert i, insert finsum_vec_closed[OF vs(1)], auto)
[PROOF STATE]
proof (state)
this:
finsum_vec TYPE('a) n vs (insert f F) $ i = (\<Sum>f\<in>insert f F. vs f $ i)

goal (1 subgoal):
 1. vs \<in> {} \<rightarrow> carrier_vec n \<Longrightarrow> finsum_vec TYPE('a) n vs {} $ i = (\<Sum>f\<in>{}. vs f $ i)
[PROOF STEP]
qed (insert i, auto simp: finsum_vec_empty)


[STATEMENT]
lemma poly_dvd_1:
  fixes p :: "'a :: {comm_semiring_1,semiring_no_zero_divisors} poly"
  shows "p dvd 1 \<longleftrightarrow> degree p = 0 \<and> coeff p 0 dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
proof (cases "degree p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
 2. degree p \<noteq> 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
degree p \<noteq> 0

goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
 2. degree p \<noteq> 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
with divides_degree[of p 1]
[PROOF STATE]
proof (chain)
picking this:
p dvd 1 \<Longrightarrow> degree p \<le> degree 1 \<or> 1 = 0
degree p \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p dvd 1 \<Longrightarrow> degree p \<le> degree 1 \<or> 1 = 0
degree p \<noteq> 0

goal (1 subgoal):
 1. (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))

goal (1 subgoal):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
degree p = 0

goal (1 subgoal):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
from degree0_coeffs[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. p = [:a:]
[PROOF STEP]
obtain a where p: "p = [:a:]"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. p = [:a:]

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

goal (1 subgoal):
 1. degree p = 0 \<Longrightarrow> (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([:a:] dvd 1) = (degree [:a:] = 0 \<and> coeff [:a:] 0 dvd (1::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p dvd 1) = (degree p = 0 \<and> coeff p 0 dvd (1::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pos_poly_abs_poly[simp]:
  shows "lead_coeff (abs_int_poly p) > 0 \<longleftrightarrow> p \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < lead_coeff (abs_int_poly p)) = (p \<noteq> 0)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0 < lead_coeff (abs_int_poly p)) = (p \<noteq> 0)
[PROOF STEP]
have "p \<noteq> 0 \<longleftrightarrow> lead_coeff p * sgn (lead_coeff p) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<noteq> 0) = (0 < lead_coeff p * sgn (lead_coeff p))
[PROOF STEP]
by (fold abs_sgn, auto)
[PROOF STATE]
proof (state)
this:
(p \<noteq> 0) = (0 < lead_coeff p * sgn (lead_coeff p))

goal (1 subgoal):
 1. (0 < lead_coeff (abs_int_poly p)) = (p \<noteq> 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p \<noteq> 0) = (0 < lead_coeff p * sgn (lead_coeff p))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(p \<noteq> 0) = (0 < lead_coeff p * sgn (lead_coeff p))

goal (1 subgoal):
 1. (0 < lead_coeff (abs_int_poly p)) = (p \<noteq> 0)
[PROOF STEP]
by (auto simp: abs_int_poly_def mult.commute)
[PROOF STATE]
proof (state)
this:
(0 < lead_coeff (abs_int_poly p)) = (p \<noteq> 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma steps_smaller_card_Max_fun':
  assumes "finite A" "\<exists>x\<in>A. l \<le> f x"
  shows   "steps A f l up left + l * up \<le> left * card A + up * Max\<^sub>0 (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
let ?xs = "rev (sorted_list_of_set A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
have "steps A f l up left  = lsteps (rev (sorted_list_of_set A)) f l up left"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. steps A f l up left = lsteps (rev (sorted_list_of_set A)) f l up left
[PROOF STEP]
using steps_lsteps
[PROOF STATE]
proof (prove)
using this:
steps ?A ?f ?l ?u ?v = lsteps (rev (sorted_list_of_set ?A)) ?f ?l ?u ?v

goal (1 subgoal):
 1. steps A f l up left = lsteps (rev (sorted_list_of_set A)) f l up left
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
steps A f l up left = lsteps (rev (sorted_list_of_set A)) f l up left

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

goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
have "\<dots> + l * up \<le> left * length ?xs + up * Max (f ` set ?xs \<union> {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsteps (rev (sorted_list_of_set A)) f l up left + l * up \<le> left * length (rev (sorted_list_of_set A)) + up * Max (f ` set (rev (sorted_list_of_set A)) \<union> {0})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<exists>x\<in>A. l \<le> f x

goal (1 subgoal):
 1. lsteps (rev (sorted_list_of_set A)) f l up left + l * up \<le> left * length (rev (sorted_list_of_set A)) + up * Max (f ` set (rev (sorted_list_of_set A)) \<union> {0})
[PROOF STEP]
by (intro lsteps_smaller_card_Max_fun') auto
[PROOF STATE]
proof (state)
this:
lsteps (rev (sorted_list_of_set A)) f l up left + l * up \<le> left * length (rev (sorted_list_of_set A)) + up * Max (f ` set (rev (sorted_list_of_set A)) \<union> {0})

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

goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
have "left * length ?xs = left * card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left * length (rev (sorted_list_of_set A)) = left * card A
[PROOF STEP]
using assms sorted_list_of_set_length
[PROOF STATE]
proof (prove)
using this:
finite A
\<exists>x\<in>A. l \<le> f x
length (sorted_list_of_set ?A) = card ?A

goal (1 subgoal):
 1. left * length (rev (sorted_list_of_set A)) = left * card A
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
left * length (rev (sorted_list_of_set A)) = left * card A

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

goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
have "set ?xs = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (rev (sorted_list_of_set A)) = A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<exists>x\<in>A. l \<le> f x

goal (1 subgoal):
 1. set (rev (sorted_list_of_set A)) = A
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
set (rev (sorted_list_of_set A)) = A

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

goal (1 subgoal):
 1. steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
steps A f l up left + l * up \<le> left * card A + up * Max (f ` A \<union> {0})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conv_radius_divide_power:
  assumes "c \<noteq> (0 :: 'a :: {real_normed_div_algebra,banach})"
  shows   "conv_radius (\<lambda>n. f n / c^n) = conv_radius f * ereal (norm c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. f n / c ^ n) = conv_radius f * ereal (norm c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. f n / c ^ n) = conv_radius f * ereal (norm c)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have "inverse c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. inverse c \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse c \<noteq> (0::'a)

goal (1 subgoal):
 1. conv_radius (\<lambda>n. f n / c ^ n) = conv_radius f * ereal (norm c)
[PROOF STEP]
from conv_radius_mult_power_right[OF this, of f]
[PROOF STATE]
proof (chain)
picking this:
conv_radius (\<lambda>n. f n * inverse c ^ n) = conv_radius f / ereal (norm (inverse c))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
conv_radius (\<lambda>n. f n * inverse c ^ n) = conv_radius f / ereal (norm (inverse c))

goal (1 subgoal):
 1. conv_radius (\<lambda>n. f n / c ^ n) = conv_radius f * ereal (norm c)
[PROOF STEP]
by (simp add: divide_inverse divide_ereal_def assms norm_inverse power_inverse)
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. f n / c ^ n) = conv_radius f * ereal (norm c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uncurry0_hfref_post[to_hfref_post]: "hfref (uncurry0 True) R S = hfref (\<lambda>_. True) R S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [uncurry0 True]\<^sub>a R \<rightarrow> S = R \<rightarrow>\<^sub>a S
[PROOF STEP]
apply (fo_rule arg_cong fun_cong)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncurry0 True = (\<lambda>_. True)
[PROOF STEP]
by auto


[STATEMENT]
lemma markedElementsToAreMarkedElements:
  assumes "m \<in> set (markedElementsTo e M)"
  shows "m \<in> set (markedElements M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> set (markedElements M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m \<in> set (markedElementsTo e M)

goal (1 subgoal):
 1. m \<in> set (markedElements M)
[PROOF STEP]
using markedElementsToArePrefixOfMarkedElements[of "e" "M"]
[PROOF STATE]
proof (prove)
using this:
m \<in> set (markedElementsTo e M)
isPrefix (markedElementsTo e M) (markedElements M)

goal (1 subgoal):
 1. m \<in> set (markedElements M)
[PROOF STEP]
using prefixIsSubset
[PROOF STATE]
proof (prove)
using this:
m \<in> set (markedElementsTo e M)
isPrefix (markedElementsTo e M) (markedElements M)
isPrefix ?p ?l \<Longrightarrow> set ?p \<subseteq> set ?l

goal (1 subgoal):
 1. m \<in> set (markedElements M)
[PROOF STEP]
by auto


[STATEMENT]
lemma cblinfun_bij2:
  fixes f::"'a \<Rightarrow>\<^sub>C\<^sub>L 'a::ceuclidean_space"
  assumes "f o\<^sub>C\<^sub>L g = id_cblinfun"
  shows "bij (cblinfun_apply g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (cblinfun_apply g)
[PROOF STEP]
proof (rule bijI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj (cblinfun_apply g)
 2. surj (cblinfun_apply g)
[PROOF STEP]
show "inj g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (cblinfun_apply g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f o\<^sub>C\<^sub>L g = id_cblinfun

goal (1 subgoal):
 1. inj (cblinfun_apply g)
[PROOF STEP]
by (metis cblinfun_id_cblinfun_apply cblinfun_compose.rep_eq injI inj_on_imageI2)
[PROOF STATE]
proof (state)
this:
inj (cblinfun_apply g)

goal (1 subgoal):
 1. surj (cblinfun_apply g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj (cblinfun_apply g)
[PROOF STEP]
show "surj g"
[PROOF STATE]
proof (prove)
using this:
inj (cblinfun_apply g)

goal (1 subgoal):
 1. surj (cblinfun_apply g)
[PROOF STEP]
using bounded_clinear_def cblinfun.bounded_clinear_right ceucl.linear_inj_imp_surj
[PROOF STATE]
proof (prove)
using this:
inj (cblinfun_apply g)
bounded_clinear ?f \<equiv> clinear ?f \<and> bounded_clinear_axioms ?f
bounded_clinear (cblinfun_apply ?a)
\<lbrakk>clinear ?f; inj ?f\<rbrakk> \<Longrightarrow> surj ?f

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_code [code]:
  "list n A = {xs. size xs = n \<and> list_all (\<lambda>x. x \<in> A) xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list n A = {xs. length xs = n \<and> list_all (\<lambda>x. x \<in> A) xs}
[PROOF STEP]
unfolding list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. length xs = n \<and> set xs \<subseteq> A} = {xs. length xs = n \<and> list_all (\<lambda>x. x \<in> A) xs}
[PROOF STEP]
by(auto intro!: ext simp add: list_all_iff)


[STATEMENT]
lemma retract_of_locally_connected:
  assumes "locally connected T" "S retract_of T"
  shows "locally connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally connected S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
locally connected T
S retract_of T

goal (1 subgoal):
 1. locally connected S
[PROOF STEP]
by (auto simp: idempotent_imp_retraction intro!: retraction_openin_vimage_iff elim!: locally_connected_quotient_image retract_ofE)


[STATEMENT]
lemma ord0_order_less_le: "(x::ord0) < y = (x \<le> y \<and> \<not> y \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < y) = (x \<le> y \<and> \<not> y \<le> x)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x < y \<Longrightarrow> x \<le> y \<and> \<not> y \<le> x
 2. x \<le> y \<and> \<not> y \<le> x \<Longrightarrow> x < y
[PROOF STEP]
apply (clarsimp simp add: ord0_less_imp_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x < y; y \<le> x\<rbrakk> \<Longrightarrow> False
 2. x \<le> y \<and> \<not> y \<le> x \<Longrightarrow> x < y
[PROOF STEP]
apply (drule ord0_less_le_trans, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>y \<le> x; x < x\<rbrakk> \<Longrightarrow> False
 2. x \<le> y \<and> \<not> y \<le> x \<Longrightarrow> x < y
[PROOF STEP]
apply (cut_tac a=x in wf_not_refl[OF ord0_wf], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<and> \<not> y \<le> x \<Longrightarrow> x < y
[PROOF STEP]
apply (cut_tac ord0_linear_lemma[of x y], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y \<and> \<not> y \<le> x; x < y \<or> y < x\<rbrakk> \<Longrightarrow> x < y
[PROOF STEP]
apply (auto dest: ord0_less_imp_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_segment_concat:
  assumes "j \<le> k"
  assumes "i \<le> j"
  shows "(list_segment i j as) @ (list_segment j k as) = (list_segment i k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_segment i j as @ list_segment j k as = list_segment i k as
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j \<le> k
i \<le> j

goal (1 subgoal):
 1. list_segment i j as @ list_segment j k as = list_segment i k as
[PROOF STEP]
unfolding list_segment_def
[PROOF STATE]
proof (prove)
using this:
j \<le> k
i \<le> j

goal (1 subgoal):
 1. map ((!) as) [i..<j] @ map ((!) as) [j..<k] = map ((!) as) [i..<k]
[PROOF STEP]
using le_Suc_ex upt_add_eq_append
[PROOF STATE]
proof (prove)
using this:
j \<le> k
i \<le> j
?k \<le> ?l \<Longrightarrow> \<exists>n. ?l = ?k + n
?i \<le> ?j \<Longrightarrow> [?i..<?j + ?k] = [?i..<?j] @ [?j..<?j + ?k]

goal (1 subgoal):
 1. map ((!) as) [i..<j] @ map ((!) as) [j..<k] = map ((!) as) [i..<k]
[PROOF STEP]
by fastforce


[STATEMENT]
lemma InvariantUniqAfterUnitPropagate:
  fixes M :: LiteralTrail and F :: Formula and M' :: LiteralTrail and uClause :: Clause and uLiteral :: Literal
  assumes "InvariantUniq M" and
  "isUnitClause uClause uLiteral (elements M)" and
  "M' = M @ [(uLiteral, False)]"
  shows "InvariantUniq M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
from \<open>InvariantUniq M\<close>
[PROOF STATE]
proof (chain)
picking this:
InvariantUniq M
[PROOF STEP]
have "uniq (elements M)"
[PROOF STATE]
proof (prove)
using this:
InvariantUniq M

goal (1 subgoal):
 1. uniq (elements M)
[PROOF STEP]
unfolding InvariantUniq_def
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)

goal (1 subgoal):
 1. uniq (elements M)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
uniq (elements M)

goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
uniq (elements M)

goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
from \<open>isUnitClause uClause uLiteral (elements M)\<close>
[PROOF STATE]
proof (chain)
picking this:
isUnitClause uClause uLiteral (elements M)
[PROOF STEP]
have "\<not> literalTrue uLiteral (elements M)"
[PROOF STATE]
proof (prove)
using this:
isUnitClause uClause uLiteral (elements M)

goal (1 subgoal):
 1. \<not> literalTrue uLiteral (elements M)
[PROOF STEP]
unfolding isUnitClause_def
[PROOF STATE]
proof (prove)
using this:
uLiteral el uClause \<and> \<not> literalTrue uLiteral (elements M) \<and> \<not> literalFalse uLiteral (elements M) \<and> (\<forall>literal. literal el uClause \<and> literal \<noteq> uLiteral \<longrightarrow> literalFalse literal (elements M))

goal (1 subgoal):
 1. \<not> literalTrue uLiteral (elements M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> literalTrue uLiteral (elements M)

goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
uniq (elements M)
\<not> literalTrue uLiteral (elements M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)
\<not> literalTrue uLiteral (elements M)

goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
using \<open>M' = M @ [(uLiteral, False)]\<close> uniqAppendElement[of "elements M" "uLiteral"]
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)
\<not> literalTrue uLiteral (elements M)
M' = M @ [(uLiteral, False)]
uniq (elements M) \<Longrightarrow> (uLiteral \<notin> set (elements M)) = uniq (elements M @ [uLiteral])

goal (1 subgoal):
 1. InvariantUniq M'
[PROOF STEP]
unfolding InvariantUniq_def
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)
\<not> literalTrue uLiteral (elements M)
M' = M @ [(uLiteral, False)]
uniq (elements M) \<Longrightarrow> (uLiteral \<notin> set (elements M)) = uniq (elements M @ [uLiteral])

goal (1 subgoal):
 1. uniq (elements M')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
InvariantUniq M'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lifted_antisymmetric:
  "f \<le>\<le> g \<Longrightarrow> g \<le>\<le> f \<Longrightarrow> f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<le>\<le> g; g \<le>\<le> f\<rbrakk> \<Longrightarrow> f = g
[PROOF STEP]
by (rule ext, rule order.antisym) (simp_all add: lifted_less_eq_def)


[STATEMENT]
lemma convexI: assumes S: "S \<subseteq> carrier_vec n"
  and step: "\<And> a x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> 0 \<le> a \<Longrightarrow> a \<le> 1 \<Longrightarrow> a \<cdot>\<^sub>v x + (1 - a) \<cdot>\<^sub>v y \<in> S"
shows "convex S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex S
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_hull S = S
[PROOF STEP]
proof (standard, standard)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> convex_hull S \<Longrightarrow> x \<in> S
 2. S \<subseteq> convex_hull S
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> convex_hull S \<Longrightarrow> x \<in> S
 2. S \<subseteq> convex_hull S
[PROOF STEP]
assume "z \<in> convex_hull S"
[PROOF STATE]
proof (state)
this:
z \<in> convex_hull S

goal (2 subgoals):
 1. \<And>x. x \<in> convex_hull S \<Longrightarrow> x \<in> S
 2. S \<subseteq> convex_hull S
[PROOF STEP]
from this[unfolded convex_hull_def]
[PROOF STATE]
proof (chain)
picking this:
z \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> S \<and> convex_lincomb c Ws x}
[PROOF STEP]
obtain W c where "finite W" and WS: "W \<subseteq> S"
    and "convex_lincomb c W z"
[PROOF STATE]
proof (prove)
using this:
z \<in> {x. \<exists>Ws c. finite Ws \<and> Ws \<subseteq> S \<and> convex_lincomb c Ws x}

goal (1 subgoal):
 1. (\<And>W c. \<lbrakk>finite W; W \<subseteq> S; convex_lincomb c W z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite W
W \<subseteq> S
convex_lincomb c W z

goal (2 subgoals):
 1. \<And>x. x \<in> convex_hull S \<Longrightarrow> x \<in> S
 2. S \<subseteq> convex_hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite W
W \<subseteq> S
convex_lincomb c W z
[PROOF STEP]
show "z \<in> S"
[PROOF STATE]
proof (prove)
using this:
finite W
W \<subseteq> S
convex_lincomb c W z

goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
proof (induct W arbitrary: c z)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c z. \<lbrakk>{} \<subseteq> S; convex_lincomb c {} z\<rbrakk> \<Longrightarrow> z \<in> S
 2. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
{} \<subseteq> S
convex_lincomb c {} z

goal (2 subgoals):
 1. \<And>c z. \<lbrakk>{} \<subseteq> S; convex_lincomb c {} z\<rbrakk> \<Longrightarrow> z \<in> S
 2. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> S
convex_lincomb c {} z

goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
unfolding convex_lincomb_def
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> S
nonneg_lincomb c {} z \<and> sum c {} = (1::'a)

goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> S

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
case (insert w W c z)
[PROOF STATE]
proof (state)
this:
finite W
w \<notin> W
\<lbrakk>W \<subseteq> S; convex_lincomb ?c3 W ?z3\<rbrakk> \<Longrightarrow> ?z3 \<in> S
insert w W \<subseteq> S
convex_lincomb c (insert w W) z

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
have "convex_lincomb c (insert w W) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_lincomb c (insert w W) z
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
convex_lincomb c (insert w W) z

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
hence zl: "z = lincomb c (insert w W)" and nonneg: "\<And> w. w \<in> W \<Longrightarrow> 0 \<le> c w"
      and cw: "c w \<ge> 0"
      and sum: "sum c (insert w W) = 1"
[PROOF STATE]
proof (prove)
using this:
convex_lincomb c (insert w W) z

goal (1 subgoal):
 1. (z = lincomb c (insert w W) &&& (\<And>w. w \<in> W \<Longrightarrow> (0::'a) \<le> c w)) &&& (0::'a) \<le> c w &&& sum c (insert w W) = (1::'a)
[PROOF STEP]
unfolding convex_lincomb_def nonneg_lincomb_def
[PROOF STATE]
proof (prove)
using this:
(lincomb c (insert w W) = z \<and> c ` insert w W \<subseteq> Collect ((\<le>) (0::'a))) \<and> sum c (insert w W) = (1::'a)

goal (1 subgoal):
 1. (z = lincomb c (insert w W) &&& (\<And>w. w \<in> W \<Longrightarrow> (0::'a) \<le> c w)) &&& (0::'a) \<le> c w &&& sum c (insert w W) = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z = lincomb c (insert w W)
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3
(0::'a) \<le> c w
sum c (insert w W) = (1::'a)

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
have zl: "z = c w \<cdot>\<^sub>v w + lincomb c W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = c w \<cdot>\<^sub>v w + lincomb c W
[PROOF STEP]
unfolding zl
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c (insert w W) = c w \<cdot>\<^sub>v w + lincomb c W
[PROOF STEP]
by (rule lincomb_insert2, insert insert S, auto)
[PROOF STATE]
proof (state)
this:
z = c w \<cdot>\<^sub>v w + lincomb c W

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
have sum: "c w + sum c W = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c w + sum c W = (1::'a)
[PROOF STEP]
unfolding sum[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c w + sum c W = sum c (insert w W)
[PROOF STEP]
by (subst sum.insert, insert insert, auto)
[PROOF STATE]
proof (state)
this:
c w + sum c W = (1::'a)

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
have W: "W \<subseteq> carrier_vec n" and w: "w \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W \<subseteq> carrier_vec n &&& w \<in> carrier_vec n
[PROOF STEP]
using S insert
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier_vec n
finite W
w \<notin> W
\<lbrakk>W \<subseteq> S; convex_lincomb ?c3 W ?z3\<rbrakk> \<Longrightarrow> ?z3 \<in> S
insert w W \<subseteq> S
convex_lincomb c (insert w W) z

goal (1 subgoal):
 1. W \<subseteq> carrier_vec n &&& w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W \<subseteq> carrier_vec n
w \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>x F c z. \<lbrakk>finite F; x \<notin> F; \<And>c z. \<lbrakk>F \<subseteq> S; convex_lincomb c F z\<rbrakk> \<Longrightarrow> z \<in> S; insert x F \<subseteq> S; convex_lincomb c (insert x F) z\<rbrakk> \<Longrightarrow> z \<in> S
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
proof (cases "sum c W = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sum c W = (0::'a)

goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
with nonneg
[PROOF STATE]
proof (chain)
picking this:
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3
sum c W = (0::'a)
[PROOF STEP]
have c0: "\<And> w. w \<in> W \<Longrightarrow> c w = 0"
[PROOF STATE]
proof (prove)
using this:
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3
sum c W = (0::'a)

goal (1 subgoal):
 1. \<And>w. w \<in> W \<Longrightarrow> c w = (0::'a)
[PROOF STEP]
using insert(1) sum_nonneg_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3
sum c W = (0::'a)
finite W
\<lbrakk>finite ?A; \<And>x. x \<in> ?A \<Longrightarrow> (0::?'a) \<le> ?f x\<rbrakk> \<Longrightarrow> (sum ?f ?A = (0::?'a)) = (\<forall>x\<in>?A. ?f x = (0::?'a))

goal (1 subgoal):
 1. \<And>w. w \<in> W \<Longrightarrow> c w = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?w3 \<in> W \<Longrightarrow> c ?w3 = (0::'a)

goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
with sum
[PROOF STATE]
proof (chain)
picking this:
c w + sum c W = (1::'a)
?w3 \<in> W \<Longrightarrow> c ?w3 = (0::'a)
[PROOF STEP]
have cw: "c w = 1"
[PROOF STATE]
proof (prove)
using this:
c w + sum c W = (1::'a)
?w3 \<in> W \<Longrightarrow> c ?w3 = (0::'a)

goal (1 subgoal):
 1. c w = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c w = (1::'a)

goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
have lin0: "lincomb c W = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c W = 0\<^sub>v n
[PROOF STEP]
by (intro lincomb_zero W, insert c0, auto)
[PROOF STATE]
proof (state)
this:
lincomb c W = 0\<^sub>v n

goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
have "z = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = w
[PROOF STEP]
unfolding zl cw lin0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) \<cdot>\<^sub>v w + 0\<^sub>v n = w
[PROOF STEP]
using w
[PROOF STATE]
proof (prove)
using this:
w \<in> carrier_vec n

goal (1 subgoal):
 1. (1::'a) \<cdot>\<^sub>v w + 0\<^sub>v n = w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z = w

goal (2 subgoals):
 1. sum c W = (0::'a) \<Longrightarrow> z \<in> S
 2. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
with insert(4)
[PROOF STATE]
proof (chain)
picking this:
insert w W \<subseteq> S
z = w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
insert w W \<subseteq> S
z = w

goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z \<in> S

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
sum c W \<noteq> (0::'a)

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
have "sum c W \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> sum c W
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3

goal (1 subgoal):
 1. (0::'a) \<le> sum c W
[PROOF STEP]
by (metis sum_nonneg)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum c W

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
sum c W \<noteq> (0::'a)
(0::'a) \<le> sum c W
[PROOF STEP]
have pos: "sum c W > 0"
[PROOF STATE]
proof (prove)
using this:
sum c W \<noteq> (0::'a)
(0::'a) \<le> sum c W

goal (1 subgoal):
 1. (0::'a) < sum c W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) < sum c W

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
define b where "b = (\<lambda> w. inverse (sum c W) * c w)"
[PROOF STATE]
proof (state)
this:
b = (\<lambda>w. inverse (sum c W) * c w)

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
have "convex_lincomb b W (lincomb b W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_lincomb b W (lincomb b W)
[PROOF STEP]
unfolding convex_lincomb_def nonneg_lincomb_def b_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lincomb (\<lambda>w. inverse (sum c W) * c w) W = lincomb (\<lambda>w. inverse (sum c W) * c w) W \<and> (\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) (0::'a))) \<and> (\<Sum>w\<in>W. inverse (sum c W) * c w) = (1::'a)
[PROOF STEP]
proof (intro conjI refl)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) (0::'a))
 2. (\<Sum>w\<in>W. inverse (sum c W) * c w) = (1::'a)
[PROOF STEP]
show "(\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) (0::'a))
[PROOF STEP]
using nonneg pos
[PROOF STATE]
proof (prove)
using this:
?w3 \<in> W \<Longrightarrow> (0::'a) \<le> c ?w3
(0::'a) < sum c W

goal (1 subgoal):
 1. (\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>w. inverse (sum c W) * c w) ` W \<subseteq> Collect ((\<le>) (0::'a))

goal (1 subgoal):
 1. (\<Sum>w\<in>W. inverse (sum c W) * c w) = (1::'a)
[PROOF STEP]
show "(\<Sum>w\<in>W. inverse (sum c W) * c w) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>W. inverse (sum c W) * c w) = (1::'a)
[PROOF STEP]
unfolding sum_distrib_left[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (sum c W) * sum c W = (1::'a)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
sum c W \<noteq> (0::'a)

goal (1 subgoal):
 1. inverse (sum c W) * sum c W = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>W. inverse (sum c W) * c w) = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
convex_lincomb b W (lincomb b W)

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
from insert(3)[OF _ this] insert
[PROOF STATE]
proof (chain)
picking this:
W \<subseteq> S \<Longrightarrow> lincomb b W \<in> S
finite W
w \<notin> W
\<lbrakk>W \<subseteq> S; convex_lincomb ?c3 W ?z3\<rbrakk> \<Longrightarrow> ?z3 \<in> S
insert w W \<subseteq> S
convex_lincomb c (insert w W) z
[PROOF STEP]
have IH: "lincomb b W \<in> S"
[PROOF STATE]
proof (prove)
using this:
W \<subseteq> S \<Longrightarrow> lincomb b W \<in> S
finite W
w \<notin> W
\<lbrakk>W \<subseteq> S; convex_lincomb ?c3 W ?z3\<rbrakk> \<Longrightarrow> ?z3 \<in> S
insert w W \<subseteq> S
convex_lincomb c (insert w W) z

goal (1 subgoal):
 1. lincomb b W \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb b W \<in> S

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
have lin: "lincomb c W = sum c W \<cdot>\<^sub>v lincomb b W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c W = sum c W \<cdot>\<^sub>v lincomb b W
[PROOF STEP]
unfolding b_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb c W = sum c W \<cdot>\<^sub>v lincomb (\<lambda>w. inverse (sum c W) * c w) W
[PROOF STEP]
by (subst lincomb_smult[symmetric, OF W], rule lincomb_cong[OF _ W], insert False, auto)
[PROOF STATE]
proof (state)
this:
lincomb c W = sum c W \<cdot>\<^sub>v lincomb b W

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
from sum cw pos
[PROOF STATE]
proof (chain)
picking this:
c w + sum c W = (1::'a)
(0::'a) \<le> c w
(0::'a) < sum c W
[PROOF STEP]
have sum: "sum c W = 1 - c w" and cw1: "c w \<le> 1"
[PROOF STATE]
proof (prove)
using this:
c w + sum c W = (1::'a)
(0::'a) \<le> c w
(0::'a) < sum c W

goal (1 subgoal):
 1. sum c W = (1::'a) - c w &&& c w \<le> (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum c W = (1::'a) - c w
c w \<le> (1::'a)

goal (1 subgoal):
 1. sum c W \<noteq> (0::'a) \<Longrightarrow> z \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> S
[PROOF STEP]
unfolding zl lin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c w \<cdot>\<^sub>v w + sum c W \<cdot>\<^sub>v lincomb b W \<in> S
[PROOF STEP]
unfolding sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c w \<cdot>\<^sub>v w + ((1::'a) - c w) \<cdot>\<^sub>v lincomb b W \<in> S
[PROOF STEP]
by (rule step[OF _ IH cw cw1], insert insert, auto)
[PROOF STATE]
proof (state)
this:
z \<in> S

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

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

goal (1 subgoal):
 1. S \<subseteq> convex_hull S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<subseteq> convex_hull S
[PROOF STEP]
show "S \<subseteq> convex_hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> convex_hull S
[PROOF STEP]
using S
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier_vec n

goal (1 subgoal):
 1. S \<subseteq> convex_hull S
[PROOF STEP]
by (rule set_in_convex_hull)
[PROOF STATE]
proof (state)
this:
S \<subseteq> convex_hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_mono2: "x \<ge> y \<Longrightarrow> max x z \<ge> max y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> x \<Longrightarrow> max y z \<le> max x z
[PROOF STEP]
unfolding max_comm[of _ z]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> x \<Longrightarrow> max z y \<le> max z x
[PROOF STEP]
by (rule max_mono)


[STATEMENT]
lemma (in vectorspace) already_in_span:
  fixes v A
  assumes  inC: "A\<subseteq>carrier V" and inspan: "v\<in>span A"
  shows "span A= span (A\<union>{v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
from inC inspan
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
v \<in> span A
[PROOF STEP]
have dir1: "span A \<subseteq> span (A\<union>{v})"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V
v \<in> span A

goal (1 subgoal):
 1. span A \<subseteq> span (A \<union> {v})
[PROOF STEP]
by (intro span_is_monotone, auto)
[PROOF STATE]
proof (state)
this:
span A \<subseteq> span (A \<union> {v})

goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
from inC
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
[PROOF STEP]
have inown: "A\<subseteq>span A"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V

goal (1 subgoal):
 1. A \<subseteq> span A
[PROOF STEP]
by (rule in_own_span)
[PROOF STATE]
proof (state)
this:
A \<subseteq> span A

goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
from inC
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
[PROOF STEP]
have subm: "submodule K (span A) V"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V

goal (1 subgoal):
 1. LinearCombinations.submodule K (span A) V
[PROOF STEP]
by (rule span_is_submodule)
[PROOF STATE]
proof (state)
this:
LinearCombinations.submodule K (span A) V

goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
from inown inspan subm
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> span A
v \<in> span A
LinearCombinations.submodule K (span A) V
[PROOF STEP]
have dir2: "span (A \<union> {v}) \<subseteq> span A"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> span A
v \<in> span A
LinearCombinations.submodule K (span A) V

goal (1 subgoal):
 1. span (A \<union> {v}) \<subseteq> span A
[PROOF STEP]
by (intro span_is_subset, auto)
[PROOF STATE]
proof (state)
this:
span (A \<union> {v}) \<subseteq> span A

goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
from dir1 dir2
[PROOF STATE]
proof (chain)
picking this:
span A \<subseteq> span (A \<union> {v})
span (A \<union> {v}) \<subseteq> span A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
span A \<subseteq> span (A \<union> {v})
span (A \<union> {v}) \<subseteq> span A

goal (1 subgoal):
 1. span A = span (A \<union> {v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
span A = span (A \<union> {v})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isEmpty_correct: "isEmpty t \<longleftrightarrow> toList t = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isEmpty t = (toList t = [])
[PROOF STEP]
unfolding isEmpty_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t = Empty) = (toList t = [])
[PROOF STEP]
by (simp add: toList_empty)
\<comment> \<open>Avoid comparison with @{text "(=)"}, and thus unnecessary equality-class
    parameter on element types in generated code\<close>


[STATEMENT]
lemma set_pair_pmf[simp]: "set_pmf (pair_pmf A B) = set_pmf A \<times> set_pmf B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (pair_pmf A B) = set_pmf A \<times> set_pmf B
[PROOF STEP]
unfolding pair_pmf_def set_bind_pmf set_return_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>M\<in>set_pmf A. \<Union>Ma\<in>set_pmf B. {(M, Ma)}) = set_pmf A \<times> set_pmf B
[PROOF STEP]
by auto


[STATEMENT]
lemma psi_mono: "m \<le> n \<Longrightarrow> psi m \<le> psi n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> psi m \<le> psi n
[PROOF STEP]
unfolding psi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> sum mangoldt {1..m} \<le> sum mangoldt {1..n}
[PROOF STEP]
by (intro sum_mono2 mangoldt_nonneg) auto


[STATEMENT]
lemma "(x < y - z) = (x + z < (y::real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x < y - z) = (x + z < y)
[PROOF STEP]
by arith


[STATEMENT]
lemma F2set2_bd: "|F2set2 x| <o bd_F1 +c bd_F2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |F2set2 x| <o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule ordLess_ordLeq_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. |F2set2 x| <o ?r'
 2. ?r' \<le>o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule F2.set_bd(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bd_F2 \<le>o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule ordLeq_csum2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Card_order bd_F2
[PROOF STEP]
apply (rule F2.bd_Card_order)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma not_or: "not (\<phi> or \<psi>) = (not \<phi>) aand (not \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xs. \<not> (\<phi> xs \<or> \<psi> xs)) = (\<lambda>xs. \<not> \<phi> xs \<and> \<not> \<psi> xs)
[PROOF STEP]
by blast