[STATEMENT]
lemma comp_monoid_morphisms:
  assumes "monoid_homomorphism \<eta> A multA oneA B multB oneB" and
          "monoid_homomorphism \<theta> B multB oneB C multC oneC"
shows "monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
have "map (\<theta> \<circ> \<eta> \<down> A) A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<theta> \<circ> \<eta> \<down> A) A C
[PROOF STEP]
using assms comp_maps
[PROOF STATE]
proof (prove)
using this:
monoid_homomorphism \<eta> A multA oneA B multB oneB
monoid_homomorphism \<theta> B multB oneB C multC oneC
\<lbrakk>map ?\<eta> ?A ?B; map ?\<theta> ?B ?C\<rbrakk> \<Longrightarrow> map (?\<theta> \<circ> ?\<eta> \<down> ?A) ?A ?C

goal (1 subgoal):
 1. map (\<theta> \<circ> \<eta> \<down> A) A C
[PROOF STEP]
by (metis monoid_homomorphism.axioms(1))
[PROOF STATE]
proof (state)
this:
map (\<theta> \<circ> \<eta> \<down> A) A C

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
map (\<theta> \<circ> \<eta> \<down> A) A C

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
have "(\<theta> \<circ> \<eta> \<down> A) oneA = oneC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<theta> \<circ> \<eta> \<down> A) oneA = oneC
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
monoid_homomorphism \<eta> A multA oneA B multB oneB
monoid_homomorphism \<theta> B multB oneB C multC oneC

goal (1 subgoal):
 1. (\<theta> \<circ> \<eta> \<down> A) oneA = oneC
[PROOF STEP]
by (metis compose_eq monoid.unit_closed monoid_homomorphism.axioms(2) monoid_homomorphism.commutes_with_unit)
[PROOF STATE]
proof (state)
this:
(\<theta> \<circ> \<eta> \<down> A) oneA = oneC

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<theta> \<circ> \<eta> \<down> A) oneA = oneC

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
have "(\<theta> \<circ> \<eta> \<down> A) (multA x y) = multC ((\<theta> \<circ> \<eta> \<down> A) x) ((\<theta> \<circ> \<eta> \<down> A) y)"
      if "x \<in> A" "y \<in> A" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<theta> \<circ> \<eta> \<down> A) (multA x y) = multC ((\<theta> \<circ> \<eta> \<down> A) x) ((\<theta> \<circ> \<eta> \<down> A) y)
[PROOF STEP]
using that assms monoid_homomorphism.commutes_with_composition
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
monoid_homomorphism \<eta> A multA oneA B multB oneB
monoid_homomorphism \<theta> B multB oneB C multC oneC
\<lbrakk>monoid_homomorphism ?\<eta> ?M ?composition ?unit ?M' ?composition' ?unit'; ?x \<in> ?M; ?y \<in> ?M\<rbrakk> \<Longrightarrow> ?\<eta> (?composition ?x ?y) = ?composition' (?\<eta> ?x) (?\<eta> ?y)

goal (1 subgoal):
 1. (\<theta> \<circ> \<eta> \<down> A) (multA x y) = multC ((\<theta> \<circ> \<eta> \<down> A) x) ((\<theta> \<circ> \<eta> \<down> A) y)
[PROOF STEP]
by (smt compose_eq map.map_closed monoid.composition_closed monoid_homomorphism.axioms)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> A; ?y \<in> A\<rbrakk> \<Longrightarrow> (\<theta> \<circ> \<eta> \<down> A) (multA ?x ?y) = multC ((\<theta> \<circ> \<eta> \<down> A) ?x) ((\<theta> \<circ> \<eta> \<down> A) ?y)

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
map (\<theta> \<circ> \<eta> \<down> A) A C
(\<theta> \<circ> \<eta> \<down> A) oneA = oneC
\<lbrakk>?x \<in> A; ?y \<in> A\<rbrakk> \<Longrightarrow> (\<theta> \<circ> \<eta> \<down> A) (multA ?x ?y) = multC ((\<theta> \<circ> \<eta> \<down> A) ?x) ((\<theta> \<circ> \<eta> \<down> A) ?y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map (\<theta> \<circ> \<eta> \<down> A) A C
(\<theta> \<circ> \<eta> \<down> A) oneA = oneC
\<lbrakk>?x \<in> A; ?y \<in> A\<rbrakk> \<Longrightarrow> (\<theta> \<circ> \<eta> \<down> A) (multA ?x ?y) = multC ((\<theta> \<circ> \<eta> \<down> A) ?x) ((\<theta> \<circ> \<eta> \<down> A) ?y)

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
using monoid_homomorphism_def assms comp_maps
[PROOF STATE]
proof (prove)
using this:
map (\<theta> \<circ> \<eta> \<down> A) A C
(\<theta> \<circ> \<eta> \<down> A) oneA = oneC
\<lbrakk>?x \<in> A; ?y \<in> A\<rbrakk> \<Longrightarrow> (\<theta> \<circ> \<eta> \<down> A) (multA ?x ?y) = multC ((\<theta> \<circ> \<eta> \<down> A) ?x) ((\<theta> \<circ> \<eta> \<down> A) ?y)
monoid_homomorphism ?\<eta> ?M ?composition ?unit ?M' ?composition' ?unit' \<equiv> (map ?\<eta> ?M ?M' \<and> Group_Theory.monoid ?M ?composition ?unit) \<and> Group_Theory.monoid ?M' ?composition' ?unit' \<and> monoid_homomorphism_axioms ?\<eta> ?M ?composition ?unit ?composition' ?unit'
monoid_homomorphism \<eta> A multA oneA B multB oneB
monoid_homomorphism \<theta> B multB oneB C multC oneC
\<lbrakk>map ?\<eta> ?A ?B; map ?\<theta> ?B ?C\<rbrakk> \<Longrightarrow> map (?\<theta> \<circ> ?\<eta> \<down> ?A) ?A ?C

goal (1 subgoal):
 1. monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC
[PROOF STEP]
by (smt monoid_homomorphism_axioms.intro)
[PROOF STATE]
proof (state)
this:
monoid_homomorphism (\<theta> \<circ> \<eta> \<down> A) A multA oneA C multC oneC

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_neg_pp_np_help: "\<And>x. f x \<le> (0::real) \<Longrightarrow> np f x = -f x \<and> pp f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
assume le: "f x \<le> 0"
[PROOF STATE]
proof (state)
this:
f x \<le> 0

goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
hence "pp f x = 0 "
[PROOF STATE]
proof (prove)
using this:
f x \<le> 0

goal (1 subgoal):
 1. pp f x = 0
[PROOF STEP]
by (cases "f x < 0") (auto simp add: positive_part_def)
[PROOF STATE]
proof (state)
this:
pp f x = 0

goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pp f x = 0

goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
from le
[PROOF STATE]
proof (chain)
picking this:
f x \<le> 0
[PROOF STEP]
have "np f x = -f x"
[PROOF STATE]
proof (prove)
using this:
f x \<le> 0

goal (1 subgoal):
 1. np f x = - f x
[PROOF STEP]
by (cases "f x < 0") (auto simp add: negative_part_def)
[PROOF STATE]
proof (state)
this:
np f x = - f x

goal (1 subgoal):
 1. \<And>x. f x \<le> 0 \<Longrightarrow> np f x = - f x \<and> pp f x = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
pp f x = 0
np f x = - f x
[PROOF STEP]
show "np f x = -f x \<and> pp f x = 0"
[PROOF STATE]
proof (prove)
using this:
pp f x = 0
np f x = - f x

goal (1 subgoal):
 1. np f x = - f x \<and> pp f x = 0
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
np f x = - f x \<and> pp f x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma harm_remainder_bigo:
  assumes "N > 0"
  shows   "harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))
[PROOF STEP]
from harm_remainder_bound[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>C. \<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1)
[PROOF STEP]
obtain C where "\<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1)"
[PROOF STATE]
proof (prove)
using this:
\<exists>C. \<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1)

goal (1 subgoal):
 1. (\<And>C. \<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1)

goal (1 subgoal):
 1. harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>1. norm (harm_remainder N n) \<le> C / real n ^ (2 * N + 1)

goal (1 subgoal):
 1. harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))
[PROOF STEP]
by (intro bigoI[of _ C] eventually_mono[OF eventually_ge_at_top[of 1]]) auto
[PROOF STATE]
proof (state)
this:
harm_remainder N \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_add_iterate_preserves_pivot_row:
  fixes A::"'a::{ring_1}^'n^'m::{mod_type}"
  assumes n: "n<nrows A"
  and a: "to_nat i \<le> n"
  shows "(row_add_iterate A n i j) $ i $ b = A $ i $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A n i j $ i $ b = A $ i $ b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < nrows A
mod_type_class.to_nat i \<le> n

goal (1 subgoal):
 1. row_add_iterate A n i j $ i $ b = A $ i $ b
[PROOF STEP]
proof (induct n arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 < nrows A; mod_type_class.to_nat i \<le> 0\<rbrakk> \<Longrightarrow> row_add_iterate A 0 i j $ i $ b = A $ i $ b
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < nrows A
mod_type_class.to_nat i \<le> 0

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 < nrows A; mod_type_class.to_nat i \<le> 0\<rbrakk> \<Longrightarrow> row_add_iterate A 0 i j $ i $ b = A $ i $ b
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A 0 i j $ i $ b = A $ i $ b
[PROOF STEP]
by (metis "0.prems"(2) le_0_eq least_mod_type row_add_iterate.simps(1) to_nat_eq to_nat_mono')
[PROOF STATE]
proof (state)
this:
row_add_iterate A 0 i j $ i $ b = A $ i $ b

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
fix n and A::"'a::{ring_1}^'n^'m::{mod_type}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
assume hyp: "\<And>A::'a::{ring_1}^'n^'m::{mod_type}. n < nrows A \<Longrightarrow> to_nat i \<le> n \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b"
    and Suc_n_less_card: "Suc n < nrows A" and i_less_suc: "to_nat i \<le> Suc n"
[PROOF STATE]
proof (state)
this:
\<lbrakk>n < nrows ?A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate ?A n i j $ i $ b = ?A $ i $ b
Suc n < nrows A
mod_type_class.to_nat i \<le> Suc n

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n < nrows A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate A n i j $ i $ b = A $ i $ b; Suc n < nrows A; mod_type_class.to_nat i \<le> Suc n\<rbrakk> \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
show "row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
proof (cases "Suc n = to_nat i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc n = mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
 2. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Suc n = mod_type_class.to_nat i

goal (2 subgoals):
 1. Suc n = mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
 2. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
unfolding row_add_iterate.simps if_P[OF True]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A n i j $ i $ b = A $ i $ b
[PROOF STEP]
apply (rule row_add_iterate_preserves_greater_than_n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n < nrows A
 2. n < mod_type_class.to_nat i
[PROOF STEP]
using Suc_n_less_card True lessI
[PROOF STATE]
proof (prove)
using this:
Suc n < nrows A
Suc n = mod_type_class.to_nat i
?n < Suc ?n

goal (2 subgoals):
 1. n < nrows A
 2. n < mod_type_class.to_nat i
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Suc n \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
define A' where "A' = row_add A (from_nat (Suc n)) i (- A $ from_nat (Suc n) $ j)"
[PROOF STATE]
proof (state)
this:
A' = row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j)

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
have row_add_iterate_A': "row_add_iterate A' n i j $ i $ b = A' $ i $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A' n i j $ i $ b = A' $ i $ b
[PROOF STEP]
using hyp Suc_n_less_card i_less_suc False
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < nrows ?A; mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate ?A n i j $ i $ b = ?A $ i $ b
Suc n < nrows A
mod_type_class.to_nat i \<le> Suc n
Suc n \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. row_add_iterate A' n i j $ i $ b = A' $ i $ b
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < CARD('m); mod_type_class.to_nat i \<le> n\<rbrakk> \<Longrightarrow> row_add_iterate ?A n i j $ i $ b = ?A $ i $ b
Suc n < CARD('m)
mod_type_class.to_nat i \<le> Suc n
Suc n \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. row_add_iterate A' n i j $ i $ b = A' $ i $ b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_add_iterate A' n i j $ i $ b = A' $ i $ b

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
have from_nat_noteq_i: "from_nat (Suc n) \<noteq> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) \<noteq> i
[PROOF STEP]
using False Suc_n_less_card from_nat_not_eq
[PROOF STATE]
proof (prove)
using this:
Suc n \<noteq> mod_type_class.to_nat i
Suc n < nrows A
\<lbrakk>?a \<noteq> mod_type_class.to_nat ?b; ?a < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat ?a \<noteq> ?b

goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) \<noteq> i
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
Suc n \<noteq> mod_type_class.to_nat i
Suc n < CARD('m)
\<lbrakk>?a \<noteq> mod_type_class.to_nat ?b; ?a < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat ?a \<noteq> ?b

goal (1 subgoal):
 1. mod_type_class.from_nat (Suc n) \<noteq> i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat (Suc n) \<noteq> i

goal (1 subgoal):
 1. Suc n \<noteq> mod_type_class.to_nat i \<Longrightarrow> row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b
[PROOF STEP]
unfolding row_add_iterate.simps if_not_P[OF False] row_add_iterate_A'[unfolded A'_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add A (mod_type_class.from_nat (Suc n)) i (- A $ mod_type_class.from_nat (Suc n) $ j) $ i $ b = A $ i $ b
[PROOF STEP]
unfolding row_add_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia ja. if ia = mod_type_class.from_nat (Suc n) then A $ mod_type_class.from_nat (Suc n) $ ja + - A $ mod_type_class.from_nat (Suc n) $ j * A $ i $ ja else A $ ia $ ja) $ i $ b = A $ i $ b
[PROOF STEP]
using from_nat_noteq_i
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat (Suc n) \<noteq> i

goal (1 subgoal):
 1. (\<chi>ia ja. if ia = mod_type_class.from_nat (Suc n) then A $ mod_type_class.from_nat (Suc n) $ ja + - A $ mod_type_class.from_nat (Suc n) $ j * A $ i $ ja else A $ ia $ ja) $ i $ b = A $ i $ b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row_add_iterate A (Suc n) i j $ i $ b = A $ i $ b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_cn_cov_comp_ObjMap_vdomain[cat_cn_cs_simps]:
  assumes "\<GG> : \<BB> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_functor \<alpha> \<open>op_cat \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_cat \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_functor \<alpha> \<AA> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule smcf_cn_cov_comp_ObjMap_vdomain
          [
            OF
              L.cf_is_semifunctor[unfolded slicing_commute[symmetric]]
              R.cf_is_semifunctor,
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> ((\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_diagonal:
  "closed {y. \<exists> x::('a::t2_space). y = (x,x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
have "{y. \<exists> x::'a. y = (x,x)} = UNIV - {(x,y) | x y. x \<noteq> y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
using open_diagonal_complement closed_Diff
[PROOF STATE]
proof (prove)
using this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
open {(x, y) |x y. x \<noteq> y}
\<lbrakk>closed ?S; open ?T\<rbrakk> \<Longrightarrow> closed (?S - ?T)

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed {y. \<exists>x. y = (x, x)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ltl_ldrop: "\<lbrakk> \<And>xs. P xs \<Longrightarrow> P (ltl xs); P xs \<rbrakk> \<Longrightarrow> P (ldropn n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>xs. P xs \<Longrightarrow> P (ltl xs); P xs\<rbrakk> \<Longrightarrow> P (ldropn n xs)
[PROOF STEP]
unfolding ldropn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>xs. P xs \<Longrightarrow> P (ltl xs); P xs\<rbrakk> \<Longrightarrow> P ((ltl ^^ n) xs)
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
theorem subst_preserves_beta2 [simp]: "r \<rightarrow>\<^sub>\<beta> s ==> t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t[s/i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t[s/i]
[PROOF STEP]
apply (induct t arbitrary: r s i)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> Var x[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* Var x[s/i]
 2. \<And>t1 t2 r s i. \<lbrakk>\<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t1[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t1[s/i]; \<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t2[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t2[s/i]; r \<rightarrow>\<^sub>\<beta> s\<rbrakk> \<Longrightarrow> (t1 \<degree> t2)[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* (t1 \<degree> t2)[s/i]
 3. \<And>t r s i. \<lbrakk>\<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t[s/i]; r \<rightarrow>\<^sub>\<beta> s\<rbrakk> \<Longrightarrow> Abs t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* Abs t[s/i]
[PROOF STEP]
apply (simp add: subst_Var r_into_rtranclp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>t1 t2 r s i. \<lbrakk>\<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t1[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t1[s/i]; \<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t2[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t2[s/i]; r \<rightarrow>\<^sub>\<beta> s\<rbrakk> \<Longrightarrow> (t1 \<degree> t2)[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* (t1 \<degree> t2)[s/i]
 2. \<And>t r s i. \<lbrakk>\<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t[s/i]; r \<rightarrow>\<^sub>\<beta> s\<rbrakk> \<Longrightarrow> Abs t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* Abs t[s/i]
[PROOF STEP]
apply (simp add: rtrancl_beta_App)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t r s i. \<lbrakk>\<And>r s i. r \<rightarrow>\<^sub>\<beta> s \<Longrightarrow> t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* t[s/i]; r \<rightarrow>\<^sub>\<beta> s\<rbrakk> \<Longrightarrow> Abs t[r/i] \<rightarrow>\<^sub>\<beta>\<^sup>* Abs t[s/i]
[PROOF STEP]
apply (simp add: rtrancl_beta_Abs)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sqmatrix_add_left_commute [simp]:
  "(A::('a::ab_semigroup_add,'m) sqmatrix) + (B + C) = B + (A + C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A + (B + C) = B + (A + C)
[PROOF STEP]
by (metis sqmatrix_add_commute sqmatrix_add_assoc)


[STATEMENT]
lemma fcard_flist:
  "fcard xs = length (flist xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcard xs = length (flist xs)
[PROOF STEP]
apply (simp add:fcard_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card \<langle>xs\<rangle>\<^sub>f = length (flist xs)
[PROOF STEP]
apply (fold flist_set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (flist xs)) = length (flist xs)
[PROOF STEP]
apply (unfold distinct_card[OF flist_props(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (flist xs) = length (flist xs)
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eval_fds_const [simp]: "eval_fds (fds_const c) = (\<lambda>_. c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_const c) = (\<lambda>_. c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>uu_. eval_fds (fds_const c) uu_ = c
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>uu_. eval_fds (fds_const c) uu_ = c
[PROOF STEP]
have "eval_fds (fds_const c) s = (\<Sum>n. if n = 1 then c else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_const c) s = (\<Sum>n. if n = 1 then c else (0::'a))
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. fds_nth (fds_const c) n / nat_power n s) = (\<Sum>n. if n = 1 then c else (0::'a))
[PROOF STEP]
by (intro suminf_cong) simp
[PROOF STATE]
proof (state)
this:
eval_fds (fds_const c) s = (\<Sum>n. if n = 1 then c else (0::'a))

goal (1 subgoal):
 1. \<And>uu_. eval_fds (fds_const c) uu_ = c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_fds (fds_const c) s = (\<Sum>n. if n = 1 then c else (0::'a))

goal (1 subgoal):
 1. \<And>uu_. eval_fds (fds_const c) uu_ = c
[PROOF STEP]
have "\<dots> = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. if n = 1 then c else (0::'a)) = c
[PROOF STEP]
using sums_single[of 1 "\<lambda>_. c"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>r. if r = 1 then c else (0::'a)) sums c

goal (1 subgoal):
 1. (\<Sum>n. if n = 1 then c else (0::'a)) = c
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. if n = 1 then c else (0::'a)) = c

goal (1 subgoal):
 1. \<And>uu_. eval_fds (fds_const c) uu_ = c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
eval_fds (fds_const c) s = c
[PROOF STEP]
show "eval_fds (fds_const c) s = c"
[PROOF STATE]
proof (prove)
using this:
eval_fds (fds_const c) s = c

goal (1 subgoal):
 1. eval_fds (fds_const c) s = c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
eval_fds (fds_const c) s = c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma supportE_plus: "supportE (\<lambda>l s. e1 l s + e2 l s) \<subseteq> supportE e1 \<union> supportE e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supportE (\<lambda>l s. e1 l s + e2 l s) \<subseteq> supportE e1 \<union> supportE e2
[PROOF STEP]
unfolding supportE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> e1 l1 s + e2 l1 s \<noteq> e1 l2 s + e2 l2 s} \<subseteq> {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> e1 l1 s \<noteq> e1 l2 s} \<union> {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> e2 l1 s \<noteq> e2 l2 s}
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x l1 l2 s. \<lbrakk>\<forall>l1 l2. (\<exists>y. y \<noteq> x \<and> l1 y \<noteq> l2 y) \<or> (\<forall>s. e2 l1 s = e2 l2 s); \<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y; e1 l1 s + e2 l1 s \<noteq> e1 l2 s + e2 l2 s\<rbrakk> \<Longrightarrow> \<exists>l1 l2. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> (\<exists>s. e1 l1 s \<noteq> e1 l2 s)
[PROOF STEP]
by metis


[STATEMENT]
lemma chain_subdiv_chain_pathimg_subset:
  assumes "chain_subdiv_chain one_chain subdiv"
  shows "\<Union> (path_image ` {\<gamma>. \<exists>k. (k,\<gamma>)\<in> subdiv}) \<subseteq> \<Union> (path_image ` {\<gamma>. \<exists>k. (k,\<gamma>)\<in> one_chain})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> subdiv}) \<subseteq> \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> one_chain})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
chain_subdiv_chain one_chain subdiv

goal (1 subgoal):
 1. \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> subdiv}) \<subseteq> \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> one_chain})
[PROOF STEP]
unfolding chain_subdiv_chain_def pairwise_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f. \<Union> (f ` one_chain) = subdiv \<and> (\<forall>c\<in>one_chain. chain_subdiv_path (coeff_cube_to_path c) (f c)) \<and> (\<forall>x\<in>one_chain. \<forall>y\<in>one_chain. x \<noteq> y \<longrightarrow> f x \<inter> f y = {}) \<and> (\<forall>x\<in>one_chain. finite (f x))

goal (1 subgoal):
 1. \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> subdiv}) \<subseteq> \<Union> (path_image ` {\<gamma>. \<exists>k. (k, \<gamma>) \<in> one_chain})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b x f k aa ba. \<lbrakk>(a, b) \<in> path_image x; subdiv = \<Union> (f ` one_chain); (aa, ba) \<in> one_chain; (k, x) \<in> f (aa, ba); \<forall>c\<in>one_chain. chain_subdiv_path (coeff_cube_to_path c) (f c); \<forall>x\<in>one_chain. \<forall>y\<in>one_chain. x \<noteq> y \<longrightarrow> f x \<inter> f y = {}; \<forall>x\<in>one_chain. finite (f x)\<rbrakk> \<Longrightarrow> \<exists>x. (\<exists>k. (k, x) \<in> one_chain) \<and> (a, b) \<in> path_image x
[PROOF STEP]
by (metis UN_iff assms chain_subdiv_chain_pathimg_subset' subsetCE case_prodI2)


[STATEMENT]
lemma list2_middle_singleton:
  assumes "length xs = 3"
  shows "butlast (tl xs) = [xs ! 1]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (tl xs) = [xs ! 1]
[PROOF STEP]
proof (simp add: list_eq_iff_nth_eq assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. butlast (tl xs) ! 0 = xs ! Suc 0
[PROOF STEP]
have l: "length (butlast (tl xs)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (butlast (tl xs)) = 1
[PROOF STEP]
using length_butlast length_tl assms
[PROOF STATE]
proof (prove)
using this:
length (butlast ?xs) = length ?xs - 1
length (tl ?xs) = length ?xs - 1
length xs = 3

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

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = xs ! Suc 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (butlast (tl xs)) = 1
[PROOF STEP]
have " butlast (tl xs) ! 0 = (tl xs) ! 0"
[PROOF STATE]
proof (prove)
using this:
length (butlast (tl xs)) = 1

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = tl xs ! 0
[PROOF STEP]
using nth_butlast[of 0 "tl xs"]
[PROOF STATE]
proof (prove)
using this:
length (butlast (tl xs)) = 1
0 < length (butlast (tl xs)) \<Longrightarrow> butlast (tl xs) ! 0 = tl xs ! 0

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = tl xs ! 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
butlast (tl xs) ! 0 = tl xs ! 0

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = xs ! Suc 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
butlast (tl xs) ! 0 = tl xs ! 0
[PROOF STEP]
show "butlast (tl xs) ! 0 = xs ! Suc 0"
[PROOF STATE]
proof (prove)
using this:
butlast (tl xs) ! 0 = tl xs ! 0

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = xs ! Suc 0
[PROOF STEP]
using nth_tl[of 0 xs]  l
[PROOF STATE]
proof (prove)
using this:
butlast (tl xs) ! 0 = tl xs ! 0
0 < length (tl xs) \<Longrightarrow> tl xs ! 0 = xs ! Suc 0
length (butlast (tl xs)) = 1

goal (1 subgoal):
 1. butlast (tl xs) ! 0 = xs ! Suc 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
butlast (tl xs) ! 0 = xs ! Suc 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NSLIMSEQ_inverse_real_of_nat_add_minus: "(\<lambda>n. r + - inverse (real (Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. r + - inverse (real (Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r
[PROOF STEP]
using LIMSEQ_inverse_real_of_nat_add_minus
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ?r + - inverse (real (Suc n))) \<longlonglongrightarrow> ?r

goal (1 subgoal):
 1. (\<lambda>n. r + - inverse (real (Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S r
[PROOF STEP]
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric])


[STATEMENT]
lemma meta_all_eq_conv: "(\<And>a. a = b \<Longrightarrow> PROP P a) \<equiv> PROP P b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a = b \<Longrightarrow> PROP P a) \<equiv> PROP P b
[PROOF STEP]
apply(rule equal_intr_rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>a. a = b \<Longrightarrow> PROP P a) \<Longrightarrow> PROP P b
 2. \<And>a. \<lbrakk>PROP P b; a = b\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(erule meta_allE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (?a3 = b \<Longrightarrow> PROP P ?a3) \<Longrightarrow> PROP P b
 2. \<And>a. \<lbrakk>PROP P b; a = b\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(erule meta_mp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b = b
 2. \<And>a. \<lbrakk>PROP P b; a = b\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(rule refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>PROP P b; a = b\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(hypsubst)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. PROP P b \<Longrightarrow> PROP P b
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma concat_set:
  assumes "\<forall> q \<in> qs . \<exists> c \<in> set cs . Prime q \<in> set c"
  shows "\<forall> q \<in> qs . Prime q \<in> set (concat cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>q\<in>qs. Prime q \<in> set (concat cs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>q\<in>qs. \<exists>c\<in>set cs. Prime q \<in> set c

goal (1 subgoal):
 1. \<forall>q\<in>qs. Prime q \<in> set (concat cs)
[PROOF STEP]
by (induction cs) auto


[STATEMENT]
lemma out_lea__out:
  assumes "E Out D F" and
    "A B C LeA D E F"
  shows "B Out A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B Out A C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B Out A C
[PROOF STEP]
have "D E F CongA A B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D E F CongA A B C
[PROOF STEP]
using Tarski_neutral_dimensionless.l11_31_1 Tarski_neutral_dimensionless.lea_asym Tarski_neutral_dimensionless.lea_distincts Tarski_neutral_dimensionless_axioms assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Tarski_neutral_dimensionless ?Bet ?Cong; Tarski_neutral_dimensionless.Out ?Bet ?B ?A ?C; ?D \<noteq> ?E; ?F \<noteq> ?E\<rbrakk> \<Longrightarrow> Tarski_neutral_dimensionless.LeA ?Bet ?Cong ?A ?B ?C ?D ?E ?F
\<lbrakk>Tarski_neutral_dimensionless ?Bet ?Cong; Tarski_neutral_dimensionless.LeA ?Bet ?Cong ?A ?B ?C ?D ?E ?F; Tarski_neutral_dimensionless.LeA ?Bet ?Cong ?D ?E ?F ?A ?B ?C\<rbrakk> \<Longrightarrow> Tarski_neutral_dimensionless.CongA ?Bet ?Cong ?A ?B ?C ?D ?E ?F
\<lbrakk>Tarski_neutral_dimensionless ?Bet ?Cong; Tarski_neutral_dimensionless.LeA ?Bet ?Cong ?A ?B ?C ?D ?E ?F\<rbrakk> \<Longrightarrow> ?A \<noteq> ?B \<and> ?C \<noteq> ?B \<and> ?D \<noteq> ?E \<and> ?F \<noteq> ?E
Tarski_neutral_dimensionless Bet Cong
E Out D F
A B C LeA D E F

goal (1 subgoal):
 1. D E F CongA A B C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
D E F CongA A B C

goal (1 subgoal):
 1. B Out A C
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
D E F CongA A B C

goal (1 subgoal):
 1. B Out A C
[PROOF STEP]
using assms(1) out_conga_out
[PROOF STATE]
proof (prove)
using this:
D E F CongA A B C
E Out D F
\<lbrakk>?B Out ?A ?C; ?A ?B ?C CongA ?D ?E ?F\<rbrakk> \<Longrightarrow> ?E Out ?D ?F

goal (1 subgoal):
 1. B Out A C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B Out A C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma groups_of_size_max:
  assumes "g \<ge> \<v>"
  shows "groups_of_size g = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. groups_of_size g = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. groups_of_size g = 0
[PROOF STEP]
have "{G \<in> \<G> . card G = g} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {G \<in> \<G>. card G = g} = {}
[PROOF STEP]
using group_size_lt_v assms
[PROOF STATE]
proof (prove)
using this:
?G \<in> \<G> \<Longrightarrow> card ?G < \<v>
\<v> \<le> g

goal (1 subgoal):
 1. {G \<in> \<G>. card G = g} = {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{G \<in> \<G>. card G = g} = {}

goal (1 subgoal):
 1. groups_of_size g = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{G \<in> \<G>. card G = g} = {}

goal (1 subgoal):
 1. groups_of_size g = 0
[PROOF STEP]
unfolding groups_of_size_def
[PROOF STATE]
proof (prove)
using this:
{G \<in> \<G>. card G = g} = {}

goal (1 subgoal):
 1. card {G \<in> \<G>. card G = g} = 0
[PROOF STEP]
by (simp add: \<open>{G \<in> \<G>. card G = g} = {}\<close>)
[PROOF STATE]
proof (state)
this:
groups_of_size g = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_Ico_iff[simp]:
  "{a..<b} \<subseteq> {c..<b} \<longleftrightarrow> b \<le> a \<or> c \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a..<b} \<subseteq> {c..<b}) = (b \<le> a \<or> c \<le> a)
[PROOF STEP]
unfolding atLeastLessThan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a..} \<inter> {..<b} \<subseteq> {c..} \<inter> {..<b}) = (b \<le> a \<or> c \<le> a)
[PROOF STEP]
by auto


[STATEMENT]
lemma iMin_Min_conv: "
  \<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow> iMin I = Min I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin I = Min I
[PROOF STEP]
apply (rule order_antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin I \<le> Min I
 2. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> Min I \<le> iMin I
[PROOF STEP]
apply (rule Min_ge_iff[THEN iffD2], assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> \<forall>a\<in>I. iMin I \<le> a
 2. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> Min I \<le> iMin I
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> Min I \<le> iMin I
[PROOF STEP]
apply (rule Min_le_iff[THEN iffD2], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>I. a \<le> iMin I
[PROOF STEP]
apply (blast intro: iMinI_ex2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
      WHILE \<acute>M \<noteq> a
      DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD
      \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
let "\<Gamma>\<turnstile> _ ?while _" = ?thesis
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
let "\<lbrace>\<acute>?inv\<rbrace>" = "\<lbrace>\<acute>S = \<acute>M * b\<rbrace>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
have "\<lbrace>\<acute>M = 0 & \<acute>S = 0\<rbrace> \<subseteq> \<lbrace>\<acute>?inv\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> \<subseteq> \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> \<subseteq> \<lbrace>\<acute>S = \<acute>M * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> \<subseteq> \<lbrace>\<acute>S = \<acute>M * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<dots> ?while \<lbrace>\<acute>?inv \<and> \<not> (\<acute>M \<noteq> a)\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = \<acute>M * b \<and> \<not> \<acute>M \<noteq> a\<rbrace>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
let ?c = "\<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
have "\<lbrace>\<acute>?inv \<and> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<dots> ?c \<lbrace>\<acute>?inv\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
by vcg
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S + b = (\<acute>M + 1) * b\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
show "\<Gamma>\<turnstile> \<lbrace>\<acute>?inv \<and> \<acute>M \<noteq> a\<rbrace> ?c \<lbrace>\<acute>?inv\<rbrace>"
[PROOF STATE]
proof (prove)
using this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<noteq> a\<rbrace> \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 \<lbrace>\<acute>S = \<acute>M * b\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = \<acute>M * b \<and> \<not> \<acute>M \<noteq> a\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = \<acute>M * b\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = \<acute>M * b \<and> \<not> \<acute>M \<noteq> a\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
have "\<lbrace>\<acute>?inv \<and> \<not> (\<acute>M \<noteq> a)\<rbrace> \<subseteq> \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>\<acute>S = \<acute>M * b \<and> \<not> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrace>\<acute>S = \<acute>M * b \<and> \<not> \<acute>M \<noteq> a\<rbrace> \<subseteq> \<lbrace>\<acute>S = a * b\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{} \<subseteq> ?A \<Longrightarrow> \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>,?A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> ?A \<Longrightarrow> \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>,?A

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma similarity_decomposition:
  assumes "a \<noteq> 0"
  shows "moebius_similarity a b = (moebius_translation b) + (moebius_rotation (Arg a)) + (moebius_dilatation (cmod a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)
[PROOF STEP]
have "moebius_similarity a b = (moebius_translation b) + (moebius_rotation_dilatation a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation_dilatation a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation_dilatation a
[PROOF STEP]
unfolding moebius_rotation_dilatation_def moebius_translation_def moebius_similarity_def
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. mk_moebius a b 0 1 = mk_moebius 1 b 0 1 + mk_moebius a 0 0 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
moebius_similarity a b = moebius_translation b + moebius_rotation_dilatation a

goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
moebius_similarity a b = moebius_translation b + moebius_rotation_dilatation a

goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)
[PROOF STEP]
using moebius_rotation_dilatation [OF assms]
[PROOF STATE]
proof (prove)
using this:
moebius_similarity a b = moebius_translation b + moebius_rotation_dilatation a
moebius_rotation_dilatation a = moebius_rotation (Arg a) + moebius_dilatation (cmod a)

goal (1 subgoal):
 1. moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)
[PROOF STEP]
by (auto simp add: add.assoc simp del: plus_moebius_def)
[PROOF STATE]
proof (state)
this:
moebius_similarity a b = moebius_translation b + moebius_rotation (Arg a) + moebius_dilatation (cmod a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_hd_drop_zip:
  assumes "n < length x"
      and "length x = length y"
  shows "snd (hd (drop n (zip x y))) = hd (drop n y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (hd (drop n (zip x y))) = hd (drop n y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length x
length x = length y

goal (1 subgoal):
 1. snd (hd (drop n (zip x y))) = hd (drop n y)
[PROOF STEP]
by (induct x arbitrary: n y,auto)
     (metis (no_types, lifting) Cons_nth_drop_Suc drop_zip snd_conv length_Cons list.sel(1) zip_Cons_Cons)


[STATEMENT]
lemma open_segment_eq_real_ivl:
  fixes a b::real
  shows "open_segment a b = (if a \<le> b then {a<..<b} else {b<..<a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b = (if a \<le> b then {a<..<b} else {b<..<a})
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl open_segment_def split: if_split_asm)


[STATEMENT]
lemma liset_finite:
      assumes "lfinite w"
      shows "finite (liset A w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (liset A w)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. liset A w \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
show "liset A w \<subseteq> {i. enat i < llength w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liset A w \<subseteq> {i. enat i < llength w}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
liset A w \<subseteq> {i. enat i < llength w}

goal (1 subgoal):
 1. finite {i. enat i < llength w}
[PROOF STEP]
show "finite {i. enat i < llength w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. enat i < llength w}
[PROOF STEP]
using lfinite_finite_index assms
[PROOF STATE]
proof (prove)
using this:
lfinite ?xs \<Longrightarrow> finite {n. enat n < llength ?xs}
lfinite w

goal (1 subgoal):
 1. finite {i. enat i < llength w}
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
finite {i. enat i < llength w}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primitive_part_mult:
  fixes p q :: "'a :: {factorial_semiring, semiring_Gcd, ring_gcd, idom_divide,
                       normalization_semidom_multiplicative} poly"
  shows "primitive_part (p * q) = primitive_part p * primitive_part q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
have "primitive_part (p * q) = p * q div [:content (p * q):]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part (p * q) = p * q div [:content (p * q):]
[PROOF STEP]
by (simp add: primitive_part_def div_const_poly_conv_map_poly)
[PROOF STATE]
proof (state)
this:
primitive_part (p * q) = p * q div [:content (p * q):]

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
primitive_part (p * q) = p * q div [:content (p * q):]

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
have "\<dots> = (p div [:content p:]) * (q div [:content q:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * q div [:content (p * q):] = p div [:content p:] * (q div [:content q:])
[PROOF STEP]
by (subst div_mult_div_if_dvd) (simp_all add: content_mult mult_ac)
[PROOF STATE]
proof (state)
this:
p * q div [:content (p * q):] = p div [:content p:] * (q div [:content q:])

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * q div [:content (p * q):] = p div [:content p:] * (q div [:content q:])

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
have "\<dots> = primitive_part p * primitive_part q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p div [:content p:] * (q div [:content q:]) = primitive_part p * primitive_part q
[PROOF STEP]
by (simp add: primitive_part_def div_const_poly_conv_map_poly)
[PROOF STATE]
proof (state)
this:
p div [:content p:] * (q div [:content q:]) = primitive_part p * primitive_part q

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
primitive_part (p * q) = primitive_part p * primitive_part q

goal (1 subgoal):
 1. primitive_part (p * q) = primitive_part p * primitive_part q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
primitive_part (p * q) = primitive_part p * primitive_part q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diffeomorphism_compose:
  "diffeomorphism n S T f g \<Longrightarrow> diffeomorphism n T U h k \<Longrightarrow> open S \<Longrightarrow> open T \<Longrightarrow> open U \<Longrightarrow>
    diffeomorphism n S U (h \<circ> f) (g \<circ> k)"
  for f::"_\<Rightarrow>_::euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>diffeomorphism n S T f g; diffeomorphism n T U h k; open S; open T; open U\<rbrakk> \<Longrightarrow> diffeomorphism n S U (h \<circ> f) (g \<circ> k)
[PROOF STEP]
by (auto simp: diffeomorphism_def intro!: smooth_on_compose homeomorphism_compose)
    (auto simp: homeomorphism_def)


[STATEMENT]
lemma samp_uni_minus_one_time_pad:
  shows "map_spmf(\<lambda> b. (y + (q - b)) mod q) (sample_uniform q) = sample_uniform q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + (q - b)) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
using inj_on_minus surj_on_minus one_time_pad
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>b. (?y + (?q - b)) mod ?q) {..<?q}
inj_on (\<lambda>b. (?y + (?q - b)) mod ?q) {..<?q} \<Longrightarrow> (\<lambda>b. (?y + (?q - b)) mod ?q) ` {..<?q} = {..<?q}
\<lbrakk>inj_on ?f {..<?q}; ?f ` {..<?q} = {..<?q}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform ?q) = sample_uniform ?q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + (q - b)) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp


[STATEMENT]
lemma eval_at_point_a_inv:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "B \<in> carrier (coord_ring R  n)"
  shows "eval_at_point R a (\<ominus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> B) = \<ominus>\<^bsub>R\<^esub> eval_at_point R a B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R a (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> B) = \<ominus> eval_at_point R a B
[PROOF STEP]
using assms eval_at_point_subtract[of a n "\<zero>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub>" B]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
B \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>a \<in> carrier (R\<^bsup>n\<^esup>); \<zero>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<in> carrier (R [\<X>\<^bsub>n\<^esub>]); B \<in> carrier (R [\<X>\<^bsub>n\<^esub>])\<rbrakk> \<Longrightarrow> eval_at_point R a (\<zero>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> B) = eval_at_point R a \<zero>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> \<ominus> eval_at_point R a B

goal (1 subgoal):
 1. eval_at_point R a (\<ominus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> B) = \<ominus> eval_at_point R a B
[PROOF STEP]
by (smt MP.add.inv_eq_1_iff MP.l_zero MP.minus_add MP.zero_closed R.is_abelian_group R.r_neg R.r_neg2 a_minus_def abelian_group.a_inv_closed abelian_groupE(4) eval_at_point_add eval_at_point_closed)


[STATEMENT]
lemma eventually_nhds_in_nhd: "x \<in> interior s \<Longrightarrow> eventually (\<lambda>y. y \<in> s) (nhds x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> interior s \<Longrightarrow> \<forall>\<^sub>F y in nhds x. y \<in> s
[PROOF STEP]
using interior_subset[of s]
[PROOF STATE]
proof (prove)
using this:
interior s \<subseteq> s

goal (1 subgoal):
 1. x \<in> interior s \<Longrightarrow> \<forall>\<^sub>F y in nhds x. y \<in> s
[PROOF STEP]
by (subst eventually_nhds) blast


[STATEMENT]
lemma Gets_imp_Says:
     "\<lbrakk>Gets B X \<in> set evs; evs \<in> yahalom\<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Gets B X \<in> set evs; evs \<in> yahalom\<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs
[PROOF STEP]
by (erule rev_mp, erule yahalom.induct, auto)


[STATEMENT]
lemma pmf_finite_le: "finite (X :: ('a::finite) set) \<Longrightarrow> sum (pmf p) X \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X \<Longrightarrow> sum (pmf p) X \<le> 1
[PROOF STEP]
by (subst sum_pmf_eq_1[symmetric, of UNIV p]) (auto intro: sum_mono2)


[STATEMENT]
lemma (in Corps) invf_inv:"x \<in> carrier K - {\<zero>} \<Longrightarrow>
                (invf K x) \<in> carrier K \<and> (invf K x) \<cdot>\<^sub>r x = 1\<^sub>r "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier K - {\<zero>} \<Longrightarrow> invf K x \<in> carrier K \<and> invf K x \<cdot>\<^sub>r x = 1\<^sub>r
[PROOF STEP]
apply (simp add:invf_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier K \<and> x \<noteq> \<zero> \<Longrightarrow> (THE y. y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r) \<in> carrier K \<and> (THE y. y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r) \<cdot>\<^sub>r x = 1\<^sub>r
[PROOF STEP]
apply (rule theI')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier K \<and> x \<noteq> \<zero> \<Longrightarrow> \<exists>!xa. xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r
[PROOF STEP]
apply (rule ex_ex1I)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<in> carrier K \<and> x \<noteq> \<zero> \<Longrightarrow> \<exists>xa. xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r
 2. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
apply (cut_tac f_inv, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
apply (rule_tac x' = xa and x'' = y in f_inv_unique[of x])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> x \<in> carrier K - {\<zero>}
 2. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> xa \<in> carrier K
 3. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> y \<in> carrier K
 4. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> xa \<cdot>\<^sub>r x = 1\<^sub>r
 5. \<And>xa y. \<lbrakk>x \<in> carrier K \<and> x \<noteq> \<zero>; xa \<in> carrier K \<and> xa \<cdot>\<^sub>r x = 1\<^sub>r; y \<in> carrier K \<and> y \<cdot>\<^sub>r x = 1\<^sub>r\<rbrakk> \<Longrightarrow> y \<cdot>\<^sub>r x = 1\<^sub>r
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma in_joinI: "table n A X \<Longrightarrow> table n B Y \<Longrightarrow> (\<not>b \<Longrightarrow> B \<subseteq> A) \<Longrightarrow> wf_tuple n (A \<union> B) v \<Longrightarrow>
  restrict A v \<in> X \<Longrightarrow> (b \<Longrightarrow> restrict B v \<in> Y) \<Longrightarrow> (\<not>b \<Longrightarrow> restrict B v \<notin> Y) \<Longrightarrow> v \<in> join X b Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>table n A X; table n B Y; \<not> b \<Longrightarrow> B \<subseteq> A; wf_tuple n (A \<union> B) v; restrict A v \<in> X; b \<Longrightarrow> restrict B v \<in> Y; \<not> b \<Longrightarrow> restrict B v \<notin> Y\<rbrakk> \<Longrightarrow> v \<in> join X b Y
[PROOF STEP]
unfolding table_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ball X (wf_tuple n A); Ball Y (wf_tuple n B); \<not> b \<Longrightarrow> B \<subseteq> A; wf_tuple n (A \<union> B) v; restrict A v \<in> X; b \<Longrightarrow> restrict B v \<in> Y; \<not> b \<Longrightarrow> restrict B v \<notin> Y\<rbrakk> \<Longrightarrow> v \<in> join X b Y
[PROOF STEP]
by (subst join_restrict) (auto)


[STATEMENT]
lemma fill_offs_enum_count_item [rule_format]:
 "\<lbrakk>index_less index key; \<forall>x \<in> set xs. key x \<in> {mi..ma}; 0 < n\<rbrakk> \<Longrightarrow>
    count (mset (map the (fill xs (offs (enum xs index key n mi ma) 0)
      index key (length xs) mi ma))) x =
    count (mset xs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>index_less index key; \<forall>x\<in>set xs. key x \<in> {mi..ma}; 0 < n\<rbrakk> \<Longrightarrow> count (mset (map the (fill xs (offs (enum xs index key n mi ma) 0) index key (length xs) mi ma))) x = count (mset xs) x
[PROOF STEP]
by (subst fill_count_item, simp_all, simp only: length_greater_0_conv [symmetric]
 offs_length enum_length, insert offs_enum_pred [of index key xs mi ma n 0], simp)


[STATEMENT]
lemma dirichlet_prod_Suc_0 [simp]: "dirichlet_prod f g (Suc 0) = f (Suc 0) * g (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f g (Suc 0) = f (Suc 0) * g (Suc 0)
[PROOF STEP]
by (simp add: dirichlet_prod_def)


[STATEMENT]
lemma iIN_iFROM_union: "
  n' \<le> Suc (n + d) \<Longrightarrow> [n\<dots>,d] \<union> [n'\<dots>] = [min n n'\<dots>]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n' \<le> Suc (n + d) \<Longrightarrow> [n\<dots>,d] \<union> [n'\<dots>] = [min n n'\<dots>]
[PROOF STEP]
by (fastforce simp: iIN_iff)


[STATEMENT]
lemma measure_Un_AE:
  "AE x in M. x \<notin> A \<or> x \<notin> B \<Longrightarrow> A \<in> fmeasurable M \<Longrightarrow> B \<in> fmeasurable M \<Longrightarrow>
  measure M (A \<union> B) = measure M A + measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>AE x in M. x \<notin> A \<or> x \<notin> B; A \<in> fmeasurable M; B \<in> fmeasurable M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B
[PROOF STEP]
by (subst measure_Un2) (auto intro!: measure_eq_AE)


[STATEMENT]
lemma (in Order) fTo_Order_sub:"\<lbrakk>A \<in> carrier (fTo D); B \<in> carrier (fTo D)\<rbrakk>
         \<Longrightarrow> (A \<preceq>\<^bsub>(fTo D)\<^esub> B) = (A \<subseteq> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier fTo D; B \<in> carrier fTo D\<rbrakk> \<Longrightarrow> A \<preceq>\<^bsub>fTo D\<^esub> B = (A \<subseteq> B)
[PROOF STEP]
by (subst ole_def, simp add:family_Torder_def)


[STATEMENT]
lemma arr_Rel_comp_Rel_assoc[dg_Rel_shared_cs_simps, dg_Rel_cs_simps]:
  "(H \<circ>\<^sub>R\<^sub>e\<^sub>l G) \<circ>\<^sub>R\<^sub>e\<^sub>l F = H \<circ>\<^sub>R\<^sub>e\<^sub>l (G \<circ>\<^sub>R\<^sub>e\<^sub>l F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<circ>\<^sub>R\<^sub>e\<^sub>l G \<circ>\<^sub>R\<^sub>e\<^sub>l F = H \<circ>\<^sub>R\<^sub>e\<^sub>l (G \<circ>\<^sub>R\<^sub>e\<^sub>l F)
[PROOF STEP]
by (simp add: comp_Rel_def vcomp_assoc arr_field_simps nat_omega_simps)


[STATEMENT]
lemma tendsto_poly [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. poly p (f x)) \<longlongrightarrow> poly p a) F"
  for f :: "_ \<Rightarrow> 'a::real_normed_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. poly p (f x)) \<longlongrightarrow> poly p a) F
[PROOF STEP]
by (rule isCont_tendsto_compose [OF poly_isCont])


[STATEMENT]
lemma integral_sum:
  "\<lbrakk>finite I;  \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow>
   integral S (\<lambda>x. \<Sum>a\<in>I. f a x) = (\<Sum>a\<in>I. integral S (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow> integral S (\<lambda>x. \<Sum>a\<in>I. f a x) = (\<Sum>a\<in>I. integral S (f a))
[PROOF STEP]
by (simp add: has_integral_sum integrable_integral integral_unique)


[STATEMENT]
lemma desargues_config_rot_CW:
  assumes "desargues_config A B C A' B' C' M N P R"
  shows "desargues_config C A B C' A' B' P M N R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. desargues_config C A B C' A' B' P M N R
[PROOF STEP]
by (smt assms col_rot_CW desargues_config_def distinct3_def distinct7_rot_CW line_comm
      meet_3_in_def meet_all_3 meet_comm)


[STATEMENT]
lemma bdia_bbox_demorgan: "(\<langle>R| (f::'b \<Rightarrow> 'c::complete_boolean_algebra) x) = - [R| (\<lambda>y. -f y) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  \<langle>R| f x = - [R| (\<lambda>y. - f y) x
[PROOF STEP]
apply (simp add: bbox_def bdia_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>{f xa |xa. (xa, x) \<in> R} = - \<Sqinter>{- f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Squnion>{f xa |xa. (xa, x) \<in> R} \<le> - \<Sqinter>{- f xa |xa. (xa, x) \<in> R}
 2. - \<Sqinter>{- f xa |xa. (xa, x) \<in> R} \<le> \<Squnion>{f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> {f xa |xa. (xa, x) \<in> R} \<Longrightarrow> xa \<le> - \<Sqinter>{- f xa |xa. (xa, x) \<in> R}
 2. - \<Sqinter>{- f xa |xa. (xa, x) \<in> R} \<le> \<Squnion>{f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
apply (simp add: Inf_lower compl_le_swap1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Sqinter>{- f xa |xa. (xa, x) \<in> R} \<le> \<Squnion>{f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
apply (simp add: uminus_Inf)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>(uminus ` {- f xa |xa. (xa, x) \<in> R}) \<le> \<Squnion>{f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
apply (rule SUP_least; intro Sup_upper)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {- f xa |xa. (xa, x) \<in> R} \<Longrightarrow> - xa \<in> {f xa |xa. (xa, x) \<in> R}
[PROOF STEP]
by auto


[STATEMENT]
lemma subd_power_uminus: "subd p (frag_cmul ((-1) ^ k) c) = frag_cmul ((-1) ^ k) (subd p c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subd p (frag_cmul ((- 1) ^ k) c) = frag_cmul ((- 1) ^ k) (subd p c)
[PROOF STEP]
apply (induction k, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. subd p (frag_cmul ((- 1) ^ k) c) = frag_cmul ((- 1) ^ k) (subd p c) \<Longrightarrow> subd p (frag_cmul (- ((- 1) ^ k)) c) = frag_cmul (- ((- 1) ^ k)) (subd p c)
[PROOF STEP]
by (metis minus_frag_cmul subd_uminus)


[STATEMENT]
theorem cond_3':
  assumes "s\<^sub>o \<le> ego.s_stop" "ego.s_stop < other.s_stop"
  shows "collision {0..} \<longleftrightarrow> (a\<^sub>o > a\<^sub>e \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
proof (cases "a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>o \<ge> v\<^sub>e")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
 2. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o

goal (2 subgoals):
 1. a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
 2. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
with cond_3[OF assms]
[PROOF STATE]
proof (chain)
picking this:
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o

goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)

goal (1 subgoal):
 1. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)

goal (1 subgoal):
 1. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
from \<open>\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)
[PROOF STEP]
have "a\<^sub>o > a\<^sub>e"
[PROOF STATE]
proof (prove)
using this:
\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)

goal (1 subgoal):
 1. a\<^sub>e < a\<^sub>o
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a\<^sub>e < a\<^sub>o

goal (1 subgoal):
 1. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
from \<open>\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)
[PROOF STEP]
have "v\<^sub>o < v\<^sub>e"
[PROOF STATE]
proof (prove)
using this:
\<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o)

goal (1 subgoal):
 1. v\<^sub>o < v\<^sub>e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v\<^sub>o < v\<^sub>e

goal (1 subgoal):
 1. \<not> (a\<^sub>o \<le> a\<^sub>e \<or> v\<^sub>e \<le> v\<^sub>o) \<Longrightarrow> collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
from snd_safe_distance_iff_nonneg_D2 [OF \<open>a\<^sub>o > a\<^sub>e\<close>]
[PROOF STATE]
proof (chain)
picking this:
(s\<^sub>o - s\<^sub>e \<le> snd_safe_distance) = (0 \<le> D2)
[PROOF STEP]
have 1: "(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) \<longleftrightarrow>
          (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)"
[PROOF STATE]
proof (prove)
using this:
(s\<^sub>o - s\<^sub>e \<le> snd_safe_distance) = (0 \<le> D2)

goal (1 subgoal):
 1. (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)

goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
from t_stop_diff_neg_means_leq_D2[OF assms \<open>a\<^sub>e < a\<^sub>o\<close>]
[PROOF STATE]
proof (chain)
picking this:
0 \<le> D2 \<Longrightarrow> (v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
[PROOF STEP]
have "... = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> sqrt D2 > v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> D2 \<Longrightarrow> (v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)

goal (1 subgoal):
 1. (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)

goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
with 1 cond_3[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)
(a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0) = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> 0 \<le> D2 \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < sqrt D2)

goal (1 subgoal):
 1. collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
collision {0..} = (a\<^sub>e < a\<^sub>o \<and> v\<^sub>o < v\<^sub>e \<and> s\<^sub>o - s\<^sub>e \<le> snd_safe_distance \<and> v\<^sub>e - a\<^sub>e / a\<^sub>o * v\<^sub>o < 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tpa_states:
  "\<lbrakk>tp = concat (take as (tms_of ap));
  as \<le> length ap\<rbrakk> \<Longrightarrow>
  start_of (layout_of ap) as = Suc (length tp div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2)
[PROOF STEP]
proof(induct as arbitrary: tp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>tp. \<lbrakk>tp = concat (take 0 (tms_of ap)); 0 \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) 0 = Suc (length tp div 2)
 2. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
tp = concat (take 0 (tms_of ap))
0 \<le> length ap

goal (2 subgoals):
 1. \<And>tp. \<lbrakk>tp = concat (take 0 (tms_of ap)); 0 \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) 0 = Suc (length tp div 2)
 2. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
thus "?case"
[PROOF STATE]
proof (prove)
using this:
tp = concat (take 0 (tms_of ap))
0 \<le> length ap

goal (1 subgoal):
 1. start_of (layout_of ap) 0 = Suc (length tp div 2)
[PROOF STEP]
by(simp add: start_of.simps)
[PROOF STATE]
proof (state)
this:
start_of (layout_of ap) 0 = Suc (length tp div 2)

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
case (Suc as tp)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length ?tp div 2)
tp = concat (take (Suc as) (tms_of ap))
Suc as \<le> length ap

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
have ind: "\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow>
    start_of (layout_of ap) as = Suc (length tp div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
\<lbrakk>?tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length ?tp div 2)

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
have tp: "tp = concat (take (Suc as) (tms_of ap))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tp = concat (take (Suc as) (tms_of ap))
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
tp = concat (take (Suc as) (tms_of ap))

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
have le: "Suc as \<le> length ap"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc as \<le> length ap
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
Suc as \<le> length ap

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
have a: "start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
Suc as \<le> length ap

goal (1 subgoal):
 1. start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)
[PROOF STEP]
by(intro ind, simp_all)
[PROOF STATE]
proof (state)
this:
start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)

goal (1 subgoal):
 1. \<And>as tp. \<lbrakk>\<And>tp. \<lbrakk>tp = concat (take as (tms_of ap)); as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) as = Suc (length tp div 2); tp = concat (take (Suc as) (tms_of ap)); Suc as \<le> length ap\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
from a tp le
[PROOF STATE]
proof (chain)
picking this:
start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)
tp = concat (take (Suc as) (tms_of ap))
Suc as \<le> length ap
[PROOF STEP]
show "?case"
[PROOF STATE]
proof (prove)
using this:
start_of (layout_of ap) as = Suc (length (concat (take as (tms_of ap))) div 2)
tp = concat (take (Suc as) (tms_of ap))
Suc as \<le> length ap

goal (1 subgoal):
 1. start_of (layout_of ap) (Suc as) = Suc (length tp div 2)
[PROOF STEP]
apply(simp add: start_of.simps take_Suc_conv_app_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap\<rbrakk> \<Longrightarrow> length (concat (take as (tms_of ap))) div 2 + layout_of ap ! as = (length (concat (take as (tms_of ap))) + length (tms_of ap ! as)) div 2
[PROOF STEP]
apply(subgoal_tac "length (concat (take as (tms_of ap))) mod 2= 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap))))\<rbrakk> \<Longrightarrow> length (concat (take as (tms_of ap))) div 2 + layout_of ap ! as = (length (concat (take as (tms_of ap))) + length (tms_of ap ! as)) div 2
 2. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap\<rbrakk> \<Longrightarrow> is_even (length (concat (take as (tms_of ap))))
[PROOF STEP]
apply(subgoal_tac " length (tms_of ap ! as) mod 2 = 0")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap)))); is_even (length (tms_of ap ! as))\<rbrakk> \<Longrightarrow> length (concat (take as (tms_of ap))) div 2 + layout_of ap ! as = (length (concat (take as (tms_of ap))) + length (tms_of ap ! as)) div 2
 2. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap))))\<rbrakk> \<Longrightarrow> is_even (length (tms_of ap ! as))
 3. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap\<rbrakk> \<Longrightarrow> is_even (length (concat (take as (tms_of ap))))
[PROOF STEP]
apply(simp add: Abacus.div_apart)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap)))); is_even (length (tms_of ap ! as))\<rbrakk> \<Longrightarrow> layout_of ap ! as = length (tms_of ap ! as) div 2
 2. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap))))\<rbrakk> \<Longrightarrow> is_even (length (tms_of ap ! as))
 3. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap\<rbrakk> \<Longrightarrow> is_even (length (concat (take as (tms_of ap))))
[PROOF STEP]
apply(simp add: layout_of.simps ci_length  tms_of.simps tpairs_of.simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap; is_even (length (concat (take as (tms_of ap))))\<rbrakk> \<Longrightarrow> is_even (length (tms_of ap ! as))
 2. \<lbrakk>sum_list (take as (layout_of ap)) = length (concat (take as (tms_of ap))) div 2; tp = concat (take as (tms_of ap)) @ tms_of ap ! as; Suc as \<le> length ap\<rbrakk> \<Longrightarrow> is_even (length (concat (take as (tms_of ap))))
[PROOF STEP]
apply(auto  intro: compile_mod2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
start_of (layout_of ap) (Suc as) = Suc (length tp div 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_le_antisym: "\<lbrakk>z \<le> w; w \<le> z\<rbrakk> \<Longrightarrow> z = (w::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z \<le> w; w \<le> z\<rbrakk> \<Longrightarrow> z = w
[PROOF STEP]
by (cases z, cases w, simp add: real_le)


[STATEMENT]
lemma distinct_merge[simp]: "\<lbrakk> distinct xs; distinct ys; List.sorted xs; List.sorted ys \<rbrakk> \<Longrightarrow> distinct (merge xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> distinct (merge xs ys)
[PROOF STEP]
by (induct xs ys rule: merge.induct, auto)


[STATEMENT]
lemma pick_card_in_set: "i\<in>I \<Longrightarrow> pick I (card {a\<in>I. a < i}) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> pick I (card {a \<in> I. a < i}) = i
[PROOF STEP]
unfolding pick_card
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> (LEAST a. a \<in> I \<and> i \<le> a) = i
[PROOF STEP]
using Least_equality order_refl
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?x; \<And>y. ?P y \<Longrightarrow> ?x \<le> y\<rbrakk> \<Longrightarrow> Least ?P = ?x
?x \<le> ?x

goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> (LEAST a. a \<in> I \<and> i \<le> a) = i
[PROOF STEP]
by (metis (no_types, lifting))


[STATEMENT]
lemma inside_frontier_eq_interior:
     fixes S :: "'a :: {real_normed_vector, perfect_space} set"
     shows "\<lbrakk>bounded S; convex S\<rbrakk> \<Longrightarrow> inside(frontier S) = interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded S; convex S\<rbrakk> \<Longrightarrow> inside (frontier S) = interior S
[PROOF STEP]
apply (simp add: inside_outside outside_frontier_eq_complement_closure)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded S; convex S\<rbrakk> \<Longrightarrow> - frontier S \<inter> closure S = interior S
[PROOF STEP]
using closure_subset interior_subset
[PROOF STATE]
proof (prove)
using this:
?S \<subseteq> closure ?S
interior ?S \<subseteq> ?S

goal (1 subgoal):
 1. \<lbrakk>bounded S; convex S\<rbrakk> \<Longrightarrow> - frontier S \<inter> closure S = interior S
[PROOF STEP]
apply (auto simp: frontier_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma C5_b: "-l x r\<rightarrow> -l y = y l\<rightarrow> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. -l x r\<rightarrow> -l y = y l\<rightarrow> x
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. -l x r\<rightarrow> -l y \<le> y l\<rightarrow> x
 2. y l\<rightarrow> x \<le> -l x r\<rightarrow> -l y
[PROOF STEP]
apply (simp add: order_l W5a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y l\<rightarrow> x \<le> -l x r\<rightarrow> -l y
[PROOF STEP]
apply (cut_tac a = "-l y" and b = "-l x" in W5b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (-r (-l y) l\<rightarrow> -r (-l x)) l\<rightarrow> -l x r\<rightarrow> -l y = (1::'a) \<Longrightarrow> y l\<rightarrow> x \<le> -l x r\<rightarrow> -l y
[PROOF STEP]
by (simp add: order_l)