[STATEMENT]
lemma expands_to_ln_aux_1:
  assumes e: "e = 1"
  assumes basis: "basis_wf (b # basis)"
  assumes L1: "((\<lambda>x. ln (g x)) expands_to L1) basis"
  assumes L2: "((\<lambda>x. ln (b x)) expands_to L2) basis"
  shows "((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
e = 1
basis_wf (b # basis)
((\<lambda>x. ln (g x)) expands_to L1) basis
((\<lambda>x. ln (b x)) expands_to L2) basis

goal (1 subgoal):
 1. ((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis
[PROOF STEP]
by (intro expands_to_add) (simp_all add: basis_wf_Cons)


[STATEMENT]
lemma of_rat_add: "of_rat (a + b) = of_rat a + of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a + b) = of_rat a + of_rat b
[PROOF STEP]
by transfer (simp add: add_frac_eq)


[STATEMENT]
lemma lm057:
  assumes "a \<in> allocationsUniverse" "Domain a \<subseteq> N" "\<Union>(Range a) = G"
  shows   "a \<in> allAllocations N G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
using assms posssibleAllocationsRelCharacterization lm040
[PROOF STATE]
proof (prove)
using this:
a \<in> allocationsUniverse
Domain a \<subseteq> N
\<Union> (Range a) = G
(?a \<in> allAllocations ?N ?G) = (?a \<in> injectionsUniverse \<and> Domain ?a \<subseteq> ?N \<and> Range ?a \<in> all_partitions ?G)
?a \<in> allocationsUniverse \<Longrightarrow> ?a \<in> allAllocations (Domain ?a) (\<Union> (Range ?a))

goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
by (metis (mono_tags, lifting))


[STATEMENT]
lemma trms_of_deg_leq_id:
  assumes "f \<in> carrier P"
  shows "f \<ominus>\<^bsub>P\<^esub> (trms_of_deg_leq k f) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> trms_of_deg_leq k f = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
unfolding trms_of_deg_leq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> (f \<ominus>\<^bsub>UP R\<^esub> shift (Suc k) f \<otimes>\<^bsub>UP R\<^esub> monom P \<one> (Suc k)) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P

goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> (f \<ominus>\<^bsub>UP R\<^esub> shift (Suc k) f \<otimes>\<^bsub>UP R\<^esub> monom P \<one> (Suc k)) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
by (smt P.add.inv_closed P.l_zero P.m_closed P.minus_add P.minus_minus P.r_neg
      P_def R.one_closed UP_a_assoc a_minus_def monom_closed shift_closed)


[STATEMENT]
lemma mod_ring_mult64: "(mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) ((*))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) (*)
[PROOF STEP]
using urel64_mult mod_ring_mult
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?y; urel64 ?x' ?y'\<rbrakk> \<Longrightarrow> urel64 (mult_p64 pp ?x ?x') (mult_p p ?y ?y')
(mod_ring_rel ===> mod_ring_rel ===> mod_ring_rel) (mult_p p) (*)

goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) (*)
[PROOF STEP]
unfolding mod_ring_rel64_def rel_fun_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?y; urel64 ?x' ?y'\<rbrakk> \<Longrightarrow> urel64 (mult_p64 pp ?x ?x') (mult_p p ?y ?y')
\<forall>x y. mod_ring_rel x y \<longrightarrow> (\<forall>xa ya. mod_ring_rel xa ya \<longrightarrow> mod_ring_rel (mult_p p x xa) (y * ya))

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel64 x z \<and> mod_ring_rel z y) \<longrightarrow> (\<forall>xa ya. (\<exists>z. urel64 xa z \<and> mod_ring_rel z ya) \<longrightarrow> (\<exists>z. urel64 (mult_p64 pp x xa) z \<and> mod_ring_rel z (y * ya)))
[PROOF STEP]
by blast


[STATEMENT]
lemma ts_ord_add_isor: "n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z
[PROOF STEP]
using n_add_op_def n_comm ts_ord_add_isol
[PROOF STATE]
proof (prove)
using this:
?x \<oplus> ?y \<equiv> n (n ?x \<cdot> n ?y)
n ?x \<cdot> n ?y = n ?y \<cdot> n ?x
n ?x \<sqsubseteq> n ?y \<Longrightarrow> n ?z \<oplus> n ?x \<sqsubseteq> n ?z \<oplus> n ?y

goal (1 subgoal):
 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z
[PROOF STEP]
by presburger


[STATEMENT]
theorem complete:
  assumes finite_cs: "finite Cs" "\<forall>C\<in>Cs. finite C"
  assumes unsat: "\<forall>(F::hterm fun_denot) (G::hterm pred_denot) . \<not>eval\<^sub>c\<^sub>s F G Cs"
  shows "\<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
using assms completeness
[PROOF STATE]
proof (prove)
using this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>F G. \<not> eval\<^sub>c\<^sub>s F G Cs
\<lbrakk>finite ?Cs; \<forall>C\<in>?Cs. finite C; \<forall>F G. \<not> eval\<^sub>c\<^sub>s F G ?Cs\<rbrakk> \<Longrightarrow> \<exists>Cs'. resolution_deriv ?Cs Cs' \<and> {} \<in> Cs'

goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
by -


[STATEMENT]
lemma ahm_map_rel_def: "\<langle>Rk,Rv\<rangle> ahm_map_rel \<equiv>
{(HashMap a n, HashMap a' n)| a a' n n'.
         (a,a') \<in> \<langle>\<langle>\<langle>Rk,Rv\<rangle>prod_rel\<rangle>list_rel\<rangle>array_rel \<and> (n,n') \<in> Id}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>Rk, Rv\<rangle>ahm_map_rel \<equiv> {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> \<langle>\<langle>Rk \<times>\<^sub>r Rv\<rangle>list_rel\<rangle>array_rel \<and> (n, n') \<in> nat_rel}
[PROOF STEP]
unfolding relAPP_def ahm_map_rel_def_internal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> array_rel (list_rel (prod_rel Rk Rv)) \<and> (n, n') \<in> nat_rel} \<equiv> {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> array_rel (list_rel (prod_rel Rk Rv)) \<and> (n, n') \<in> nat_rel}
[PROOF STEP]
.


[STATEMENT]
lemma kernel_upper_triangular: assumes A: "A \<in> carrier_mat n n"
  and ut: "upper_triangular A" and 0: "0 \<notin> set (diag_mat A)"
  shows "kernel.dim n A = 0" "kernel.basis n A {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
define ma where "ma = diag_mat A"
[PROOF STATE]
proof (state)
this:
ma = diag_mat A

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from det_upper_triangular[OF ut A]
[PROOF STATE]
proof (chain)
picking this:
det A = prod_list (diag_mat A)
[PROOF STEP]
have "det A = prod_list (diag_mat A)"
[PROOF STATE]
proof (prove)
using this:
det A = prod_list (diag_mat A)

goal (1 subgoal):
 1. det A = prod_list (diag_mat A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A = prod_list (diag_mat A)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = prod_list (diag_mat A)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
have "\<dots> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (diag_mat A) \<noteq> (0::'a)
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<notin> set (diag_mat A)

goal (1 subgoal):
 1. prod_list (diag_mat A) \<noteq> (0::'a)
[PROOF STEP]
unfolding ma_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<notin> set ma

goal (1 subgoal):
 1. prod_list ma \<noteq> (0::'a)
[PROOF STEP]
by (induct ma, auto)
[PROOF STATE]
proof (state)
this:
prod_list (diag_mat A) \<noteq> (0::'a)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A \<noteq> (0::'a)
[PROOF STEP]
have "det A \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
det A \<noteq> (0::'a)

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

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from det_non_zero_imp_unit[OF A this, unfolded Units_def, of "()"]
[PROOF STATE]
proof (chain)
picking this:
A \<in> {y \<in> carrier (ring_mat TYPE('a) n ()). \<exists>x\<in>carrier (ring_mat TYPE('a) n ()). x \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> y = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub> \<and> y \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> x = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub>}
[PROOF STEP]
obtain B where B: "B \<in> carrier_mat n n" and BA: "B * A = 1\<^sub>m n" and AB: "A * B = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
A \<in> {y \<in> carrier (ring_mat TYPE('a) n ()). \<exists>x\<in>carrier (ring_mat TYPE('a) n ()). x \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> y = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub> \<and> y \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> x = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub>}

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<in> carrier_mat n n; B * A = 1\<^sub>m n; A * B = 1\<^sub>m n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: ring_mat_def)
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat n n
B * A = 1\<^sub>m n
A * B = 1\<^sub>m n

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from mat_kernel_mult_eq[OF A B A AB, unfolded BA]
[PROOF STATE]
proof (chain)
picking this:
mat_kernel (1\<^sub>m n) = mat_kernel A
[PROOF STEP]
have id: "mat_kernel A = mat_kernel (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
using this:
mat_kernel (1\<^sub>m n) = mat_kernel A

goal (1 subgoal):
 1. mat_kernel A = mat_kernel (1\<^sub>m n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
mat_kernel A = mat_kernel (1\<^sub>m n)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
show "kernel.dim n A = 0" "kernel.basis n A {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (1\<^sub>m n)\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (1\<^sub>m n)\<rparr>) {}
[PROOF STEP]
by (rule kernel_one_mat)+
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fpxs_const_mult [simp]:
  fixes x y :: "'a::{comm_semiring_1}"
  shows "fpxs_const (x * y) = fpxs_const x * fpxs_const y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_const (x * y) = fpxs_const x * fpxs_const y
[PROOF STEP]
unfolding fpxs_const_altdef fls_const_mult_const[symmetric] fpxs_of_fls_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_of_fls (fls_const x) * fpxs_of_fls (fls_const y) = fpxs_of_fls (fls_const x) * fpxs_of_fls (fls_const y)
[PROOF STEP]
..


[STATEMENT]
lemma qinverse_qtimes: "(x \<^bold>\<cdot> y)\<^sup>-\<^sup>\<one> \<cong>\<^sub>Q x\<^sup>-\<^sup>\<one> \<^bold>\<cdot> y\<^sup>-\<^sup>\<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<^bold>\<cdot> y)\<^sup>-\<^sup>\<one> \<cong>\<^sub>Q x\<^sup>-\<^sup>\<one> \<^bold>\<cdot> y\<^sup>-\<^sup>\<one>
[PROOF STEP]
by (si_simp add: inverse_distrib)


[STATEMENT]
lemma integrable_indicator_iff:
  "integrable M (indicator A::_ \<Rightarrow> real) \<longleftrightarrow> A \<inter> space M \<in> sets M \<and> emeasure M (A \<inter> space M) < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (indicat_real A) = (A \<inter> space M \<in> sets M \<and> emeasure M (A \<inter> space M) < \<infinity>)
[PROOF STEP]
by (simp add: integrable_iff_bounded borel_measurable_indicator_iff ennreal_indicator nn_integral_indicator'
           cong: conj_cong)


[STATEMENT]
lemma vector_mult: "\<lbrakk>is_vector x; is_vector y\<rbrakk> \<Longrightarrow> is_vector (x \<cdot> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_vector x; is_vector y\<rbrakk> \<Longrightarrow> is_vector (x \<cdot> y)
[PROOF STEP]
by (metis ra_1 is_vector_def)


[STATEMENT]
lemma reconstruct_with_type_conversion:
  "smult (lead_coeff (map_poly of_int f)) (prod_list (map (\<lambda> a. [:- a, 1:]) (complex_roots_int f)))
   = map_poly of_int f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (lead_coeff (of_int_poly f)) (\<Prod>a\<leftarrow>complex_roots_int f. [:- a, 1:]) = of_int_poly f
[PROOF STEP]
unfolding complex_roots_int_def complex_roots(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly f = of_int_poly f
[PROOF STEP]
by simp


[STATEMENT]
lemma preserves_star:
  "nL_omega.preserves x (-p) \<Longrightarrow> nL_omega.preserves (x\<^sup>\<star>) (-p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. test_itering.preserves (*) (\<le>) uminus x (- p) \<Longrightarrow> test_itering.preserves (*) (\<le>) uminus (x\<^sup>\<star>) (- p)
[PROOF STEP]
by (simp add: nL_omega.preserves_def star.circ_simulate)


[STATEMENT]
lemma word64_bounds:
  "- (2 ^ (size (x :: word64) - 1)) = (-9223372036854775808 :: int)"
  "((2 ^ (size (x :: word64) - 1)) - 1) = (9223372036854775807 :: int)"
  "- (2 ^ (size (y :: 64 signed word) - 1)) = (-9223372036854775808 :: int)"
  "((2 ^ (size (y :: 64 signed word) - 1)) - 1) = (9223372036854775807 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (2 ^ (size x - 1)) = - 9223372036854775808 &&& 2 ^ (size x - 1) - 1 = 9223372036854775807) &&& - (2 ^ (size y - 1)) = - 9223372036854775808 &&& 2 ^ (size y - 1) - 1 = 9223372036854775807
[PROOF STEP]
by (simp_all add: word_size)


[STATEMENT]
lemma anonymous_profile_agent_permutation:
  assumes eq:  "anonymous_profile R1 = anonymous_profile R2"
  assumes wf:  "pref_profile_wf agents alts R1" "pref_profile_wf agents alts R2"
  assumes fin: "finite agents"
  obtains \<pi> where "\<pi> permutes agents" "R2 \<circ> \<pi> = R1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret R1: pref_profile_wf agents alts R1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pref_profile_wf agents alts R1
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret R2: pref_profile_wf agents alts R2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pref_profile_wf agents alts R2
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from eq
[PROOF STATE]
proof (chain)
picking this:
anonymous_profile R1 = anonymous_profile R2
[PROOF STEP]
have "{#weak_ranking (R1 x). x \<in># mset_set agents#} =
                  {#weak_ranking (R2 x). x \<in># mset_set agents#}"
[PROOF STATE]
proof (prove)
using this:
anonymous_profile R1 = anonymous_profile R2

goal (1 subgoal):
 1. {#weak_ranking (R1 x). x \<in># mset_set agents#} = {#weak_ranking (R2 x). x \<in># mset_set agents#}
[PROOF STEP]
by (simp add: R1.anonymous_profile_def R2.anonymous_profile_def o_def)
[PROOF STATE]
proof (state)
this:
{#weak_ranking (R1 x). x \<in># mset_set agents#} = {#weak_ranking (R2 x). x \<in># mset_set agents#}

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from image_mset_eq_permutation[OF this fin]
[PROOF STATE]
proof (chain)
picking this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain \<pi>
    where \<pi>: "\<pi> permutes agents"
      "\<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)"
[PROOF STATE]
proof (prove)
using this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<pi>
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
[PROOF STEP]
have wf': "pref_profile_wf agents alts (R2 \<circ> \<pi>)"
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)

goal (1 subgoal):
 1. pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
by (intro R2.wf_permute_agents)
[PROOF STATE]
proof (state)
this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
interpret R2': pref_profile_wf agents alts "R2 \<circ> \<pi>"
[PROOF STATE]
proof (prove)
using this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)

goal (1 subgoal):
 1. pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "R2 \<circ> \<pi> = R1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R2 \<circ> \<pi> = R1
[PROOF STEP]
proof (intro pref_profile_eqI[OF wf' wf(1)])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
assume x: "x \<in> agents"
[PROOF STATE]
proof (state)
this:
x \<in> agents

goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
with \<pi>
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
x \<in> agents
[PROOF STEP]
have "weak_ranking ((R2 o \<pi>) x) = weak_ranking (R1 x)"
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
x \<in> agents

goal (1 subgoal):
 1. weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)

goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
with wf' wf(1) x
[PROOF STATE]
proof (chain)
picking this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
pref_profile_wf agents alts R1
x \<in> agents
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)
[PROOF STEP]
show "(R2 \<circ> \<pi>) x = R1 x"
[PROOF STATE]
proof (prove)
using this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
pref_profile_wf agents alts R1
x \<in> agents
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)

goal (1 subgoal):
 1. (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
by (intro weak_ranking_eqD[of alts] R2'.prefs_wf) simp_all
[PROOF STATE]
proof (state)
this:
(R2 \<circ> \<pi>) x = R1 x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
R2 \<circ> \<pi> = R1

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<pi>(1) and this
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
R2 \<circ> \<pi> = R1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
R2 \<circ> \<pi> = R1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_Conj [simp]: "size (A AND B) = size A + size B + 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A AND B) = size A + size B + 4
[PROOF STEP]
by (simp add: Conj_def)


[STATEMENT]
lemma HZH_is_X [simp]:
  shows "H * Z * H = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H * Z * H = X
[PROOF STEP]
apply(simp add: X_def Z_def H_def times_mat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 2 2 (\<lambda>(i, j). row (mat 2 2 (\<lambda>(i, j). row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)) j)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1)
[PROOF STEP]
apply(rule cong_mat)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 2 = 2
 2. 2 = 2
 3. \<And>i j. \<lbrakk>i < 2; j < 2\<rbrakk> \<Longrightarrow> (case (i, j) of (i, j) \<Rightarrow> row (mat 2 2 (\<lambda>(i, j). row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)) j)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = (case (i, j) of (i, j) \<Rightarrow> if i = j then 0 else 1)
[PROOF STEP]
by(auto simp add: scalar_prod_def complex_eqI)


[STATEMENT]
lemma max_gtTr:"(n::nat) < max (Suc n) (Suc m) \<and> m < max (Suc n) (Suc m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < max (Suc n) (Suc m) \<and> m < max (Suc n) (Suc m)
[PROOF STEP]
by (simp add:max_def)


[STATEMENT]
lemma closed_segment_in_Reals:
   "\<lbrakk>x \<in> closed_segment a b; a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> x \<in> Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> closed_segment a b; a \<in> \<real>; b \<in> \<real>\<rbrakk> \<Longrightarrow> x \<in> \<real>
[PROOF STEP]
by (meson subsetD convex_Reals convex_contains_segment)


[STATEMENT]
lemma set_join_option [simp]: "set_option (join_option x) = \<Union>(set_option ` set_option x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_option (join_option x) = \<Union> (set_option ` set_option x)
[PROOF STEP]
by(cases x)(simp_all)


[STATEMENT]
lemma hensel_binary:
  assumes cop: "coprime_m D H" and eq: "eq_m C (D * H)"
  and normalized_input: "Mp D = D" "Mp H = H"
  and monic_input: "monic D"
  and hensel_result: "hensel_binary C D H = (D',H')"
  shows "poly_mod.eq_m (p^n) C (D' * H') \<comment> \<open>the main result: equivalence mod \<open>p^n\<close>\<close>
    \<and> monic D' \<comment> \<open>monic output\<close>
    \<and> eq_m D D' \<and> eq_m H H' \<comment> \<open>apply \<open>`mod p`\<close> on \<open>D'\<close> and \<open>H'\<close> yields \<open>D\<close> and \<open>H\<close> again\<close>
    \<and> poly_mod.Mp (p^n) D' = D' \<and> poly_mod.Mp (p^n) H' = H' \<comment> \<open>output is normalized\<close>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
from m1
[PROOF STATE]
proof (chain)
picking this:
1 < p
[PROOF STEP]
have p: "p > 1"
[PROOF STATE]
proof (prove)
using this:
1 < p

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

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
obtain S T where ext: "euclid_ext_poly_dynamic p D H = (S,T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S T. euclid_ext_poly_dynamic p D H = (S, T) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
euclid_ext_poly_dynamic p D H = (S, T)

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
obtain D1 H1 where main: "quadratic_hensel_main C p S T D H n = (D1,H1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>D1 H1. quadratic_hensel_main C p S T D H n = (D1, H1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
quadratic_hensel_main C p S T D H n = (D1, H1)

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note hen = hensel_result[unfolded quadratic_hensel_binary_def ext split Let_def main]
[PROOF STATE]
proof (state)
this:
(D1, H1) = (D', H')

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
have n: "n \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

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

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note eucl = euclid_ext_poly_dynamic[OF cop normalized_input ext]
[PROOF STATE]
proof (state)
this:
D * S + H * T =m 1
Mp S = S
Mp T = T

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note main = quadratic_hensel_main[OF eucl(1) eq monic_input p normalized_input eucl(2-) n main]
[PROOF STATE]
proof (state)
this:
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D1 * H1)
monic D1
D =m D1
H =m H1
poly_mod.Mp (p ^ n) D1 = D1
poly_mod.Mp (p ^ n) H1 = H1

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
using hen main
[PROOF STATE]
proof (prove)
using this:
(D1, H1) = (D', H')
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D1 * H1)
monic D1
D =m D1
H =m H1
poly_mod.Mp (p ^ n) D1 = D1
poly_mod.Mp (p ^ n) H1 = H1

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_functions_of:
  assumes "finite A" "finite B"
  shows "bij_betw (functions_of A B) {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (functions_of A B) {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)
[PROOF STEP]
proof (rule bij_betw_byWitness[where f'="number_partition_of A B"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B a') = a'
 3. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
have quotient_eq: "{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> ((A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B). univ (\<lambda>f. inj_on f A) F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}
[PROOF STEP]
using equiv_domain_and_range_permutation[of A B] inj_on_respects_domain_and_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
equiv (A \<rightarrow>\<^sub>E B) (domain_and_range_permutation A B)
(\<lambda>f. inj_on f A) respects domain_and_range_permutation A B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}
[PROOF STEP]
by (simp only: univ_preserves_predicate)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}

goal (4 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B a') = a'
 3. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B.
       functions_of A B (number_partition_of A B F) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
by (auto simp only: quotient_eq functions_of_number_partition_of)
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F

goal (3 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 3. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "\<forall>N\<in> {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close> number_partition_of_functions_of
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
\<lbrakk>finite ?A; finite ?B; number_partition (card ?A) ?N; size ?N \<le> card ?B\<rbrakk> \<Longrightarrow> number_partition_of ?A ?B (functions_of ?A ?B ?N) = ?N

goal (1 subgoal):
 1. \<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N

goal (2 subgoals):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 2. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "number_partition_of A B ` ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)
    \<subseteq> {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
by (auto simp add: quotient_eq number_partition_of inj_on_implies_all_one simp del: One_nat_def)
[PROOF STATE]
proof (state)
this:
number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}

goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
show "functions_of A B ` {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
    \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
by (auto simp add: quotient_eq intro: functions_of functions_of_is_inj_on)
[PROOF STATE]
proof (state)
this:
functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_INF: "snd (INF x\<in>A. f x) = (INF x\<in>A. snd (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Inf (f ` A)) = (INF x\<in>A. snd (f x))
[PROOF STEP]
by (simp add: snd_Inf image_image)


[STATEMENT]
lemma replacement_theorem:
  assumes "independent K (Us' @ Us)" and "independent K Vs"
    and "Span K (Us' @ Us) \<subseteq> Span K Vs"
  shows "\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> independent K (Vs' @ Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
proof (induct "length Us'" arbitrary: Us' Us)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Us' Us. \<lbrakk>0 = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
 2. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (2 subgoals):
 1. \<And>Us' Us. \<lbrakk>0 = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
 2. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs
[PROOF STEP]
obtain u Us'' where Us'': "Us' = Us'' @ [u]"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>Us'' u. Us' = Us'' @ [u] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis list.size(3) nat.simps(3) rev_exhaust)
[PROOF STATE]
proof (state)
this:
Us' = Us'' @ [u]

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Us' = Us'' @ [u]
[PROOF STEP]
obtain Vs' where Vs': "set Vs' \<subseteq> set Vs" "length Vs' = n" "independent K (Vs' @ (u # Us))"
[PROOF STATE]
proof (prove)
using this:
Us' = Us'' @ [u]

goal (1 subgoal):
 1. (\<And>Vs'. \<lbrakk>set Vs' \<subseteq> set Vs; length Vs' = n; local.independent K (Vs' @ u # Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc(1)[of Us'' "u # Us"] Suc(2-5)
[PROOF STATE]
proof (prove)
using this:
Us' = Us'' @ [u]
\<lbrakk>n = length Us''; local.independent K (Us'' @ u # Us); local.independent K Vs; Span K (Us'' @ u # Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us'' \<and> local.independent K (Vs' @ u # Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>Vs'. \<lbrakk>set Vs' \<subseteq> set Vs; length Vs' = n; local.independent K (Vs' @ u # Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
hence li: "independent K ((u # Vs') @ Us)"
[PROOF STATE]
proof (prove)
using this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)

goal (1 subgoal):
 1. local.independent K ((u # Vs') @ Us)
[PROOF STEP]
using independent_same_set[OF _ _ Vs'(3), of "(u # Vs') @ Us"]
[PROOF STATE]
proof (prove)
using this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)
\<lbrakk>set (Vs' @ u # Us) = set ((u # Vs') @ Us); length (Vs' @ u # Us) = length ((u # Vs') @ Us)\<rbrakk> \<Longrightarrow> local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. local.independent K ((u # Vs') @ Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
have in_carrier:
    "u \<in> carrier R" "set Us \<subseteq> carrier R" "set Us' \<subseteq> carrier R" "set Vs \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> carrier R &&& set Us \<subseteq> carrier R) &&& set Us' \<subseteq> carrier R &&& set Vs \<subseteq> carrier R
[PROOF STEP]
using Suc(3-4)[THEN independent_in_carrier] Us''
[PROOF STATE]
proof (prove)
using this:
set (Us' @ Us) \<subseteq> carrier R
set Vs \<subseteq> carrier R
Us' = Us'' @ [u]

goal (1 subgoal):
 1. (u \<in> carrier R &&& set Us \<subseteq> carrier R) &&& set Us' \<subseteq> carrier R &&& set Vs \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
have "Span K ((u # Vs') @ Us) \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
have "set Us \<subseteq> Span K Vs" "u \<in> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set Us \<subseteq> Span K Vs &&& u \<in> Span K Vs
[PROOF STEP]
using Suc(5) Span_base_incl[of "Us' @ Us"] Us'' in_carrier(2-3)
[PROOF STATE]
proof (prove)
using this:
Span K (Us' @ Us) \<subseteq> Span K Vs
set (Us' @ Us) \<subseteq> carrier R \<Longrightarrow> set (Us' @ Us) \<subseteq> Span K (Us' @ Us)
Us' = Us'' @ [u]
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R

goal (1 subgoal):
 1. set Us \<subseteq> Span K Vs &&& u \<in> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
have "set Vs' \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set Vs' \<subseteq> Span K Vs
[PROOF STEP]
using Span_base_incl[OF in_carrier(4)] Vs'(1)
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> Span K Vs
set Vs' \<subseteq> set Vs

goal (1 subgoal):
 1. set Vs' \<subseteq> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs' \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs
set Vs' \<subseteq> Span K Vs
[PROOF STEP]
have "set ((u # Vs') @ Us) \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
using this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs
set Vs' \<subseteq> Span K Vs

goal (1 subgoal):
 1. set ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
using mono_Span_subset[OF _ in_carrier(4)]
[PROOF STATE]
proof (prove)
using this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs
set ?Us \<subseteq> Span K Vs \<Longrightarrow> Span K ?Us \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
by (simp del: Span.simps)
[PROOF STATE]
proof (state)
this:
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
obtain v where "v \<in> set Vs" "independent K ((v # Vs') @ Us)"
[PROOF STATE]
proof (prove)
using this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> set Vs; local.independent K ((v # Vs') @ Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using independent_replacement[OF _ Suc(4), of u "Vs' @ Us"]
[PROOF STATE]
proof (prove)
using this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
\<lbrakk>local.independent K (u # Vs' @ Us); Span K (u # Vs' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>v\<in>set Vs. local.independent K (v # Vs' @ Us)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> set Vs; local.independent K ((v # Vs') @ Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
using Vs'(1-2) Suc(2)
[PROOF STATE]
proof (prove)
using this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)
set Vs' \<subseteq> set Vs
length Vs' = n
Suc n = length Us'

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
by (metis (mono_tags, lifting) insert_subset length_Cons list.simps(15))
[PROOF STATE]
proof (state)
this:
\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_codim_map:
  "x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> card (f`x - f`y) = card (x-y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> card (f ` x - f ` y) = card (x - y)
[PROOF STEP]
using inj inj_on_image_set_diff[of f _ x y] finite_simplex subset_inj_on[of f _ "x-y"]
        inj_on_iff_eq_card[of "x-y"]
[PROOF STATE]
proof (prove)
using this:
inj_on f (\<Union> X)
\<lbrakk>inj_on f ?C; x - y \<subseteq> ?C; y \<subseteq> ?C\<rbrakk> \<Longrightarrow> f ` (x - y) = f ` x - f ` y
?x \<in> X \<Longrightarrow> finite ?x
\<lbrakk>inj_on f ?B; x - y \<subseteq> ?B\<rbrakk> \<Longrightarrow> inj_on f (x - y)
finite (x - y) \<Longrightarrow> inj_on ?f (x - y) = (card (?f ` (x - y)) = card (x - y))

goal (1 subgoal):
 1. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> card (f ` x - f ` y) = card (x - y)
[PROOF STEP]
by    fastforce


[STATEMENT]
lemma sum_unroll:
  "(\<Sum>k\<le>n::nat. f k) = (if n = 0 then f 0 else f n + (\<Sum>k\<le>n - 1. f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = (if n = 0 then f 0 else f n + sum f {..n - 1})
[PROOF STEP]
by (cases n) (simp_all add: add_ac)


[STATEMENT]
lemma cf_cat_prod_21_of_3_is_functor'[cat_cs_intros]:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "category \<alpha> \<CC>"
    and "\<AA>' = \<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>"
    and "\<BB>' = (\<AA> \<times>\<^sub>C \<BB>) \<times>\<^sub>C \<CC>"
  shows "cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
using assms(1-3)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>

goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms(4,5)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>

goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> (\<AA> \<times>\<^sub>C \<BB>) \<times>\<^sub>C \<CC>
[PROOF STEP]
by (rule cf_cat_prod_21_of_3_is_functor)


[STATEMENT]
lemma lt_dim_vec_MV_Rel[transfer_rule]: "(MV_Rel ===> (=) ===> (=)) (\<lambda> v j. j < dim_vec v) (\<lambda> v j. j < dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MV_Rel ===> (=) ===> (=)) (\<lambda>v j. j < dim_vec v) (\<lambda>v j. j < dim_vec v)
[PROOF STEP]
unfolding MV_Rel_def rel_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. vec_mod x = to_int_vec y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_vec x) = (ya < dim_vec y))
[PROOF STEP]
using index_map_vec(2) vec_mod_dim
[PROOF STATE]
proof (prove)
using this:
dim_vec (map_vec ?f ?v) = dim_vec ?v
dim_vec (vec_mod ?v) = dim_vec ?v

goal (1 subgoal):
 1. \<forall>x y. vec_mod x = to_int_vec y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_vec x) = (ya < dim_vec y))
[PROOF STEP]
by metis


[STATEMENT]
lemma open_prod_elim:
  assumes "open S" and "x \<in> S"
  obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma convolution_zero :
  fixes     f g :: "'a::group_add \<Rightarrow> 'b::{comm_monoid_add,mult_zero}"
  shows     "f = 0 \<or> g = 0 \<Longrightarrow> convolution f g = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = 0 \<or> g = 0 \<Longrightarrow> convolution f g = 0
[PROOF STEP]
unfolding convolution_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = 0 \<or> g = 0 \<Longrightarrow> (\<lambda>x. \<Sum>y | x - y \<in> supp f \<and> y \<in> supp g. f (x - y) * g y) = 0
[PROOF STEP]
by        auto


[STATEMENT]
lemma Limit_vpair_in_VsetI[intro]:
  assumes "Limit \<alpha>" and "a \<in>\<^sub>\<circ> Vset \<alpha>" and "b \<in>\<^sub>\<circ> Vset \<alpha>"
  shows "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
using assms Limit_vdoubleton_in_VsetI Limit_vsingleton_in_VsetI
[PROOF STATE]
proof (prove)
using this:
Limit \<alpha>
a \<in>\<^sub>\<circ> Vset \<alpha>
b \<in>\<^sub>\<circ> Vset \<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>; ?b \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a, ?b} \<in>\<^sub>\<circ> Vset ?\<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a} \<in>\<^sub>\<circ> Vset ?\<alpha>

goal (1 subgoal):
 1. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
unfolding vpair_def
[PROOF STATE]
proof (prove)
using this:
Limit \<alpha>
a \<in>\<^sub>\<circ> Vset \<alpha>
b \<in>\<^sub>\<circ> Vset \<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>; ?b \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a, ?b} \<in>\<^sub>\<circ> Vset ?\<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a} \<in>\<^sub>\<circ> Vset ?\<alpha>

goal (1 subgoal):
 1. set {set {a}, set {a, b}} \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
by simp


[STATEMENT]
lemma rel_list_all2_Cons2:
  "list_all2 (fun_of S) xs (y#ys) =
  (\<exists>z zs. xs = z#zs \<and> (z,y) \<in> S \<and> list_all2 (fun_of S) zs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) xs (y # ys) = (\<exists>z zs. xs = z # zs \<and> (z, y) \<in> S \<and> list_all2 (fun_of S) zs ys)
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) xs (y # ys) = (\<exists>z zs. xs = z # zs \<and> (z, y) \<in> S \<and> list_all2 (fun_of S) zs ys)
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma decode_0_iff: "well_base\<^sub>h M \<Longrightarrow> aligned\<^sub>d e M \<Longrightarrow> decode e M = 0 \<longleftrightarrow> M = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.well_base\<^sub>h M; local.aligned\<^sub>d e M\<rbrakk> \<Longrightarrow> (local.decode e M = 0) = (M = 0)
[PROOF STEP]
by (metis aligned\<^sub>d_0 decode_0 decode_exp_shift encode_0 less_imp_decode_less mult_0_right neqE
    not_less_zero well_base\<^sub>h_encode)


[STATEMENT]
lemma finite_pderivs_lang_UNIV1:
  shows "finite (pderivs_lang UNIV1 r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (pderivs_lang UNIV1 r)
[PROOF STEP]
apply(induct r)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. finite (pderivs_lang UNIV1 Zero)
 2. finite (pderivs_lang UNIV1 One)
 3. \<And>x. finite (pderivs_lang UNIV1 (Atom x))
 4. \<And>r1 r2. \<lbrakk>finite (pderivs_lang UNIV1 r1); finite (pderivs_lang UNIV1 r2)\<rbrakk> \<Longrightarrow> finite (pderivs_lang UNIV1 (Plus r1 r2))
 5. \<And>r1 r2. \<lbrakk>finite (pderivs_lang UNIV1 r1); finite (pderivs_lang UNIV1 r2)\<rbrakk> \<Longrightarrow> finite (pderivs_lang UNIV1 (Times r1 r2))
 6. \<And>r. finite (pderivs_lang UNIV1 r) \<Longrightarrow> finite (pderivs_lang UNIV1 (Star r))
[PROOF STEP]
apply(simp_all add:
  finite_subset[OF pderivs_lang_Times]
  finite_subset[OF pderivs_lang_Star])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma div_Suc: "
  0 < n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (drule Suc_leI, drule le_imp_less_or_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < n \<or> Suc 0 = n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (case_tac "n = Suc 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0\<rbrakk> \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (split if_split, intro conjI impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) = n\<rbrakk> \<Longrightarrow> Suc m div n = Suc (m div n)
 2. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (rule_tac t="Suc m" and s="m + 1" in subst, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) = n\<rbrakk> \<Longrightarrow> (m + 1) div n = Suc (m div n)
 2. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (subst div_add1_eq2, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < n; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (insert le_neq_trans[OF mod_less_divisor[THEN Suc_leI, of n m]], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (m mod n) < n \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (rule_tac t="Suc m" and s="m + 1" in subst, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (m mod n) < n \<Longrightarrow> (m + 1) div n = m div n
[PROOF STEP]
apply (subst div_add1_eq1, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fds_abs_converges_prod:
  fixes s :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology}"
  shows "(\<And>x. x \<in> A \<Longrightarrow> fds_abs_converges (f x) s) \<Longrightarrow> fds_abs_converges (prod f A) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> fds_abs_converges (f x) s) \<Longrightarrow> fds_abs_converges (prod f A) s
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: fds_abs_converges_mult)


[STATEMENT]
lemma UINF_refines:
  "\<lbrakk> \<And> i. i\<in>I \<Longrightarrow> P \<sqsubseteq> Q i \<rbrakk> \<Longrightarrow> P \<sqsubseteq> (\<Sqinter> i\<in>I \<bullet> Q i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> P \<sqsubseteq> Q i) \<Longrightarrow> P \<sqsubseteq> (\<Sqinter> i \<in> I \<bullet> Q i)
[PROOF STEP]
by (simp add: UINF_as_Sup_collect, metis SUP_least)


[STATEMENT]
lemma confluentp_eq_semiconfluentp: "confluentp r \<longleftrightarrow> semiconfluentp r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confluentp r = semiconfluentp r
[PROOF STEP]
by(blast intro: semiconfluentp_imp_confluentp confluentp_imp_semiconfluentp)


[STATEMENT]
lemma walk_array_append:
  "walk_array f (Array (xs@[x])) b = f (walk_array f (Array xs) b) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. walk_array f (Array (xs @ [x])) b = f (walk_array f (Array xs) b) x
[PROOF STEP]
by (induct xs arbitrary: b) (simp add: walk_array_def, simp add: walk_array_Cons)


[STATEMENT]
lemma mat_of_col_last_nth[simp]:
  "\<lbrakk> i < n; i < dim_col A \<rbrakk> \<Longrightarrow> col (mat_col_last A n) i = col A (dim_col A - n + i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < n; i < dim_col A\<rbrakk> \<Longrightarrow> col (mat_col_last A n) i = col A (dim_col A - n + i)
[PROOF STEP]
unfolding mat_col_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < n; i < dim_col A\<rbrakk> \<Longrightarrow> col (mat_row_last A\<^sup>T n)\<^sup>T i = col A (dim_col A - n + i)
[PROOF STEP]
by auto


[STATEMENT]
lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (\<Union> (H ` A)) = (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
by (intro equalityI parts_UN_subset1 parts_UN_subset2)


[STATEMENT]
lemma is_nth_power_nth_power [simp, intro]: "is_nth_power n (x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_nth_power n (x ^ n)
[PROOF STEP]
by (auto simp add: is_nth_power_def)


[STATEMENT]
lemma wf_tuple_restrict: "wf_tuple n B v \<Longrightarrow> A \<inter> B = C \<Longrightarrow> wf_tuple n C (restrict A v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_tuple n B v; A \<inter> B = C\<rbrakk> \<Longrightarrow> wf_tuple n C (restrict A v)
[PROOF STEP]
unfolding restrict_def wf_tuple_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length v = n \<and> (\<forall>i<n. (v ! i = None) = (i \<notin> B)); A \<inter> B = C\<rbrakk> \<Longrightarrow> length (map (\<lambda>i. if i \<in> A then v ! i else None) [0..<length v]) = n \<and> (\<forall>i<n. (map (\<lambda>i. if i \<in> A then v ! i else None) [0..<length v] ! i = None) = (i \<notin> C))
[PROOF STEP]
by auto


[STATEMENT]
lemma M_is_Z_iff_1_is_top:
  "M = Z \<longleftrightarrow> 1 = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M = Z) = ((1::'a) = top)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
assume "M = Z"
[PROOF STATE]
proof (state)
this:
M = Z

goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
hence "Z = S\<^sup>T * Z"
[PROOF STATE]
proof (prove)
using this:
M = Z

goal (1 subgoal):
 1. Z = S[[Z]]
[PROOF STEP]
by (metis S_mapping Z_point order.antisym bijective_reverse inf.eq_refl shunt_mapping)
[PROOF STATE]
proof (state)
this:
Z = S[[Z]]

goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
thus "1 = top"
[PROOF STATE]
proof (prove)
using this:
Z = S[[Z]]

goal (1 subgoal):
 1. (1::'a) = top
[PROOF STEP]
by (metis S_star_Z_top Z_point inf.eq_refl star_left_induct sup.absorb2 symmetric_top_closed top_le)
[PROOF STATE]
proof (state)
this:
(1::'a) = top

goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
assume "1 = top"
[PROOF STATE]
proof (state)
this:
(1::'a) = top

goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
thus "M = Z"
[PROOF STATE]
proof (prove)
using this:
(1::'a) = top

goal (1 subgoal):
 1. M = Z
[PROOF STEP]
using S_mapping comp_right_one mult_1_left
[PROOF STATE]
proof (prove)
using this:
(1::'a) = top
coreflexive (S[[S]]) \<and> times_top_class.total S
?x * (1::'a) = ?x
(1::'a) * ?a = ?a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_kat_21_opp:  "y \<cdot> n z \<le> n x \<cdot> y \<Longrightarrow> n x \<cdot> y \<cdot> n z = y \<cdot> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
assume "y \<cdot> n z \<le> n x \<cdot> y"
[PROOF STATE]
proof (state)
this:
y \<cdot> !z \<le> !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
hence "y \<cdot> n z + n x \<cdot> y = n x \<cdot> y"
[PROOF STATE]
proof (prove)
using this:
y \<cdot> !z \<le> !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z + !x \<cdot> y = !x \<cdot> y
[PROOF STEP]
by (meson local.join.sup_absorb2)
[PROOF STATE]
proof (state)
this:
y \<cdot> !z + !x \<cdot> y = !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
hence "n x \<cdot> y \<cdot> n z = y \<cdot> n z + (n x \<cdot> (y \<cdot> n z) + 0)"
[PROOF STATE]
proof (prove)
using this:
y \<cdot> !z + !x \<cdot> y = !x \<cdot> y

goal (1 subgoal):
 1. !x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))
[PROOF STEP]
by (metis local.add_zeror local.distrib_right' local.n_mult_idem mult_assoc)
[PROOF STATE]
proof (state)
this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))

goal (1 subgoal):
 1. !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
by (metis local.add_zeror local.distrib_right' local.join.sup_absorb2 local.join.sup_left_commute local.mult_onel local.n_subid')
[PROOF STATE]
proof (state)
this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unique_ConsD: "unique (x#xs) \<Longrightarrow> unique xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unique (x # xs) \<Longrightarrow> unique xs
[PROOF STEP]
by (simp add: unique_def)


[STATEMENT]
lemma sunflower_nonempty_core_lift:
  assumes finE: "finite (E :: 'a set)"
    and sunflower: "\<And> G :: 'a set set.
     (\<forall> A \<in> G. finite A \<and> card A \<le> k) \<Longrightarrow> card G > c
        \<Longrightarrow> \<exists> S. S \<subseteq> G \<and> sunflower S \<and> card S = r"
    and F: "\<forall> A \<in> F. A \<subseteq> E \<and> card A \<le> k"
    and empty: "{} \<notin> F"
    and cardF: "card F > card E * c"
  shows "\<exists> S. S \<subseteq> F \<and> sunflower S \<and> card S = r \<and> (\<Inter> S) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
proof (cases "r = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
r \<noteq> 0

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from F empty
[PROOF STATE]
proof (chain)
picking this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F
[PROOF STEP]
have F': "\<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k "
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F

goal (1 subgoal):
 1. \<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k
[PROOF STEP]
using finE
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F
finite E

goal (1 subgoal):
 1. \<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k
[PROOF STEP]
by (metis One_nat_def Suc_leI card_gt_0_iff finite_subset)
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from cardF
[PROOF STATE]
proof (chain)
picking this:
card E * c < card F
[PROOF STEP]
have cardF': "(card E choose 1) * c < card F"
[PROOF STATE]
proof (prove)
using this:
card E * c < card F

goal (1 subgoal):
 1. (card E choose 1) * c < card F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(card E choose 1) * c < card F

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from sunflower_card_core_lift[OF finE sunflower, of k c F 1, OF _ _ F' cardF' _ False]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> \<forall>A\<in>G. finite A \<and> card A \<le> k; \<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> c < card G; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> 1 \<le> card (\<Inter> S)
[PROOF STEP]
obtain S where "S \<subseteq> F" and main: "sunflower S" "card S = r" "1 \<le> card (\<Inter> S)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> \<forall>A\<in>G. finite A \<and> card A \<le> k; \<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> c < card G; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> 1 \<le> card (\<Inter> S)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>S \<subseteq> F; sunflower S; card S = r; 1 \<le> card (\<Inter> S)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> F
sunflower S
card S = r
1 \<le> card (\<Inter> S)

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> F
sunflower S
card S = r
1 \<le> card (\<Inter> S)

goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
by (intro exI[of _ S], auto)
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}

goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
r = 0

goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r = 0

goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
by (intro exI[of _ "{}"], auto simp: empty_sunflower)
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bool_to_ternary_simp3: "eval_ternary_Not (bool_to_ternary X) = TernaryTrue \<longleftrightarrow> \<not> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval_ternary_Not (bool_to_ternary X) = TernaryTrue) = (\<not> X)
[PROOF STEP]
by (metis (full_types) bool_to_ternary_simp2 eval_ternary_Not.simps(1) eval_ternary_idempotence_Not)


[STATEMENT]
lemma dist_geq_iff_midpoint_in_between:
  fixes A B X :: "'a::euclidean_space"
  assumes "between (A, B) X"
  shows "dist A X \<le> dist B X \<longleftrightarrow> between (X, B) (midpoint A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist A X \<le> dist B X) = between (X, B) (midpoint A B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
assume "dist A X \<le> dist B X"
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist B X

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>between (A, B) X\<close> this
[PROOF STATE]
proof (chain)
picking this:
between (A, B) X
dist A X \<le> dist B X
[PROOF STEP]
obtain u
    where u: "1 / 2 \<le> u" "u \<le> 1" and X: "X = u *\<^sub>R A + (1 - u) *\<^sub>R B"
[PROOF STATE]
proof (prove)
using this:
between (A, B) X
dist A X \<le> dist B X

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; X = u *\<^sub>R A + (1 - u) *\<^sub>R B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using betweenE_if_dist_leq
[PROOF STATE]
proof (prove)
using this:
between (A, B) X
dist A X \<le> dist B X
\<lbrakk>between (?A, ?B) ?X; dist ?A ?X \<le> dist ?B ?X; \<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; ?X = u *\<^sub>R ?A + (1 - u) *\<^sub>R ?B\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; X = u *\<^sub>R A + (1 - u) *\<^sub>R B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 / 2 \<le> u
u \<le> 1
X = u *\<^sub>R A + (1 - u) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
have M: "midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B
[PROOF STEP]
unfolding midpoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) /\<^sub>R 2 = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B
[PROOF STEP]
by (simp add: scaleR_add_right)
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>1 / 2 \<le> u\<close>
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
[PROOF STEP]
have 1: "midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - (1 / (2 * u))) *\<^sub>R B"
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
have "(2 - u * 2) / (2 * u) = 1 / u - u / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - u / u
[PROOF STEP]
using u(1)
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - u / u
[PROOF STEP]
by (simp add: diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - u / u

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - u / u

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
have "\<dots> = 1 / u - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / u - u / u = 1 / u - 1
[PROOF STEP]
using u(1)
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. 1 / u - u / u = 1 / u - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / u - u / u = 1 / u - 1

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
have "(2 - u * 2) / (2 * u) = 1 / u - 1"
[PROOF STATE]
proof (prove)
using this:
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
from \<open>1 / 2 \<le> u\<close> this
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
using X M
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1
X = u *\<^sub>R A + (1 - u) *\<^sub>R B
midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
by (simp add: scaleR_add_right scaleR_add_left[symmetric])
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from u
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
u \<le> 1
[PROOF STEP]
have 2: "(1 / (2 * u)) \<ge> 0" "(1 / (2 * u)) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
u \<le> 1

goal (1 subgoal):
 1. 0 \<le> 1 / (2 * u) &&& 1 / (2 * u) \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1
[PROOF STEP]
show "between (X, B) (midpoint A B)"
[PROOF STATE]
proof (prove)
using this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1

goal (1 subgoal):
 1. between (X, B) (midpoint A B)
[PROOF STEP]
using betweenI [of concl: B X]
[PROOF STATE]
proof (prove)
using this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1
\<lbrakk>0 \<le> ?u; ?u \<le> 1; ?x = (1 - ?u) *\<^sub>R B + ?u *\<^sub>R X\<rbrakk> \<Longrightarrow> between (B, X) ?x

goal (1 subgoal):
 1. between (X, B) (midpoint A B)
[PROOF STEP]
by (metis add.commute between_commute)
[PROOF STATE]
proof (state)
this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
assume "between (X, B) (midpoint A B)"
[PROOF STATE]
proof (state)
this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (X, B) (midpoint A B)
[PROOF STEP]
have "between (A, midpoint A B) X"
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (A, midpoint A B) X
[PROOF STEP]
using \<open>between (A, B) X\<close> between_midpoint(1) between_swap
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)
between (A, B) X
between (?a, ?b) (midpoint ?a ?b)
\<lbrakk>between (?A, ?B) ?X; between (?A, ?B) ?Y\<rbrakk> \<Longrightarrow> between (?X, ?B) ?Y = between (?A, ?Y) ?X

goal (1 subgoal):
 1. between (A, midpoint A B) X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
between (A, midpoint A B) X

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (A, midpoint A B) X
[PROOF STEP]
have "dist A X \<le> dist A (midpoint A B)"
[PROOF STATE]
proof (prove)
using this:
between (A, midpoint A B) X

goal (1 subgoal):
 1. dist A X \<le> dist A (midpoint A B)
[PROOF STEP]
using between zero_le_dist
[PROOF STATE]
proof (prove)
using this:
between (A, midpoint A B) X
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
0 \<le> dist ?x ?y

goal (1 subgoal):
 1. dist A X \<le> dist A (midpoint A B)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist A (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist A (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
have "dist A (midpoint A B) \<le> dist B (midpoint A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist A (midpoint A B) \<le> dist B (midpoint A B)
[PROOF STEP]
by (simp add: dist_midpoint)
[PROOF STATE]
proof (state)
this:
dist A (midpoint A B) \<le> dist B (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist A (midpoint A B) \<le> dist B (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>between (X, B) (midpoint A B)\<close>
[PROOF STATE]
proof (chain)
picking this:
between (X, B) (midpoint A B)
[PROOF STEP]
have "dist B (midpoint A B) \<le> dist B X"
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. dist B (midpoint A B) \<le> dist B X
[PROOF STEP]
using between zero_le_dist
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
0 \<le> dist ?x ?y

goal (1 subgoal):
 1. dist B (midpoint A B) \<le> dist B X
[PROOF STEP]
by (metis add.commute dist_commute le_add_same_cancel1)
[PROOF STATE]
proof (state)
this:
dist B (midpoint A B) \<le> dist B X

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist A X \<le> dist B X
[PROOF STEP]
show "dist A X \<le> dist B X"
[PROOF STATE]
proof (prove)
using this:
dist A X \<le> dist B X

goal (1 subgoal):
 1. dist A X \<le> dist B X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist B X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_prod_elim:
  assumes "open S" and "x \<in> S"
  obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma of_complex_prod[simp]: "of_complex (prod f s) = (\<Prod>x\<in>s. of_complex (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex (prod f s) = (\<Prod>x\<in>s. of_complex (f x))
[PROOF STEP]
by (induct s rule: infinite_finite_induct) auto


[STATEMENT]
lemma sum_order_add_mset: "(\<And> x . f x \<ge> 0) \<Longrightarrow> (\<Sum> x \<in># A. f x ) \<le> (\<Sum> x \<in># add_mset a A. f x )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. (0::'a) \<le> f x) \<Longrightarrow> \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset f (add_mset a A))
[PROOF STEP]
by (simp add: local.add_increasing)


[STATEMENT]
lemma create_ldeep_inorder[simp]: "left_deep t \<Longrightarrow> create_ldeep (inorder t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_deep t \<Longrightarrow> create_ldeep (inorder t) = t
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. left_deep (Relation x) \<Longrightarrow> create_ldeep (inorder (Relation x)) = Relation x
 2. \<And>t1 t2. \<lbrakk>left_deep t1 \<Longrightarrow> create_ldeep (inorder t1) = t1; left_deep t2 \<Longrightarrow> create_ldeep (inorder t2) = t2; left_deep (Join t1 t2)\<rbrakk> \<Longrightarrow> create_ldeep (inorder (Join t1 t2)) = Join t1 t2
[PROOF STEP]
apply (simp add: create_ldeep_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>left_deep t1 \<Longrightarrow> create_ldeep (inorder t1) = t1; left_deep t2 \<Longrightarrow> create_ldeep (inorder t2) = t2; left_deep (Join t1 t2)\<rbrakk> \<Longrightarrow> create_ldeep (inorder (Join t1 t2)) = Join t1 t2
[PROOF STEP]
by (metis Nil_is_append_conv create_ldeep_snoc inorder.simps
      ldeep_trans left_deep.simps(3) not_Cons_self2 relations_mset.cases)


[STATEMENT]
lemma distinct_sorted: "sorted xs \<Longrightarrow> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted xs \<Longrightarrow> distinct xs
[PROOF STEP]
by (induct xs) (auto simp add: sorted_wrt_append)