[STATEMENT]
lemma lsorted_lhdD:
  "\<lbrakk> lsorted xs; \<not> lnull xs; \<not> lnull (ltl xs) \<rbrakk> \<Longrightarrow> lhd xs \<le> lhd (ltl xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>lsorted xs; \<not> lnull xs; \<not> lnull (ltl xs)\<rbrakk> \<Longrightarrow> lhd xs \<le> lhd (ltl xs)
[PROOF STEP]
by(auto elim: lsorted.cases)


[STATEMENT]
lemma one_time_pad_units:
  assumes inj_on: "inj_on f ({..<q} - {0})"
    and sur: "f ` ({..<q} - {0}) = ({..<q} - {0})"
  shows "map_spmf f (sample_uniform_units q) = (sample_uniform_units q)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
have rhs: "?rhs = spmf_of_set (({..<q} - {0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sample_uniform_units q = spmf_of_set ({..<q} - {0})
[PROOF STEP]
by(auto simp add: sample_uniform_units_def)
[PROOF STATE]
proof (state)
this:
sample_uniform_units q = spmf_of_set ({..<q} - {0})

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sample_uniform_units q = spmf_of_set ({..<q} - {0})

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
have "map_spmf(\<lambda>s. f s) (spmf_of_set ({..<q} - {0})) = spmf_of_set ((\<lambda>s. f s) ` ({..<q} - {0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (spmf_of_set ({..<q} - {0})) = spmf_of_set (f ` ({..<q} - {0}))
[PROOF STEP]
by(simp add: inj_on)
[PROOF STATE]
proof (state)
this:
map_spmf f (spmf_of_set ({..<q} - {0})) = spmf_of_set (f ` ({..<q} - {0}))

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_spmf f (spmf_of_set ({..<q} - {0})) = spmf_of_set (f ` ({..<q} - {0}))

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
have "f ` ({..<q} - {0}) = ({..<q} - {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` ({..<q} - {0}) = {..<q} - {0}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite ({..<q} - {0})
 2. f ` ({..<q} - {0}) \<subseteq> {..<q} - {0}
 3. inj_on f ({..<q} - {0})
[PROOF STEP]
by(simp, simp add: sur, simp add: inj_on)
[PROOF STATE]
proof (state)
this:
f ` ({..<q} - {0}) = {..<q} - {0}

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
map_spmf f (sample_uniform_units q) = spmf_of_set (f ` ({..<q} - {0}))
f ` ({..<q} - {0}) = {..<q} - {0}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map_spmf f (sample_uniform_units q) = spmf_of_set (f ` ({..<q} - {0}))
f ` ({..<q} - {0}) = {..<q} - {0}

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
using rhs
[PROOF STATE]
proof (prove)
using this:
map_spmf f (sample_uniform_units q) = spmf_of_set (f ` ({..<q} - {0}))
f ` ({..<q} - {0}) = {..<q} - {0}
sample_uniform_units q = spmf_of_set ({..<q} - {0})

goal (1 subgoal):
 1. map_spmf f (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map_spmf f (sample_uniform_units q) = sample_uniform_units q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_FGf_mono:
  "\<lbrakk> L1 \<le> L1'; L2 \<le> L2'; Co1 \<le> Co1'; Co2 \<le> Co2'; Contra1' \<le> Contra1; Contra2' \<le> Contra2 \<rbrakk> \<Longrightarrow>
  rel_FGf L1 L2 Co1 Co2 Contra1 Contra2 \<le> rel_FGf L1' L2' Co1' Co2' Contra1' Contra2'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L1 \<le> L1'; L2 \<le> L2'; Co1 \<le> Co1'; Co2 \<le> Co2'; Contra1' \<le> Contra1; Contra2' \<le> Contra2\<rbrakk> \<Longrightarrow> rel_FGf L1 L2 Co1 Co2 Contra1 Contra2 \<le> rel_FGf L1' L2' Co1' Co2' Contra1' Contra2'
[PROOF STEP]
unfolding rel_FGf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L1 \<le> L1'; L2 \<le> L2'; Co1 \<le> Co1'; Co2 \<le> Co2'; Contra1' \<le> Contra1; Contra2' \<le> Contra2\<rbrakk> \<Longrightarrow> rel_F L1 L2 (=) Co1 Co2 (=) Contra1 Contra2 (=) \<le> rel_F L1' L2' (=) Co1' Co2' (=) Contra1' Contra2' (=)
[PROOF STEP]
by (rule rel_F_mono) (auto)


[STATEMENT]
lemma "strassen_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 7)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strassen_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 7)
[PROOF STEP]
using strassen_cost_pos
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?n \<Longrightarrow> 0 < strassen_cost ?n

goal (1 subgoal):
 1. strassen_cost \<in> \<Theta>(\<lambda>n. real n powr log 2 7)
[PROOF STEP]
by (master_theorem 1 p': 2) (auto simp: powr_divide eventually_at_top_linorder)


[STATEMENT]
lemma conj_not_bot: "a \<iinter> b \<noteq> \<bottom> \<Longrightarrow> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<iinter> b \<noteq> \<bottom> \<Longrightarrow> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>
variables:
a, b :: 'a
(\<iinter>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using conj_bot_right
[PROOF STATE]
proof (prove)
using this:
(?c::'a::refinement_lattice) \<iinter> \<bottom> = \<bottom>

goal (1 subgoal):
 1. a \<iinter> b \<noteq> \<bottom> \<Longrightarrow> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>
variables:
a, b :: 'a
(\<iinter>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by auto


[STATEMENT]
lemma atLeastatMost_subset_iff[simp]:
  "{a\<le>\<^sub>a..\<le>\<^sub>ab} \<le> {c\<le>\<^sub>a..\<le>\<^sub>ad} \<longleftrightarrow> (\<not> a \<le>\<^sub>a b) \<or> c \<le>\<^sub>a a \<and> b \<le>\<^sub>a d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a\<le>\<^sub>a..\<le>\<^sub>ab} \<subseteq> {c\<le>\<^sub>a..\<le>\<^sub>ad}) = (\<not> a \<le>\<^sub>a b \<or> c \<le>\<^sub>a a \<and> b \<le>\<^sub>a d)
[PROOF STEP]
by auto (blast intro: order_trans)+


[STATEMENT]
lemma restriction_add_res:
  "(v=u--w)
    \<longrightarrow> |restrict v (res ts) c|=|restrict u (res ts) c|+|restrict w (res ts) c|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v=u--w \<longrightarrow> |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v=u--w \<Longrightarrow> |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
assume assm: "v=u--w"
[PROOF STATE]
proof (state)
this:
v=u--w

goal (1 subgoal):
 1. v=u--w \<Longrightarrow> |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v=u--w
[PROOF STEP]
have 1:"restrict u (res ts) c \<sqinter> restrict w (res ts) c = \<emptyset>"
[PROOF STATE]
proof (prove)
using this:
v=u--w

goal (1 subgoal):
 1. restrict u (res ts) c \<sqinter> restrict w (res ts) c = bot
[PROOF STEP]
using restriction.restriction_disj
[PROOF STATE]
proof (prove)
using this:
v=u--w
?v=?u--?w \<longrightarrow> restrict ?u ?f ?c \<sqinter> restrict ?w ?f ?c = bot

goal (1 subgoal):
 1. restrict u (res ts) c \<sqinter> restrict w (res ts) c = bot
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
restrict u (res ts) c \<sqinter> restrict w (res ts) c = bot

goal (1 subgoal):
 1. v=u--w \<Longrightarrow> |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
from assm
[PROOF STATE]
proof (chain)
picking this:
v=u--w
[PROOF STEP]
have "restrict v (res ts) c=restrict u (res ts) c\<squnion>restrict w (res ts) c"
[PROOF STATE]
proof (prove)
using this:
v=u--w

goal (1 subgoal):
 1. restrict v (res ts) c = restrict u (res ts) c \<squnion> restrict w (res ts) c
[PROOF STEP]
using restriction.restriction_un
[PROOF STATE]
proof (prove)
using this:
v=u--w
?v=?u--?w \<longrightarrow> restrict ?v ?f ?c = restrict ?u ?f ?c \<squnion> restrict ?w ?f ?c

goal (1 subgoal):
 1. restrict v (res ts) c = restrict u (res ts) c \<squnion> restrict w (res ts) c
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
restrict v (res ts) c = restrict u (res ts) c \<squnion> restrict w (res ts) c

goal (1 subgoal):
 1. v=u--w \<Longrightarrow> |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
restrict u (res ts) c \<sqinter> restrict w (res ts) c = bot
restrict v (res ts) c = restrict u (res ts) c \<squnion> restrict w (res ts) c
[PROOF STEP]
show " |restrict v (res ts) c|=|restrict u (res ts) c|+|restrict w (res ts) c|"
[PROOF STATE]
proof (prove)
using this:
restrict u (res ts) c \<sqinter> restrict w (res ts) c = bot
restrict v (res ts) c = restrict u (res ts) c \<squnion> restrict w (res ts) c

goal (1 subgoal):
 1. |restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|
[PROOF STEP]
by (metis add.right_neutral add_cancel_left_left assm nat_int.card_empty_zero
        nat_int.card_un_add nat_int.un_empty_absorb1 nat_int.un_empty_absorb2
        restriction.restriction_consec_res)
[PROOF STATE]
proof (state)
this:
|restrict v (res ts) c| = |restrict u (res ts) c| + |restrict w (res ts) c|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parts_analz [simp]: "parts (analz H) = parts H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (analz H) = parts H
[PROOF STEP]
by (metis analz_increasing analz_subset_parts equalityI parts_mono parts_subset_iff)


[STATEMENT]
lemma gauge_existence_lemma:
  "(\<forall>x. \<exists>d :: real. p x \<longrightarrow> 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. p x \<longrightarrow> q d x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. \<exists>d. p x \<longrightarrow> 0 < d \<and> q d x) = (\<forall>x. \<exists>d>0. p x \<longrightarrow> q d x)
[PROOF STEP]
by (metis zero_less_one)


[STATEMENT]
lemma hadamard_on_zero:
  "hadamard *\<^sub>v ket_zero = ket_plus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hadamard *\<^sub>v ket_zero = ket_plus
[PROOF STEP]
unfolding hadamard_def ket_zero_def ket_plus_def mat_of_rows_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 2 2 (\<lambda>(i, j). if i = 0 \<or> j = 0 then 1 / csqrt 2 else complex_of_real (- 1 / sqrt 2)) *\<^sub>v Matrix.vec 2 (\<lambda>k. if k = 0 then 1 else 0) = Matrix.vec 2 (\<lambda>k. 1 / csqrt 2)
[PROOF STEP]
apply (rule eq_vecI, auto simp add: scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < 2 \<Longrightarrow> (\<Sum>ia = 0..<2. (if i = 0 \<or> ia = 0 then 1 / csqrt 2 else complex_of_real (- 1 / sqrt 2)) * (if ia = 0 then 1 else 0)) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < 2 \<Longrightarrow> (\<Sum>ia = 0..<2. (if i = 0 \<or> ia = 0 then 1 / csqrt 2 else complex_of_real (- 1 / sqrt 2)) * (if ia = 0 then 1 else 0)) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (drule less_2_cases)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = 0 \<or> i = Suc 0 \<Longrightarrow> (\<Sum>ia = 0..<2. (if i = 0 \<or> ia = 0 then 1 / csqrt 2 else complex_of_real (- 1 / sqrt 2)) * (if ia = 0 then 1 else 0)) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (drule disjE, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> (\<Sum>i = 0..<2. (if i = 0 then 1 else 0) / complex_of_real (sqrt 2)) = 1 / complex_of_real (sqrt 2)
 2. i = Suc 0 \<Longrightarrow> (\<Sum>i = 0..<2. (if i = 0 then 1 / csqrt 2 else complex_of_real (- 1 / sqrt 2)) * (if i = 0 then 1 else 0)) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
by (subst sum_le_2, auto)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma F2map_comp_id: "F2map g1 g2 g3 (F2map id f2 f3 x) = F2map g1 (g2 o f2) (g3 o f3) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F2map g1 g2 g3 (F2map id f2 f3 x) = F2map g1 (g2 \<circ> f2) (g3 \<circ> f3) x
[PROOF STEP]
apply (rule trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. F2map g1 g2 g3 (F2map id f2 f3 x) = ?s
 2. ?s = F2map g1 (g2 \<circ> f2) (g3 \<circ> f3) x
[PROOF STEP]
apply (rule F2.map_comp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F2map (g1 \<circ> id) (g2 \<circ> f2) (g3 \<circ> f3) x = F2map g1 (g2 \<circ> f2) (g3 \<circ> f3) x
[PROOF STEP]
unfolding o_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F2map g1 (g2 \<circ> f2) (g3 \<circ> f3) x = F2map g1 (g2 \<circ> f2) (g3 \<circ> f3) x
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma liminf_upper_bound:
  fixes u:: "nat \<Rightarrow> ereal"
  assumes "liminf u < l"
  shows "\<exists>N>k. u N < l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N>k. u N < l
[PROOF STEP]
by (metis assms gt_ex less_le_trans liminf_bounded_iff not_less)


[STATEMENT]
lemma Ints_subset_Rats: "\<int> \<subseteq> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<int> \<subseteq> \<rat>
[PROOF STEP]
using Ints_cases Rats_of_int
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> \<int>; \<And>z. ?q = of_int z \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
of_int ?z \<in> \<rat>

goal (1 subgoal):
 1. \<int> \<subseteq> \<rat>
[PROOF STEP]
by blast


[STATEMENT]
lemma y_x[simp]: fixes x :: "'a :: comm_ring_1" shows "poly2 y_x x y = y - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly2 y_x x y = y - x
[PROOF STEP]
unfolding poly2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (poly y_x [:y:]) x = y - x
[PROOF STEP]
by simp


[STATEMENT]
lemma dep3_distinct:
  assumes dep3_QRSx: "dep3 Q R S"
  shows "Q \<noteq> R" "Q \<noteq> S" "R \<noteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<noteq> R &&& Q \<noteq> S &&& R \<noteq> S
[PROOF STEP]
using assms dep3_def dep3_event_def
[PROOF STATE]
proof (prove)
using this:
dep3 Q R S
dep3 ?Q ?R ?S \<equiv> \<exists>x. dep3_event ?Q ?R ?S x
dep3_event ?Q ?R ?S ?x \<equiv> card {?Q, ?R, ?S} = 3 \<and> {?Q, ?R, ?S} \<subseteq> SPRAY ?x \<and> (\<exists>T\<in>\<P>. T \<notin> SPRAY ?x \<and> ?Q \<inter> T \<noteq> {} \<and> ?R \<inter> T \<noteq> {} \<and> ?S \<inter> T \<noteq> {})

goal (1 subgoal):
 1. Q \<noteq> R &&& Q \<noteq> S &&& R \<noteq> S
[PROOF STEP]
by (simp_all add: card_3_dist)


[STATEMENT]
lemma min_elems_Collect_ftF_is_Nil : "min_elems (Collect front_tickFree) = {[]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_elems (Collect front_tickFree) = {[]}
[PROOF STEP]
apply(auto simp: min_elems_def le_list_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>front_tickFree x; \<forall>t. front_tickFree t \<longrightarrow> \<not> t < x\<rbrakk> \<Longrightarrow> x = []
[PROOF STEP]
apply(drule front_tickFree_charn[THEN iffD1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>t. front_tickFree t \<longrightarrow> \<not> t < x; x = [] \<or> (\<exists>a t. x = t @ [a] \<and> tickFree t)\<rbrakk> \<Longrightarrow> x = []
[PROOF STEP]
apply(auto dest!: tickFree_implies_front_tickFree)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_comp_assoc: "f \<circ>\<^sub>m (g \<circ>\<^sub>m h) = f \<circ>\<^sub>m g \<circ>\<^sub>m h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ>\<^sub>m (g \<circ>\<^sub>m h) = f \<circ>\<^sub>m g \<circ>\<^sub>m h
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
show "(f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
proof (cases "h x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. h x = None \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
 2. \<And>a. h x = Some a \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
h x = None

goal (2 subgoals):
 1. h x = None \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
 2. \<And>a. h x = Some a \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h x = None

goal (1 subgoal):
 1. (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
by (auto simp add: map_comp_def)
[PROOF STATE]
proof (state)
this:
(f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x

goal (1 subgoal):
 1. \<And>a. h x = Some a \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. h x = Some a \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
case (Some y)
[PROOF STATE]
proof (state)
this:
h x = Some y

goal (1 subgoal):
 1. \<And>a. h x = Some a \<Longrightarrow> (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h x = Some y

goal (1 subgoal):
 1. (f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x
[PROOF STEP]
by (auto simp add: map_comp_def)
[PROOF STATE]
proof (state)
this:
(f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f \<circ>\<^sub>m (g \<circ>\<^sub>m h)) x = (f \<circ>\<^sub>m g \<circ>\<^sub>m h) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lookup1_update1: "\<lbrakk> braun t;  n \<in> {1.. size t} \<rbrakk> \<Longrightarrow>
  lookup1 (update1 n x t) m = (if n=m then x else lookup1 t m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>braun t; n \<in> {1..size t}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t) m = (if n = m then x else lookup1 t m)
[PROOF STEP]
proof(induction t arbitrary: m n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m n. \<lbrakk>braun \<langle>\<rangle>; n \<in> {1..size \<langle>\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>\<rangle>) m = (if n = m then x else lookup1 \<langle>\<rangle> m)
 2. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
braun \<langle>\<rangle>
n \<in> {1..size \<langle>\<rangle>}

goal (2 subgoals):
 1. \<And>m n. \<lbrakk>braun \<langle>\<rangle>; n \<in> {1..size \<langle>\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>\<rangle>) m = (if n = m then x else lookup1 \<langle>\<rangle> m)
 2. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
braun \<langle>\<rangle>
n \<in> {1..size \<langle>\<rangle>}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
braun \<langle>\<rangle>
n \<in> {1..size \<langle>\<rangle>}

goal (1 subgoal):
 1. lookup1 (update1 n x \<langle>\<rangle>) m = (if n = m then x else lookup1 \<langle>\<rangle> m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lookup1 (update1 n x \<langle>\<rangle>) m = (if n = m then x else lookup1 \<langle>\<rangle> m)

goal (1 subgoal):
 1. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
have aux: "\<lbrakk> odd n; odd m \<rbrakk> \<Longrightarrow> n div 2 = (m::nat) div 2 \<longleftrightarrow> m=n" for m n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odd n; odd m\<rbrakk> \<Longrightarrow> (n div 2 = m div 2) = (m = n)
[PROOF STEP]
using odd_two_times_div_two_succ
[PROOF STATE]
proof (prove)
using this:
odd ?a \<Longrightarrow> (2::?'a) * (?a div (2::?'a)) + (1::?'a) = ?a

goal (1 subgoal):
 1. \<lbrakk>odd n; odd m\<rbrakk> \<Longrightarrow> (n div 2 = m div 2) = (m = n)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<lbrakk>odd ?n; odd ?m\<rbrakk> \<Longrightarrow> (?n div 2 = ?m div 2) = (?m = ?n)

goal (1 subgoal):
 1. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
case Node
[PROOF STATE]
proof (state)
this:
\<lbrakk>braun t1_; ?n \<in> {1..size t1_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t1_) ?m = (if ?n = ?m then x else lookup1 t1_ ?m)
\<lbrakk>braun t2_; ?n \<in> {1..size t2_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t2_) ?m = (if ?n = ?m then x else lookup1 t2_ ?m)
braun \<langle>t1_, x2_, t2_\<rangle>
n \<in> {1..size \<langle>t1_, x2_, t2_\<rangle>}

goal (1 subgoal):
 1. \<And>t1 x2 t2 m n. \<lbrakk>\<And>m n. \<lbrakk>braun t1; n \<in> {1..size t1}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t1) m = (if n = m then x else lookup1 t1 m); \<And>m n. \<lbrakk>braun t2; n \<in> {1..size t2}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x t2) m = (if n = m then x else lookup1 t2 m); braun \<langle>t1, x2, t2\<rangle>; n \<in> {1..size \<langle>t1, x2, t2\<rangle>}\<rbrakk> \<Longrightarrow> lookup1 (update1 n x \<langle>t1, x2, t2\<rangle>) m = (if n = m then x else lookup1 \<langle>t1, x2, t2\<rangle> m)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>braun t1_; ?n \<in> {1..size t1_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t1_) ?m = (if ?n = ?m then x else lookup1 t1_ ?m)
\<lbrakk>braun t2_; ?n \<in> {1..size t2_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t2_) ?m = (if ?n = ?m then x else lookup1 t2_ ?m)
braun \<langle>t1_, x2_, t2_\<rangle>
n \<in> {1..size \<langle>t1_, x2_, t2_\<rangle>}

goal (1 subgoal):
 1. lookup1 (update1 n x \<langle>t1_, x2_, t2_\<rangle>) m = (if n = m then x else lookup1 \<langle>t1_, x2_, t2_\<rangle> m)
[PROOF STEP]
using div2_in_bounds[OF Node.prems]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>braun t1_; ?n \<in> {1..size t1_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t1_) ?m = (if ?n = ?m then x else lookup1 t1_ ?m)
\<lbrakk>braun t2_; ?n \<in> {1..size t2_}\<rbrakk> \<Longrightarrow> lookup1 (update1 ?n x t2_) ?m = (if ?n = ?m then x else lookup1 t2_ ?m)
braun \<langle>t1_, x2_, t2_\<rangle>
n \<in> {1..size \<langle>t1_, x2_, t2_\<rangle>}
1 < n \<Longrightarrow> (odd n \<longrightarrow> n div 2 \<in> {1..size t2_}) \<and> (even n \<longrightarrow> n div 2 \<in> {1..size t1_})

goal (1 subgoal):
 1. lookup1 (update1 n x \<langle>t1_, x2_, t2_\<rangle>) m = (if n = m then x else lookup1 \<langle>t1_, x2_, t2_\<rangle> m)
[PROOF STEP]
by (auto simp: aux)
[PROOF STATE]
proof (state)
this:
lookup1 (update1 n x \<langle>t1_, x2_, t2_\<rangle>) m = (if n = m then x else lookup1 \<langle>t1_, x2_, t2_\<rangle> m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) exists_long_division:
  assumes "subfield K R" and "p \<in> carrier (K[X])" and "q \<in> carrier (K[X])" "q \<noteq> []"
  obtains b r where "b \<in> carrier (K[X])" and "r \<in> carrier (K[X])" and "long_divides p q (b, r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b r. \<lbrakk>b \<in> carrier (K [X]); r \<in> carrier (K [X]); long_divides p q (b, r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using subfield_long_division_theorem_shell[OF assms(1-3)] assms(4)
        carrier_polynomial_shell[OF subfieldE(1)[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
q \<noteq> \<zero>\<^bsub>K [X]\<^esub> \<Longrightarrow> \<exists>qa r. qa \<in> carrier (K [X]) \<and> r \<in> carrier (K [X]) \<and> p = q \<otimes>\<^bsub>K [X]\<^esub> qa \<oplus>\<^bsub>K [X]\<^esub> r \<and> (r = \<zero>\<^bsub>K [X]\<^esub> \<or> degree r < degree q)
q \<noteq> []
?p \<in> carrier (K [X]) \<Longrightarrow> ?p \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. (\<And>b r. \<lbrakk>b \<in> carrier (K [X]); r \<in> carrier (K [X]); long_divides p q (b, r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding long_divides_def univ_poly_zero univ_poly_add univ_poly_mult
[PROOF STATE]
proof (prove)
using this:
q \<noteq> [] \<Longrightarrow> \<exists>qa r. qa \<in> carrier (K [X]) \<and> r \<in> carrier (K [X]) \<and> p = poly_add (poly_mult q qa) r \<and> (r = [] \<or> degree r < degree q)
q \<noteq> []
?p \<in> carrier (K [X]) \<Longrightarrow> ?p \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. (\<And>b r. \<lbrakk>b \<in> carrier (K [X]); r \<in> carrier (K [X]); (b, r) \<in> carrier (poly_ring R) \<times> carrier (poly_ring R) \<and> p = poly_add (poly_mult q (fst (b, r))) (snd (b, r)) \<and> (snd (b, r) = [] \<or> degree (snd (b, r)) < degree q)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma permutation_mat_right: assumes A: "A \<in> carrier_mat nr n" and p: "p permutes {..<n}"
  shows "A * permutation_mat n p = Matrix.mat nr n (\<lambda> (i,j). A $$ (i, p j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
assume ij: "i < nr" "j < n"
[PROOF STATE]
proof (state)
this:
i < nr
j < n

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
from p ij(2)
[PROOF STATE]
proof (chain)
picking this:
p permutes {..<n}
j < n
[PROOF STEP]
have j: "p j < n"
[PROOF STATE]
proof (prove)
using this:
p permutes {..<n}
j < n

goal (1 subgoal):
 1. p j < n
[PROOF STEP]
by (simp add: permutes_def)
[PROOF STATE]
proof (state)
this:
p j < n

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
have "(A * permutation_mat n p) $$ (i,j) = scalar_prod (Matrix.row A i) (unit_vec n (p j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * permutation_mat n p) $$ (i, j) = Matrix.row A i \<bullet> unit_vec n (p j)
[PROOF STEP]
by (subst index_mult_mat, insert ij A p, auto)
[PROOF STATE]
proof (state)
this:
(A * permutation_mat n p) $$ (i, j) = Matrix.row A i \<bullet> unit_vec n (p j)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A * permutation_mat n p) $$ (i, j) = Matrix.row A i \<bullet> unit_vec n (p j)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
have "\<dots> = A $$ (i, p j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row A i \<bullet> unit_vec n (p j) = A $$ (i, p j)
[PROOF STEP]
by (subst scalar_prod_right_unit, insert A ij j, auto)
[PROOF STATE]
proof (state)
this:
Matrix.row A i \<bullet> unit_vec n (p j) = A $$ (i, p j)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.row A i \<bullet> unit_vec n (p j) = A $$ (i, p j)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
note calculation
[PROOF STATE]
proof (state)
this:
(A * permutation_mat n p) $$ (i, j) = A $$ (i, p j)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < nr; ?j2 < n\<rbrakk> \<Longrightarrow> (A * permutation_mat n p) $$ (?i2, ?j2) = A $$ (?i2, p ?j2)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < nr; ?j2 < n\<rbrakk> \<Longrightarrow> (A * permutation_mat n p) $$ (?i2, ?j2) = A $$ (?i2, p ?j2)

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < nr; ?j2 < n\<rbrakk> \<Longrightarrow> (A * permutation_mat n p) $$ (?i2, ?j2) = A $$ (?i2, p ?j2)
A \<in> carrier_mat nr n

goal (1 subgoal):
 1. A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
A * permutation_mat n p = Matrix.mat nr n (\<lambda>(i, j). A $$ (i, p j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inducedHOMTr0:"\<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow>
     (f\<dieresis>\<^bsub>F,G\<^esub>) ((gker\<^bsub>F,G\<^esub> f) \<bullet>\<^bsub>F\<^esub> a) = f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) = f a
[PROOF STEP]
apply (simp add:induced_ghom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow> (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<longrightarrow> f (SOME x. x \<in> gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) = f a) \<and> (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a \<notin> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<longrightarrow> undefined = f a)
[PROOF STEP]
apply (frule gkernTr7[of "F" "G" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; F \<guillemotright> gker\<^bsub>F,G\<^esub> f \<rbrakk> \<Longrightarrow> (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<longrightarrow> f (SOME x. x \<in> gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) = f a) \<and> (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a \<notin> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<longrightarrow> undefined = f a)
[PROOF STEP]
apply (simp add:Group.rcs_in_set_rcs[of "F"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; F \<guillemotright> gker\<^bsub>F,G\<^esub> f \<rbrakk> \<Longrightarrow> f (SOME x. x \<in> gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) = f a
[PROOF STEP]
apply (simp add:induced_ghom_someTr1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma naturality:
    assumes "A.arr f"
    shows "\<tau> (A.cod f) \<cdot>\<^sub>B F f = G f \<cdot>\<^sub>B \<tau> (A.dom f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> (A.cod f) \<cdot>\<^sub>B F f = G f \<cdot>\<^sub>B \<tau> (A.dom f)
[PROOF STEP]
using assms is_natural_1 is_natural_2
[PROOF STATE]
proof (prove)
using this:
A.arr f
A.arr ?f \<Longrightarrow> G ?f \<cdot>\<^sub>B \<tau> (A.dom ?f) = \<tau> ?f
A.arr ?f \<Longrightarrow> \<tau> (A.cod ?f) \<cdot>\<^sub>B F ?f = \<tau> ?f

goal (1 subgoal):
 1. \<tau> (A.cod f) \<cdot>\<^sub>B F f = G f \<cdot>\<^sub>B \<tau> (A.dom f)
[PROOF STEP]
by simp


[STATEMENT]
lemma dense_order_ow[ud_with]: "dense_order = dense_order_ow UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dense_order = dense_order_ow UNIV
[PROOF STEP]
unfolding
    dense_order_def dense_order_ow_def
    dense_order_axioms_def dense_order_ow_axioms_def
    ud_with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>le ls. order_ow UNIV le ls \<and> (\<forall>x y. ls x y \<longrightarrow> (\<exists>z. ls x z \<and> ls z y))) = (\<lambda>le ls. order_ow UNIV le ls \<and> (\<forall>x y. x \<in> UNIV \<longrightarrow> y \<in> UNIV \<longrightarrow> ls x y \<longrightarrow> (\<exists>z\<in>UNIV. ls x z \<and> ls z y)))
[PROOF STEP]
by simp


[STATEMENT]
lemma path_entry_hd_edge:
  assumes "path_entry (g_E G) pa p "
      and "pa \<noteq> []"
    shows "(hd pa, p) \<in> (g_E G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (hd pa, p) \<in> g_E G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path_entry (g_E G) pa p
pa \<noteq> []

goal (1 subgoal):
 1. (hd pa, p) \<in> g_E G
[PROOF STEP]
by (induct rule: path_entry.induct) auto


[STATEMENT]
lemma wf_times_simp[simp]: "wf_times t (x ## \<omega>) \<longleftrightarrow> t < fst x \<and> wf_times (fst x) \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_times t (x ## \<omega>) = (t < fst x \<and> wf_times (fst x) \<omega>)
[PROOF STEP]
by (cases x) (subst wf_times.simps; simp)


[STATEMENT]
lemma sum_list_map_eq_sum_count2:
assumes "set xs \<subseteq> X" "finite X"
shows "sum_list (map f xs) = sum (\<lambda>x. count_list xs x * f x) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
let ?F = "\<lambda>x. count_list xs x * f x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
have "sum ?F X = sum ?F (set xs \<union> (X - set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x)
[PROOF STEP]
using Un_absorb1[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
set xs \<union> X = X

goal (1 subgoal):
 1. (\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x)

goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x)

goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
have "\<dots> = sum ?F (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x) = (\<Sum>x\<in>set xs. count_list xs x * f x)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. (\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x) = (\<Sum>x\<in>set xs. count_list xs x * f x)
[PROOF STEP]
by(simp add: sum.union_disjoint[OF _ _ Diff_disjoint] del: Un_Diff_cancel)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs \<union> (X - set xs). count_list xs x * f x) = (\<Sum>x\<in>set xs. count_list xs x * f x)

goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs. count_list xs x * f x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. count_list xs x * f x) = (\<Sum>x\<in>set xs. count_list xs x * f x)

goal (1 subgoal):
 1. sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)
[PROOF STEP]
by(simp add:sum_list_map_eq_sum_count)
[PROOF STATE]
proof (state)
this:
sum_list (map f xs) = (\<Sum>x\<in>X. count_list xs x * f x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bound_of_mono[intro]:
  "\<lbrakk> P \<le> Q; bounded P; bounded Q \<rbrakk> \<Longrightarrow> bound_of P \<le> bound_of Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P \<le> Q; Expectations.bounded P; Expectations.bounded Q\<rbrakk> \<Longrightarrow> bound_of P \<le> bound_of Q
[PROOF STEP]
by (blast intro:order_trans dest:le_funD)


[STATEMENT]
lemma lm025:
  assumes "(\<Union> P1) \<inter> (\<Union> P2) = {}"
          "is_non_overlapping P1" "is_non_overlapping P2"
          "X \<in> P1 \<union> P2" "Y \<in> P1 \<union> P2" "X \<inter> Y \<noteq> {}"
  shows "(X = Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = Y
[PROOF STEP]
unfolding is_non_overlapping_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X = Y
[PROOF STEP]
using assms is_non_overlapping_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P1 \<inter> \<Union> P2 = {}
is_non_overlapping P1
is_non_overlapping P2
X \<in> P1 \<union> P2
Y \<in> P1 \<union> P2
X \<inter> Y \<noteq> {}
is_non_overlapping ?P = (\<forall>X\<in>?P. \<forall>Y\<in>?P. (X \<inter> Y \<noteq> {}) = (X = Y))

goal (1 subgoal):
 1. X = Y
[PROOF STEP]
by fast


[STATEMENT]
lemma INFM_mono: "\<exists>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> \<exists>\<^sub>\<infinity>x. Q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>\<^sub>\<infinity>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> \<exists>\<^sub>\<infinity>x. Q x
[PROOF STEP]
by (fact frequently_elim1)


[STATEMENT]
lemma merge_code: "merge t1 t2 =
  (case t1 of
   Leaf \<Rightarrow> t2 |
   Node l1 a1 r1 \<Rightarrow> (case t2 of
     Leaf \<Rightarrow> t1 |
     Node l2 a2 r2 \<Rightarrow>
       (if a1 \<le> a2
        then Node (merge t2 r1) a1 l1
        else Node (merge t1 r2) a2 l2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. merge t1 t2 = (case t1 of \<langle>\<rangle> \<Rightarrow> t2 | \<langle>l1, a1, r1\<rangle> \<Rightarrow> case t2 of \<langle>\<rangle> \<Rightarrow> t1 | \<langle>l2, a2, r2\<rangle> \<Rightarrow> if a1 \<le> a2 then \<langle>merge t2 r1, a1, l1\<rangle> else \<langle>merge t1 r2, a2, l2\<rangle>)
[PROOF STEP]
by(auto split: tree.split)


[STATEMENT]
lemma cdf_nondecreasing: "x \<le> y \<Longrightarrow> cdf M x \<le> cdf M y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> cdf M x \<le> cdf M y
[PROOF STEP]
unfolding cdf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> Sigma_Algebra.measure M {..x} \<le> Sigma_Algebra.measure M {..y}
[PROOF STEP]
by (auto intro!: finite_measure_mono)


[STATEMENT]
lemma awalk_cost_Cons[simp]: "awalk_cost f (x # xs) = f x + awalk_cost  f xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. awalk_cost f (x # xs) = f x + awalk_cost f xs
[PROOF STEP]
unfolding awalk_cost_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f (x # xs)) = f x + sum_list (map f xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma suminf_mult: "summable f \<Longrightarrow> suminf (\<lambda>n. c * f n) = c * suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. c * f n) = c * suminf f
[PROOF STEP]
by (rule bounded_linear.suminf [OF bounded_linear_mult_right, symmetric])


[STATEMENT]
lemma s_prod_iff: "(a,A) \<in> (R \<cdot> S) \<longleftrightarrow> (\<exists>B. (a,B) \<in> R \<and> (\<exists>f. (\<forall>b \<in> B. (b,f b) \<in> S) \<and> A = \<Union>((\<lambda>x. f x) ` B)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, A) \<in> R \<cdot> S) = (\<exists>B. (a, B) \<in> R \<and> (\<exists>f. (\<forall>b\<in>B. (b, f b) \<in> S) \<and> A = \<Union> (f ` B)))
[PROOF STEP]
by (unfold s_prod_im, auto)


[STATEMENT]
lemma constraints_of_mat_vec_solution_1:
  assumes A: "A \<in> carrier_mat nr nc"
    and b: "b \<in> carrier_vec nr"
    and sol: "\<exists> x \<in> carrier_vec nc. A *\<^sub>v x \<le> b"
  shows "\<exists> v. \<forall> c \<in> constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c
[PROOF STEP]
using constraints_of_mat_vec_solution_main[OF A _ b _] sol
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier_vec nc; A *\<^sub>v ?x \<le> b; ?c \<in> constraints_of_mat_vec A b\<rbrakk> \<Longrightarrow> val_of_vec ?x \<Turnstile>\<^sub>l\<^sub>e ?c
\<exists>x\<in>carrier_vec nc. A *\<^sub>v x \<le> b

goal (1 subgoal):
 1. \<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c
[PROOF STEP]
by blast


[STATEMENT]
lemma (in project) lang_eq_ext: "\<lbrakk>wf n r; wf n s\<rbrakk> \<Longrightarrow> (lang n r = lang n s) =
  (\<forall>w \<in> lists(\<Sigma> n). w \<in> lang n r \<longleftrightarrow> w \<in> lang n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.wf n r; local.wf n s\<rbrakk> \<Longrightarrow> (lang n r = lang n s) = (\<forall>w\<in>lists (\<Sigma> n). (w \<in> lang n r) = (w \<in> lang n s))
[PROOF STEP]
by (auto dest!: lang_subset_lists)


[STATEMENT]
lemma "termination": "\<exists>st. closure as (init r,init s) = Some st" (is "\<exists>_. closure as ?i = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>st. closure as (init r, init s) = Some st
[PROOF STEP]
unfolding closure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>st. rtrancl_while (\<lambda>(p, q). final p = final q) (\<lambda>(p, q). map (\<lambda>a. (delta a p, delta a q)) as) (init r, init s) = Some st
[PROOF STEP]
proof (rule rtrancl_while_finite_Some)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite ({(x, st). st \<in> set (case x of (p, q) \<Rightarrow> map (\<lambda>a. (delta a p, delta a q)) as)}\<^sup>* `` {(init r, init s)})
[PROOF STEP]
show "finite ({(x, st). st \<in> set ((\<lambda>(p,q). map (\<lambda>a. (delta a p, delta a q)) as) x)}\<^sup>* `` {?i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({(x, st). st \<in> set (case x of (p, q) \<Rightarrow> map (\<lambda>a. (delta a p, delta a q)) as)}\<^sup>* `` {(init r, init s)})
[PROOF STEP]
by (rule finite_subset[OF Image_mono[OF rtrancl_mono] finite_rtrancl_delta_Image]) auto
[PROOF STATE]
proof (state)
this:
finite ({(x, st). st \<in> set (case x of (p, q) \<Rightarrow> map (\<lambda>a. (delta a p, delta a q)) as)}\<^sup>* `` {(init r, init s)})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wls_swapAbs_psubstAbs:
assumes "wlsAbs (us,s) A" and "wlsEnv rho"
shows "((A $[rho]) $[z1 \<and> z2]_zs) = ((A $[z1 \<and> z2]_zs) $[rho &[z1 \<and> z2]_zs])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $[rho] $[z1 \<and> z2]_zs = A $[z1 \<and> z2]_zs $[rho &[z1 \<and> z2]_zs]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsAbs (us, s) A
wlsEnv rho

goal (1 subgoal):
 1. A $[rho] $[z1 \<and> z2]_zs = A $[z1 \<and> z2]_zs $[rho &[z1 \<and> z2]_zs]
[PROOF STEP]
by(simp add: swapAbs_psubstAbs)


[STATEMENT]
lemma Card_order_cpow: "Card_order (cpow r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Card_order (cpow r)
[PROOF STEP]
unfolding cpow_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Card_order |Pow (Field r)|
[PROOF STEP]
by (rule card_of_Card_order)


[STATEMENT]
lemma length_f_expand_Suc[simp]: "length (f_expand_Suc xs k) = length xs * Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (xs \<odot>\<^bsub>fSuc\<^esub> k) = length xs * Suc k
[PROOF STEP]
by (induct xs, simp+)


[STATEMENT]
lemma takeWhile_eq_Nil_iff: "takeWhile P xs = [] \<longleftrightarrow> xs = [] \<or> \<not>P (hd xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (takeWhile P xs = []) = (xs = [] \<or> \<not> P (hd xs))
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma surj_imp_imT_carrier:
assumes surj: "T` (carrier V) = carrier W"
shows "(imT) = carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imT = carrier W
[PROOF STEP]
by (simp add: surj im_def)


[STATEMENT]
lemma simplex_extremal_le:
  fixes S :: "'a::real_inner set"
  assumes "finite S"
    and "S \<noteq> {}"
  shows "\<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y \<in> convex hull S. norm (x - y) \<le> norm (u - v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
have "convex hull S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull S \<noteq> {}
[PROOF STEP]
using hull_subset[of S convex] and assms(2)
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> convex hull S
S \<noteq> {}

goal (1 subgoal):
 1. convex hull S \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull S \<noteq> {}

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convex hull S \<noteq> {}
[PROOF STEP]
obtain u v where obt: "u \<in> convex hull S" "v \<in> convex hull S"
    "\<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)"
[PROOF STATE]
proof (prove)
using this:
convex hull S \<noteq> {}

goal (1 subgoal):
 1. (\<And>u v. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using compact_sup_maxdistance[OF finite_imp_compact_convex_hull[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
convex hull S \<noteq> {}
convex hull S \<noteq> {} \<Longrightarrow> \<exists>x\<in>convex hull S. \<exists>y\<in>convex hull S. \<forall>u\<in>convex hull S. \<forall>v\<in>convex hull S. dist u v \<le> dist x y

goal (1 subgoal):
 1. (\<And>u v. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: dist_norm)
[PROOF STATE]
proof (state)
this:
u \<in> convex hull S
v \<in> convex hull S
\<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> convex hull S
v \<in> convex hull S
\<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<in> convex hull S
v \<in> convex hull S
\<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
proof (cases "u\<notin>S \<or> v\<notin>S", elim disjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 3. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
assume "u \<notin> S"
[PROOF STATE]
proof (state)
this:
u \<notin> S

goal (3 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 3. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<notin> S
[PROOF STEP]
obtain y where "y \<in> convex hull S" "norm (u - v) < norm (y - v)"
[PROOF STATE]
proof (prove)
using this:
u \<notin> S

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> convex hull S; norm (u - v) < norm (y - v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=u]] and obt(1)
[PROOF STATE]
proof (prove)
using this:
u \<notin> S
u \<in> convex hull S \<Longrightarrow> u \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (u - ?a1) < norm (y - ?a1))
u \<in> convex hull S

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> convex hull S; norm (u - v) < norm (y - v)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> convex hull S
norm (u - v) < norm (y - v)

goal (3 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 3. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> convex hull S
norm (u - v) < norm (y - v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S
norm (u - v) < norm (y - v)

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
using obt(3)[THEN bspec[where x=y], THEN bspec[where x=v]] and obt(2)
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S
norm (u - v) < norm (y - v)
\<lbrakk>y \<in> convex hull S; v \<in> convex hull S\<rbrakk> \<Longrightarrow> norm (y - v) \<le> norm (u - v)
v \<in> convex hull S

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)

goal (2 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
assume "v \<notin> S"
[PROOF STATE]
proof (state)
this:
v \<notin> S

goal (2 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<notin> S
[PROOF STEP]
obtain y where "y \<in> convex hull S" "norm (v - u) < norm (y - u)"
[PROOF STATE]
proof (prove)
using this:
v \<notin> S

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> convex hull S; norm (v - u) < norm (y - u)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=v]] and obt(2)
[PROOF STATE]
proof (prove)
using this:
v \<notin> S
v \<in> convex hull S \<Longrightarrow> v \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (v - ?a1) < norm (y - ?a1))
v \<in> convex hull S

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> convex hull S; norm (v - u) < norm (y - u)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> convex hull S
norm (v - u) < norm (y - u)

goal (2 subgoals):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); v \<notin> S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
 2. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> convex hull S
norm (v - u) < norm (y - u)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S
norm (v - u) < norm (y - u)

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
using obt(3)[THEN bspec[where x=u], THEN bspec[where x=y]] and obt(1)
[PROOF STATE]
proof (prove)
using this:
y \<in> convex hull S
norm (v - u) < norm (y - u)
\<lbrakk>u \<in> convex hull S; y \<in> convex hull S\<rbrakk> \<Longrightarrow> norm (u - y) \<le> norm (u - v)
u \<in> convex hull S

goal (1 subgoal):
 1. \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
by (auto simp: norm_minus_commute)
[PROOF STATE]
proof (state)
this:
\<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)

goal (1 subgoal):
 1. \<lbrakk>u \<in> convex hull S; v \<in> convex hull S; \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v); \<not> (u \<notin> S \<or> v \<notin> S)\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_concat_map_function_sum_list:
  assumes "\<And> x. x \<in> set xs \<Longrightarrow> length (g x) = h x"
  shows "length [f x r . x \<leftarrow> xs, r \<leftarrow> g x] = sum_list (map h xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (concat (map (\<lambda>x. map (f x) (g x)) xs)) = sum_list (map h xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> set xs \<Longrightarrow> length (g ?x) = h ?x

goal (1 subgoal):
 1. length (concat (map (\<lambda>x. map (f x) (g x)) xs)) = sum_list (map h xs)
[PROOF STEP]
by(induct xs) auto


[STATEMENT]
lemma product_nodes_card[intro]:
      assumes "finite (a.nodes A)" "finite (b.nodes B)"
      shows "card (c.nodes (product A B)) \<le> card (a.nodes A) * card (b.nodes B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
have "card (c.nodes (product A B)) \<le> card (a.nodes A \<times> b.nodes B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A \<times> b.nodes' B)
[PROOF STEP]
proof (rule card_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (a.nodes' A \<times> b.nodes' B)
 2. c.nodes' (product A B) \<subseteq> a.nodes' A \<times> b.nodes' B
[PROOF STEP]
show "finite (a.nodes A \<times> b.nodes B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (a.nodes' A \<times> b.nodes' B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (a.nodes' A)
finite (b.nodes' B)

goal (1 subgoal):
 1. finite (a.nodes' A \<times> b.nodes' B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (a.nodes' A \<times> b.nodes' B)

goal (1 subgoal):
 1. c.nodes' (product A B) \<subseteq> a.nodes' A \<times> b.nodes' B
[PROOF STEP]
show "c.nodes (product A B) \<subseteq> a.nodes A \<times> b.nodes B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c.nodes' (product A B) \<subseteq> a.nodes' A \<times> b.nodes' B
[PROOF STEP]
using product_nodes
[PROOF STATE]
proof (prove)
using this:
c.nodes' (product ?A ?B) \<subseteq> a.nodes' ?A \<times> b.nodes' ?B

goal (1 subgoal):
 1. c.nodes' (product A B) \<subseteq> a.nodes' A \<times> b.nodes' B
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
c.nodes' (product A B) \<subseteq> a.nodes' A \<times> b.nodes' B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (c.nodes' (product A B)) \<le> card (a.nodes' A \<times> b.nodes' B)

goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (c.nodes' (product A B)) \<le> card (a.nodes' A \<times> b.nodes' B)

goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
have "\<dots> = card (a.nodes A) * card (b.nodes B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (a.nodes' A \<times> b.nodes' B) = card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
using card_cartesian_product
[PROOF STATE]
proof (prove)
using this:
card (?A \<times> ?B) = card ?A * card ?B

goal (1 subgoal):
 1. card (a.nodes' A \<times> b.nodes' B) = card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (a.nodes' A \<times> b.nodes' B) = card (a.nodes' A) * card (b.nodes' B)

goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)

goal (1 subgoal):
 1. card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (c.nodes' (product A B)) \<le> card (a.nodes' A) * card (b.nodes' B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Group) Nfunc_Least_sym:"\<lbrakk>\<forall>l \<le> (n::nat). G \<guillemotright> f l; \<forall>l \<le> n. G \<guillemotright> g l;
     \<exists>i \<le> n. (f i \<noteq> g i)\<rbrakk> \<Longrightarrow>
           (LEAST k. (f k \<noteq> g k)) = (LEAST k. (g k \<noteq> f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; \<exists>i\<le>n. f i \<noteq> g i\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) = (LEAST k. g k \<noteq> f k)
[PROOF STEP]
apply (erule exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n \<and> f i \<noteq> g i\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) = (LEAST k. g k \<noteq> f k)
[PROOF STEP]
apply (frule_tac i = i in Nfunc_LeastTr2_4 [of n f g], assumption+,
        simp+,
        frule_tac i = i in Nfunc_LeastTr2_3 [of n f g _], assumption+,
        simp+,
        frule_tac i = i in Nfunc_LeastTr2_4 [of n g f], assumption+,
        simp+, rule not_sym, simp,
        frule_tac i = i in Nfunc_LeastTr2_3 [of n g f _], assumption+,
        simp+, rule not_sym, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n \<and> f i \<noteq> g i; (LEAST k. f k \<noteq> g k) \<le> n; f (LEAST k. f k \<noteq> g k) \<noteq> g (LEAST k. f k \<noteq> g k); (LEAST k. g k \<noteq> f k) \<le> n; g (LEAST k. g k \<noteq> f k) \<noteq> f (LEAST k. g k \<noteq> f k)\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) = (LEAST k. g k \<noteq> f k)
[PROOF STEP]
apply (frule_tac i = "(LEAST k. f k \<noteq> g k)" in
           Nfunc_LeastTr2_2_1 [of _ "n" "g" "f"], assumption+,
         rule not_sym, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n \<and> f i \<noteq> g i; (LEAST k. f k \<noteq> g k) \<le> n; f (LEAST k. f k \<noteq> g k) \<noteq> g (LEAST k. f k \<noteq> g k); (LEAST k. g k \<noteq> f k) \<le> n; g (LEAST k. g k \<noteq> f k) \<noteq> f (LEAST k. g k \<noteq> f k); (LEAST k. g k \<noteq> f k) \<le> (LEAST k. f k \<noteq> g k)\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) = (LEAST k. g k \<noteq> f k)
[PROOF STEP]
apply (
        frule_tac i = "(LEAST k. g k \<noteq> f k)" in
           Nfunc_LeastTr2_2_1 [of _ n f g], assumption+,
           rule not_sym, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n \<and> f i \<noteq> g i; (LEAST k. f k \<noteq> g k) \<le> n; f (LEAST k. f k \<noteq> g k) \<noteq> g (LEAST k. f k \<noteq> g k); (LEAST k. g k \<noteq> f k) \<le> n; g (LEAST k. g k \<noteq> f k) \<noteq> f (LEAST k. g k \<noteq> f k); (LEAST k. g k \<noteq> f k) \<le> (LEAST k. f k \<noteq> g k); (LEAST k. f k \<noteq> g k) \<le> (LEAST k. g k \<noteq> f k)\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) = (LEAST k. g k \<noteq> f k)
[PROOF STEP]
apply (rule le_antisym, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) erlang_ith_moment:
  "0 < l \<Longrightarrow> distributed M lborel X (erlang_density k l) \<Longrightarrow>
    expectation (\<lambda>x. X x ^ i) = fact (k + i) / (fact k * l ^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; distributed M lborel X (\<lambda>x. ennreal (erlang_density k l x))\<rbrakk> \<Longrightarrow> expectation (\<lambda>x. X x ^ i) = fact (k + i) / (fact k * l ^ i)
[PROOF STEP]
by (rule has_bochner_integral_integral_eq) (rule has_bochner_integral_erlang_ith_moment)


[STATEMENT]
lemma two_powr_minus_nat_float[simp]: "2 powr - (real i) \<in> float" for i :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr - real i \<in> float
[PROOF STEP]
by (intro floatI[of 1 "-i"]) simp


[STATEMENT]
lemma irreflexive_d_in_forest_modulo_equivalence:
  shows "forest_modulo_equivalence x d \<Longrightarrow> irreflexive d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. forest_modulo_equivalence x d \<Longrightarrow> irreflexive d
[PROOF STEP]
by (metis d_separates_forest_modulo_equivalence_3 forest_modulo_equivalence_def inf.cobounded2 inf.left_commute inf.orderE pseudo_complement)


[STATEMENT]
lemma homomorphism_mul_on_ring: "(of_int_mod_ring x)*(of_int_mod_ring y) =
              ((of_int_mod_ring  (x*y)) ::(('a::prime_card) mod_ring))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_mod_ring x * of_int_mod_ring y = of_int_mod_ring (x * y)
[PROOF STEP]
by (metis of_int_mult of_int_of_int_mod_ring)


[STATEMENT]
lemma of_int_mod_ring_eq_of_int_iff:
  "(of_int n :: ('n :: {finite, nontriv} mod_ring)) = of_int m \<longleftrightarrow>
    [n = m] (mod (int (CARD('n))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int n = of_int m) = [n = m] (mod int CARD('n))
[PROOF STEP]
by transfer (auto simp: cong_def)


[STATEMENT]
lemma finite_all_edges_between:
  assumes "finite X" "finite Y"
  shows "finite (all_edges_between X Y G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (all_edges_between X Y G)
[PROOF STEP]
by (meson all_edges_between_subset assms finite_cartesian_product finite_subset)


[STATEMENT]
lemma inter_ABC_1:
  assumes "line A B \<noteq> line C A"
  shows "inter (line A B) (line C A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.inter (line A B) (line C A) = A
[PROOF STEP]
using assms ax_uniqueness incidA_lAB incidB_lAB incid_inter_left incid_inter_right
[PROOF STATE]
proof (prove)
using this:
line A B \<noteq> line C A
\<lbrakk>incid ?P ?l; incid ?Q ?l; incid ?P ?m; incid ?Q ?m\<rbrakk> \<Longrightarrow> ?P = ?Q \<or> ?l = ?m
incid ?A (line ?A ?B)
incid ?B (line ?A ?B)
incid (local.inter ?l ?m) ?l
incid (local.inter ?l ?m) ?m

goal (1 subgoal):
 1. local.inter (line A B) (line C A) = A
[PROOF STEP]
by blast


[STATEMENT]
lemma mem_Units[simp]: "y \<in> Units mk_monoid \<longleftrightarrow> y dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<in> Units mk_monoid) = (y dvd (1::'a))
[PROOF STEP]
unfolding dvd_def Units_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<in> {y \<in> carrier mk_monoid. \<exists>x\<in>carrier mk_monoid. x \<otimes>\<^bsub>mk_monoid\<^esub> y = \<one>\<^bsub>mk_monoid\<^esub> \<and> y \<otimes>\<^bsub>mk_monoid\<^esub> x = \<one>\<^bsub>mk_monoid\<^esub>}) = (\<exists>k. (1::'a) = y * k)
[PROOF STEP]
by (auto simp: ac_simps)


[STATEMENT]
lemma cong2_conga_cong:
  assumes "A B C CongA A' B' C'" and
    "Cong A B A' B'" and
    "Cong B C B' C'"
  shows "Cong A C A' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A C A' C'
[PROOF STEP]
by (smt assms(1) assms(2) assms(3) cong_4321 l11_3 l11_4_1 not_cong_3412 out_distinct out_trivial)


[STATEMENT]
lemma "\<exists>(x::'a::linordered_field) y z w.
  5 * x + 3 * z - 17 * w + 7 * (y - 8 * x + z) \<le> max y (7 * z - x + w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y z w. (5::'a) * x + (3::'a) * z - (17::'a) * w + (7::'a) * (y - (8::'a) * x + z) \<le> max y ((7::'a) * z - x + w)
[PROOF STEP]
by ferrack


[STATEMENT]
lemma norm_cos_le:
  fixes z::complex
  shows "norm(cos z) \<le> exp(norm z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (cos z) \<le> exp (cmod z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (cos z) \<le> exp (cmod z)
[PROOF STEP]
have "Im z \<le> cmod z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im z \<le> cmod z
[PROOF STEP]
using abs_Im_le_cmod abs_le_D1
[PROOF STATE]
proof (prove)
using this:
\<bar>Im ?x\<bar> \<le> cmod ?x
\<bar>?a\<bar> \<le> ?b \<Longrightarrow> ?a \<le> ?b

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

goal (1 subgoal):
 1. cmod (cos z) \<le> exp (cmod z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im z \<le> cmod z
[PROOF STEP]
have "exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2"
[PROOF STATE]
proof (prove)
using this:
Im z \<le> cmod z

goal (1 subgoal):
 1. exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2
[PROOF STEP]
by (metis exp_uminus_Im add_mono exp_le_cancel_iff mult_2_right)
[PROOF STATE]
proof (state)
this:
exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2

goal (1 subgoal):
 1. cmod (cos z) \<le> exp (cmod z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
exp (- Im z) + exp (Im z) \<le> exp (cmod z) * 2

goal (1 subgoal):
 1. cmod (cos z) \<le> exp (cmod z)
[PROOF STEP]
by (force simp add: cos_exp_eq norm_divide intro: order_trans [OF norm_triangle_ineq])
[PROOF STATE]
proof (state)
this:
cmod (cos z) \<le> exp (cmod z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HCollect_iff [iff]: "hmem x (HCollect P A) \<longleftrightarrow> P x \<and> x \<^bold>\<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<^bold>\<in> HCollect P A) = (P x \<and> x \<^bold>\<in> A)
[PROOF STEP]
apply (insert comprehension [of A P], clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. \<forall>u. (u \<^bold>\<in> z) = (u \<^bold>\<in> A \<and> P u) \<Longrightarrow> (x \<^bold>\<in> HCollect P A) = (P x \<and> x \<^bold>\<in> A)
[PROOF STEP]
apply (simp add: HCollect_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. \<forall>u. (u \<^bold>\<in> z) = (u \<^bold>\<in> A \<and> P u) \<Longrightarrow> (x \<^bold>\<in> (THE z. \<forall>u. (u \<^bold>\<in> z) = (P u \<and> u \<^bold>\<in> A))) = (P x \<and> x \<^bold>\<in> A)
[PROOF STEP]
apply (rule theI2, blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>z x. \<lbrakk>\<forall>u. (u \<^bold>\<in> z) = (u \<^bold>\<in> A \<and> P u); \<forall>u. (u \<^bold>\<in> x) = (P u \<and> u \<^bold>\<in> A)\<rbrakk> \<Longrightarrow> x = z
 2. \<And>z xa. \<lbrakk>\<forall>u. (u \<^bold>\<in> z) = (u \<^bold>\<in> A \<and> P u); \<forall>u. (u \<^bold>\<in> xa) = (P u \<and> u \<^bold>\<in> A)\<rbrakk> \<Longrightarrow> (x \<^bold>\<in> xa) = (P x \<and> x \<^bold>\<in> A)
[PROOF STEP]
apply (auto simp: hf_ext)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inorder_rotateR:
  "l \<noteq> Leaf \<Longrightarrow> inorder(rotateR l a r) = inorder l @ a # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<noteq> \<langle>\<rangle> \<Longrightarrow> Tree2.inorder (rotateR l a r) = Tree2.inorder l @ a # Tree2.inorder r
[PROOF STEP]
by (induction l a r rule: rotateR.induct) (auto simp add: inorder_rot2 not_Leaf_if_not_single)


[STATEMENT]
lemma word16_integer_eq:
  "word16_of_integer (integer_of_word16 w) = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word16_of_integer (integer_of_word16 w) = w
[PROOF STEP]
unfolding word16_of_integer_def integer_of_word16_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_integer (integer_of_word w) = w
[PROOF STEP]
using word_integer_eq
[PROOF STATE]
proof (prove)
using this:
word_of_integer (integer_of_word ?w) = ?w

goal (1 subgoal):
 1. word_of_integer (integer_of_word w) = w
[PROOF STEP]
by blast


[STATEMENT]
lemma path_connectedin_Union:
  assumes \<A>: "\<And>S. S \<in> \<A> \<Longrightarrow> path_connectedin X S" "\<Inter>\<A> \<noteq> {}"
  shows "path_connectedin X (\<Union>\<A>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
obtain a where "\<And>S. S \<in> \<A> \<Longrightarrow> a \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. (\<And>S. S \<in> \<A> \<Longrightarrow> a \<in> S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?S \<in> \<A> \<Longrightarrow> path_connectedin X ?S
\<Inter> \<A> \<noteq> {}

goal (1 subgoal):
 1. (\<And>a. (\<And>S. S \<in> \<A> \<Longrightarrow> a \<in> S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?S \<in> \<A> \<Longrightarrow> a \<in> ?S

goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?S \<in> \<A> \<Longrightarrow> a \<in> ?S
[PROOF STEP]
have "\<And>x. x \<in> topspace (subtopology X (\<Union>\<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union>\<A>)) a x"
[PROOF STATE]
proof (prove)
using this:
?S \<in> \<A> \<Longrightarrow> a \<in> ?S

goal (1 subgoal):
 1. \<And>x. x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a x
[PROOF STEP]
by simp (meson Union_upper \<A> path_component_of path_connectedin_subtopology)
[PROOF STATE]
proof (state)
this:
?x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a ?x

goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a ?x

goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
using \<A>
[PROOF STATE]
proof (prove)
using this:
?x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a ?x
?S \<in> \<A> \<Longrightarrow> path_connectedin X ?S
\<Inter> \<A> \<noteq> {}

goal (1 subgoal):
 1. path_connectedin X (\<Union> \<A>)
[PROOF STEP]
unfolding path_connectedin_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> topspace (subtopology X (\<Union> \<A>)) \<Longrightarrow> path_component_of (subtopology X (\<Union> \<A>)) a ?x
?S \<in> \<A> \<Longrightarrow> ?S \<subseteq> topspace X \<and> path_connected_space (subtopology X ?S)
\<Inter> \<A> \<noteq> {}

goal (1 subgoal):
 1. \<Union> \<A> \<subseteq> topspace X \<and> path_connected_space (subtopology X (\<Union> \<A>))
[PROOF STEP]
by (metis Sup_le_iff path_component_of_equiv path_connected_space_iff_path_component)
[PROOF STATE]
proof (state)
this:
path_connectedin X (\<Union> \<A>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_on_subset_banach:
  fixes A B and f :: \<open>'a \<Rightarrow> 'b::banach\<close>
  assumes \<open>f summable_on A\<close>
  assumes \<open>B \<subseteq> A\<close>
  shows \<open>f summable_on B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f summable_on B
[PROOF STEP]
by (rule summable_on_subset[OF _ _ assms])
     (auto simp: complete_def convergent_def dest!: Cauchy_convergent)


[STATEMENT]
lemma (in Ring) set_mult_mono:"\<lbrakk>A1 \<subseteq> carrier R; A2 \<subseteq> carrier R; A1 \<subseteq> A2;
       B \<subseteq> carrier R\<rbrakk> \<Longrightarrow> set_mult R A1 B \<subseteq> set_mult R A2 B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A1 \<subseteq> carrier R; A2 \<subseteq> carrier R; A1 \<subseteq> A2; B \<subseteq> carrier R\<rbrakk> \<Longrightarrow> set_mult R A1 B \<subseteq> set_mult R A2 B
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A1 \<subseteq> carrier R; A2 \<subseteq> carrier R; A1 \<subseteq> A2; B \<subseteq> carrier R; x \<in> set_mult R A1 B\<rbrakk> \<Longrightarrow> x \<in> set_mult R A2 B
[PROOF STEP]
apply (simp add:set_mult_def, (erule bexE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa y. \<lbrakk>A1 \<subseteq> carrier R; A2 \<subseteq> carrier R; A1 \<subseteq> A2; B \<subseteq> carrier R; xa \<in> A1; y \<in> B; xa \<cdot>\<^sub>r y = x\<rbrakk> \<Longrightarrow> \<exists>xa\<in>A2. \<exists>y\<in>B. xa \<cdot>\<^sub>r y = x
[PROOF STEP]
apply (frule_tac c = xa in subsetD[of A1 A2], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa y. \<lbrakk>A1 \<subseteq> carrier R; A2 \<subseteq> carrier R; A1 \<subseteq> A2; B \<subseteq> carrier R; xa \<in> A1; y \<in> B; xa \<cdot>\<^sub>r y = x; xa \<in> A2\<rbrakk> \<Longrightarrow> \<exists>xa\<in>A2. \<exists>y\<in>B. xa \<cdot>\<^sub>r y = x
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma index_map_inj_on:
  "\<lbrakk> inj_on f S; y \<in> S; set xs \<subseteq> S \<rbrakk> \<Longrightarrow> index (map f xs) (f y) = index xs y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f S; y \<in> S; set xs \<subseteq> S\<rbrakk> \<Longrightarrow> index (map f xs) (f y) = index xs y
[PROOF STEP]
by (induct xs) (auto simp: inj_on_eq_iff)


[STATEMENT]
lemma eint_minus_ineq'':
  assumes "(c::eint) \<noteq>\<infinity>"
  assumes "b \<ge> d"
  assumes "(e::eint) > 0"
  assumes "e \<noteq> \<infinity>"
  shows "e*(b - c) \<ge> e*d - e*c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * d - e * c \<le> e * (b - c)
[PROOF STEP]
using assms eint_minus_ineq'
[PROOF STATE]
proof (prove)
using this:
c \<noteq> \<infinity>
d \<le> b
0 < e
e \<noteq> \<infinity>
\<lbrakk>?c \<noteq> \<infinity>; ?d \<le> ?b; 0 < ?e; ?e \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ?e * (?d - ?c) \<le> ?e * (?b - ?c)

goal (1 subgoal):
 1. e * d - e * c \<le> e * (b - c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>; \<And>c d b e. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> e * (d - c) \<le> e * (b - c)\<rbrakk> \<Longrightarrow> e * d - e * c \<le> e * (b - c)
[PROOF STEP]
have "\<forall>e. (0::eint) + e = e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e. 0 + e = e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>e. 0 + e = e

goal (1 subgoal):
 1. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>; \<And>c d b e. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> e * (d - c) \<le> e * (b - c)\<rbrakk> \<Longrightarrow> e * d - e * c \<le> e * (b - c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>e. 0 + e = e
[PROOF STEP]
have f1: "e * 0 = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>e. 0 + e = e

goal (1 subgoal):
 1. e * 0 = 0
[PROOF STEP]
by (metis add_diff_cancel_eint assms(4) idiff_self mult_eSuc_right' mult_one_right)
[PROOF STATE]
proof (state)
this:
e * 0 = 0

goal (1 subgoal):
 1. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>; \<And>c d b e. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> e * (d - c) \<le> e * (b - c)\<rbrakk> \<Longrightarrow> e * d - e * c \<le> e * (b - c)
[PROOF STEP]
have "\<infinity> \<noteq> c * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity> \<noteq> c * e
[PROOF STEP]
using assms(1) assms(4) eint_pos_times_is_pos
[PROOF STATE]
proof (prove)
using this:
c \<noteq> \<infinity>
e \<noteq> \<infinity>
\<lbrakk>0 < ?c; 0 < ?b\<rbrakk> \<Longrightarrow> 0 < ?b * ?c

goal (1 subgoal):
 1. \<infinity> \<noteq> c * e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<infinity> \<noteq> c * e

goal (1 subgoal):
 1. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>; \<And>c d b e. \<lbrakk>c \<noteq> \<infinity>; d \<le> b; 0 < e; e \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> e * (d - c) \<le> e * (b - c)\<rbrakk> \<Longrightarrow> e * d - e * c \<le> e * (b - c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<infinity> \<noteq> c * e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<infinity> \<noteq> c * e

goal (1 subgoal):
 1. e * d - e * c \<le> e * (b - c)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
\<infinity> \<noteq> c * e
e * 0 = 0

goal (1 subgoal):
 1. e * d - e * c \<le> e * (b - c)
[PROOF STEP]
by (metis assms(1) assms(2) assms(3) assms(4) eint_minus_distl eint_minus_ineq' idiff_self mult.commute)
[PROOF STATE]
proof (state)
this:
e * d - e * c \<le> e * (b - c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) eval_poly_add_aux:
  assumes "set p \<subseteq> carrier R" "set q \<subseteq> carrier R" and "length p = length q" and "a \<in> carrier R"
  shows "eval (poly_add p q) a = (eval p a) \<oplus> (eval q a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
have "eval (map2 (\<oplus>) p q) a = (eval p a) \<oplus> (eval q a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R
set q \<subseteq> carrier R
length p = length q
a \<in> carrier R

goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
proof (induct p arbitrary: q)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>q. \<lbrakk>set [] \<subseteq> carrier R; set q \<subseteq> carrier R; length [] = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) [] q) a = local.eval [] a \<oplus> local.eval q a
 2. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier R
set q \<subseteq> carrier R
length [] = length q
a \<in> carrier R

goal (2 subgoals):
 1. \<And>q. \<lbrakk>set [] \<subseteq> carrier R; set q \<subseteq> carrier R; length [] = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) [] q) a = local.eval [] a \<oplus> local.eval q a
 2. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R
set q \<subseteq> carrier R
length [] = length q
a \<in> carrier R

goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) [] q) a = local.eval [] a \<oplus> local.eval q a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.eval (map2 (\<oplus>) [] q) a = local.eval [] a \<oplus> local.eval q a

goal (1 subgoal):
 1. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
case (Cons b1 p')
[PROOF STATE]
proof (state)
this:
\<lbrakk>set p' \<subseteq> carrier R; set ?q \<subseteq> carrier R; length p' = length ?q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p' ?q) a = local.eval p' a \<oplus> local.eval ?q a
set (b1 # p') \<subseteq> carrier R
set q \<subseteq> carrier R
length (b1 # p') = length q
a \<in> carrier R

goal (1 subgoal):
 1. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>set p' \<subseteq> carrier R; set ?q \<subseteq> carrier R; length p' = length ?q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p' ?q) a = local.eval p' a \<oplus> local.eval ?q a
set (b1 # p') \<subseteq> carrier R
set q \<subseteq> carrier R
length (b1 # p') = length q
a \<in> carrier R
[PROOF STEP]
obtain b2 q' where q: "q = b2 # q'"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set p' \<subseteq> carrier R; set ?q \<subseteq> carrier R; length p' = length ?q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p' ?q) a = local.eval p' a \<oplus> local.eval ?q a
set (b1 # p') \<subseteq> carrier R
set q \<subseteq> carrier R
length (b1 # p') = length q
a \<in> carrier R

goal (1 subgoal):
 1. (\<And>b2 q'. q = b2 # q' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis length_Cons list.exhaust list.size(3) nat.simps(3))
[PROOF STATE]
proof (state)
this:
q = b2 # q'

goal (1 subgoal):
 1. \<And>aa p q. \<lbrakk>\<And>q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R; length p = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a; set (aa # p) \<subseteq> carrier R; set q \<subseteq> carrier R; length (aa # p) = length q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) (aa # p) q) a = local.eval (aa # p) a \<oplus> local.eval q a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) (b1 # p') q) a = local.eval (b1 # p') a \<oplus> local.eval q a
[PROOF STEP]
using eval_in_carrier[OF _ Cons(5), of q']
            eval_in_carrier[OF _ Cons(5), of p'] Cons
[PROOF STATE]
proof (prove)
using this:
set q' \<subseteq> carrier R \<Longrightarrow> local.eval q' a \<in> carrier R
set p' \<subseteq> carrier R \<Longrightarrow> local.eval p' a \<in> carrier R
\<lbrakk>set p' \<subseteq> carrier R; set ?q \<subseteq> carrier R; length p' = length ?q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p' ?q) a = local.eval p' a \<oplus> local.eval ?q a
set (b1 # p') \<subseteq> carrier R
set q \<subseteq> carrier R
length (b1 # p') = length q
a \<in> carrier R

goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) (b1 # p') q) a = local.eval (b1 # p') a \<oplus> local.eval q a
[PROOF STEP]
unfolding q
[PROOF STATE]
proof (prove)
using this:
set q' \<subseteq> carrier R \<Longrightarrow> local.eval q' a \<in> carrier R
set p' \<subseteq> carrier R \<Longrightarrow> local.eval p' a \<in> carrier R
\<lbrakk>set p' \<subseteq> carrier R; set ?q \<subseteq> carrier R; length p' = length ?q; a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (map2 (\<oplus>) p' ?q) a = local.eval p' a \<oplus> local.eval ?q a
set (b1 # p') \<subseteq> carrier R
set (b2 # q') \<subseteq> carrier R
length (b1 # p') = length (b2 # q')
a \<in> carrier R

goal (1 subgoal):
 1. local.eval (map2 (\<oplus>) (b1 # p') (b2 # q')) a = local.eval (b1 # p') a \<oplus> local.eval (b2 # q') a
[PROOF STEP]
by (auto simp add: ring_simprules(7,13,22))
[PROOF STATE]
proof (state)
this:
local.eval (map2 (\<oplus>) (b1 # p') q) a = local.eval (b1 # p') a \<oplus> local.eval q a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a

goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a

goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
have "set (map2 (\<oplus>) p q) \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map2 (\<oplus>) p q) \<subseteq> carrier R
[PROOF STEP]
using assms(1-2)
[PROOF STATE]
proof (prove)
using this:
set p \<subseteq> carrier R
set q \<subseteq> carrier R

goal (1 subgoal):
 1. set (map2 (\<oplus>) p q) \<subseteq> carrier R
[PROOF STEP]
by (induct p arbitrary: q) (auto, metis add.m_closed in_set_zipE set_ConsD subsetCE)
[PROOF STATE]
proof (state)
this:
set (map2 (\<oplus>) p q) \<subseteq> carrier R

goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a
set (map2 (\<oplus>) p q) \<subseteq> carrier R
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a
set (map2 (\<oplus>) p q) \<subseteq> carrier R

goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
using assms(3) eval_normalize[OF _ assms(4), of "map2 (\<oplus>) p q"]
[PROOF STATE]
proof (prove)
using this:
local.eval (map2 (\<oplus>) p q) a = local.eval p a \<oplus> local.eval q a
set (map2 (\<oplus>) p q) \<subseteq> carrier R
length p = length q
set (map2 (\<oplus>) p q) \<subseteq> carrier R \<Longrightarrow> local.eval (local.normalize (map2 (\<oplus>) p q)) a = local.eval (map2 (\<oplus>) p q) a

goal (1 subgoal):
 1. local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.eval (poly_add p q) a = local.eval p a \<oplus> local.eval q a

goal:
No subgoals!
[PROOF STEP]
qed