[STATEMENT]
lemma finite_ta_reachable [simp]:
  "finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}
[PROOF STEP]
have "{q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t} \<subseteq> fset (\<Q> \<A>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t} \<subseteq> fset (\<Q> \<A>)
[PROOF STEP]
using ground_ta_der_states[of _ \<A>]
[PROOF STATE]
proof (prove)
using this:
ground ?t \<Longrightarrow> ta_der \<A> ?t |\<subseteq>| \<Q> \<A>

goal (1 subgoal):
 1. {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t} \<subseteq> fset (\<Q> \<A>)
[PROOF STEP]
by auto (metis fsubsetD notin_fset)
[PROOF STATE]
proof (state)
this:
{q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t} \<subseteq> fset (\<Q> \<A>)

goal (1 subgoal):
 1. finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}
[PROOF STEP]
from finite_subset[OF this]
[PROOF STATE]
proof (chain)
picking this:
finite (fset (\<Q> \<A>)) \<Longrightarrow> finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (fset (\<Q> \<A>)) \<Longrightarrow> finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}

goal (1 subgoal):
 1. finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {q. \<exists>t. ground t \<and> q |\<in>| ta_der \<A> t}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma three_cycles_incl: "three_cycles n \<subseteq> carrier (alt_group n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. three_cycles n \<subseteq> carrier (alt_group n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
assume "p \<in> three_cycles n"
[PROOF STATE]
proof (state)
this:
p \<in> three_cycles n

goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> three_cycles n
[PROOF STEP]
obtain cs where cs: "p = cycle_of_list cs" "cycle cs" "length cs = 3" "set cs \<subseteq> {1..n}"
[PROOF STATE]
proof (prove)
using this:
p \<in> three_cycles n

goal (1 subgoal):
 1. (\<And>cs. \<lbrakk>p = cycle_of_list cs; cycle cs; length cs = 3; set cs \<subseteq> {1..n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = cycle_of_list cs
cycle cs
length cs = 3
set cs \<subseteq> {1..n}

goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
obtain a b c where cs_def: "cs = [ a, b, c ]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b c. cs = [a, b, c] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using stupid_lemma[OF cs(3)]
[PROOF STATE]
proof (prove)
using this:
cs = [cs ! 0, cs ! 1, cs ! 2]

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

goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
have "swapidseq (Suc (Suc 0)) ((transpose a b) \<circ> (Fun.swap b c id))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))
[PROOF STEP]
using comp_Suc[OF comp_Suc[OF id], of b c a b] cs(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b \<noteq> c; a \<noteq> b\<rbrakk> \<Longrightarrow> swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (Transposition.transpose b c \<circ> id))
cycle cs

goal (1 subgoal):
 1. swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))
[PROOF STEP]
unfolding cs_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b \<noteq> c; a \<noteq> b\<rbrakk> \<Longrightarrow> swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (Transposition.transpose b c \<circ> id))
cycle [a, b, c]

goal (1 subgoal):
 1. swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))

goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
hence "evenperm p"
[PROOF STATE]
proof (prove)
using this:
swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))

goal (1 subgoal):
 1. evenperm p
[PROOF STEP]
using cs(1)
[PROOF STATE]
proof (prove)
using this:
swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))
p = cycle_of_list cs

goal (1 subgoal):
 1. evenperm p
[PROOF STEP]
unfolding cs_def
[PROOF STATE]
proof (prove)
using this:
swapidseq (Suc (Suc 0)) (Transposition.transpose a b \<circ> (id \<circ> Transposition.transpose b c))
p = cycle_of_list [a, b, c]

goal (1 subgoal):
 1. evenperm p
[PROOF STEP]
by (simp add: evenperm_unique)
[PROOF STATE]
proof (state)
this:
evenperm p

goal (1 subgoal):
 1. \<And>x. x \<in> three_cycles n \<Longrightarrow> x \<in> carrier (alt_group n)
[PROOF STEP]
thus "p \<in> carrier (alt_group n)"
[PROOF STATE]
proof (prove)
using this:
evenperm p

goal (1 subgoal):
 1. p \<in> carrier (alt_group n)
[PROOF STEP]
using permutes_subset[OF cycle_permutes cs(4)]
[PROOF STATE]
proof (prove)
using this:
evenperm p
cycle_of_list cs permutes {1..n}

goal (1 subgoal):
 1. p \<in> carrier (alt_group n)
[PROOF STEP]
unfolding alt_group_carrier cs(1)
[PROOF STATE]
proof (prove)
using this:
evenperm (cycle_of_list cs)
cycle_of_list cs permutes {1..n}

goal (1 subgoal):
 1. cycle_of_list cs permutes {1..n} \<and> evenperm (cycle_of_list cs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p \<in> carrier (alt_group n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_D_F_eq_prod_A: "prod id D * prod id F = prod id A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id D * prod id F = prod id A
[PROOF STEP]
by (metis F_D_disj F_Un_D_eq_A Int_commute Un_commute finite_D finite_F prod.union_disjoint)


[STATEMENT]
theorem E16: "\<turnstile> \<diamond>\<box>F \<longrightarrow> \<diamond>F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<diamond>\<box>F \<longrightarrow> \<diamond>F
[PROOF STEP]
by (rule STL4_eve[OF ax1])


[STATEMENT]
lemma connected_sphere_gen:
  assumes "convex S" "bounded S" "aff_dim S \<noteq> 1"
  shows "connected(rel_frontier S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected (rel_frontier S)
[PROOF STEP]
by (simp add: assms path_connected_imp_connected path_connected_sphere_gen)


[STATEMENT]
lemma order_trans_classes1:
  "c \<le> d \<Longrightarrow> d \<le> e \<Longrightarrow> c \<le> e"
  for c d e :: classes1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<le> d; d \<le> e\<rbrakk> \<Longrightarrow> c \<le> e
[PROOF STEP]
unfolding less_eq_classes1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subclass1\<^sup>=\<^sup>= c d; subclass1\<^sup>=\<^sup>= d e\<rbrakk> \<Longrightarrow> subclass1\<^sup>=\<^sup>= c e
[PROOF STEP]
using subclass1.simps
[PROOF STATE]
proof (prove)
using this:
subclass1 ?a1.0 ?a2.0 = ((\<exists>c. ?a1.0 = c \<and> ?a2.0 = Object \<and> c \<noteq> Object) \<or> ?a1.0 = Employee \<and> ?a2.0 = Person \<or> ?a1.0 = Customer \<and> ?a2.0 = Person)

goal (1 subgoal):
 1. \<lbrakk>subclass1\<^sup>=\<^sup>= c d; subclass1\<^sup>=\<^sup>= d e\<rbrakk> \<Longrightarrow> subclass1\<^sup>=\<^sup>= c e
[PROOF STEP]
by auto


[STATEMENT]
lemma function_factors_right:
  "(\<forall>x. \<exists>y. g y = f x) \<longleftrightarrow> (\<exists>h. f = g \<circ> h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. \<exists>y. g y = f x) = (\<exists>h. f = g \<circ> h)
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. \<exists>y. g y = f x) = (\<exists>h. f = (\<lambda>x. g (h x)))
[PROOF STEP]
by metis


[STATEMENT]
lemma fps_divide_shift_denom_conv_times_fps_X_power:
  fixes   f g :: "'a::{semiring_1,inverse,uminus} fps"
  assumes "n \<le> subdegree g" "subdegree g \<le> subdegree f"
  shows   "f / fps_shift n g = f / g * fps_X ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / fps_shift n g = f / g * fps_X ^ n
[PROOF STEP]
using   assms
[PROOF STATE]
proof (prove)
using this:
n \<le> subdegree g
subdegree g \<le> subdegree f

goal (1 subgoal):
 1. f / fps_shift n g = f / g * fps_X ^ n
[PROOF STEP]
by      (intro fps_ext) (simp_all add: fps_divide_shift_denom fps_X_power_mult_right_nth)


[STATEMENT]
lemma [simp, code]: "mat_of_cblinfun pauliX = matrix_pauliX"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun pauliX = matrix_pauliX
[PROOF STEP]
apply (auto simp add: pauliX_def matrix_pauliX_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (cblinfun_of_mat (mat_of_rows_list 2 [[0, 1], [1, 0]])) = mat_of_rows_list 2 [[0, 1], [1, 0]]
[PROOF STEP]
apply (subst cblinfun_of_mat_inverse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mat_of_rows_list 2 [[0, 1], [1, 0]] \<in> carrier_mat (length canonical_basis) (length canonical_basis)
 2. mat_of_rows_list 2 [[0, 1], [1, 0]] = mat_of_rows_list 2 [[0, 1], [1, 0]]
[PROOF STEP]
by (auto)


[STATEMENT]
lemma one_eq_numeral_mod_ring_iff [simp]:
  "(1 :: 'a :: nontriv mod_ring) = numeral a \<longleftrightarrow> (1 mod CARD('a)) = (numeral a mod CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 = numeral a) = (1 mod CARD('a) = numeral a mod CARD('a))
[PROOF STEP]
using of_nat_mod_ring_eq_iff[of 1 "numeral a", where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_nat 1 = of_nat (numeral a)) = (1 mod CARD('a) = numeral a mod CARD('a))

goal (1 subgoal):
 1. (1 = numeral a) = (1 mod CARD('a) = numeral a mod CARD('a))
[PROOF STEP]
by (simp del: of_nat_mod_ring_eq_iff)


[STATEMENT]
lemma finite_vimage_real_of_nat_greaterThanAtMost: "finite (real -` {y<..x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (real -` {y<..x})
[PROOF STEP]
proof (rule finite_subset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real -` {y<..x} \<subseteq> ?B
 2. finite ?B
[PROOF STEP]
show "real -` {y<..x} \<subseteq> {nat \<lfloor>y\<rfloor>..nat \<lceil>x\<rceil>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real -` {y<..x} \<subseteq> {nat \<lfloor>y\<rfloor>..nat \<lceil>x\<rceil>}
[PROOF STEP]
by (cases "x \<ge> 0"; cases "y \<ge> 0")
        (auto simp: nat_le_iff le_nat_iff le_ceiling_iff floor_le_iff)
[PROOF STATE]
proof (state)
this:
real -` {y<..x} \<subseteq> {nat \<lfloor>y\<rfloor>..nat \<lceil>x\<rceil>}

goal (1 subgoal):
 1. finite {nat \<lfloor>y\<rfloor>..nat \<lceil>x\<rceil>}
[PROOF STEP]
qed auto


[STATEMENT]
lemma extended_hyperb_ineq_4_points [mono_intros]:
  "Min {extended_Gromov_product_at (e::'a::Gromov_hyperbolic_space) x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z t} - 2 * deltaG(TYPE('a)) \<le> extended_Gromov_product_at e x t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z t} - ereal (2 * deltaG TYPE('a)) \<le> extended_Gromov_product_at e x t
[PROOF STEP]
using extended_hyperb_ineq_4_points'[of e x y z]
[PROOF STATE]
proof (prove)
using this:
Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z ?t} \<le> extended_Gromov_product_at e x ?t + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z t} - ereal (2 * deltaG TYPE('a)) \<le> extended_Gromov_product_at e x t
[PROOF STEP]
unfolding ereal_minus_le_iff
[PROOF STATE]
proof (prove)
using this:
Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z ?t} \<le> extended_Gromov_product_at e x ?t + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. (ereal (2 * deltaG TYPE('a)) = - \<infinity> \<longrightarrow> extended_Gromov_product_at e x t = \<infinity>) \<and> (ereal (2 * deltaG TYPE('a)) = \<infinity> \<longrightarrow> Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z t} = \<infinity> \<longrightarrow> extended_Gromov_product_at e x t = \<infinity>) \<and> (\<bar>ereal (2 * deltaG TYPE('a))\<bar> \<noteq> \<infinity> \<longrightarrow> Min {extended_Gromov_product_at e x y, extended_Gromov_product_at e y z, extended_Gromov_product_at e z t} \<le> extended_Gromov_product_at e x t + ereal (2 * deltaG TYPE('a)))
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma (in PolynRg) polyn_addTr:
 "(pol_coeff S (n, f)) \<and> (pol_coeff S (n, g)) \<longrightarrow>
    (polyn_expr R X n (n, f)) \<plusminus> (polyn_expr R X n (n, g)) =
                 nsum R (\<lambda>j. ((f j) \<plusminus>\<^bsub>S\<^esub> (g j)) \<cdot>\<^sub>r (X^\<^bsup>R j\<^esup>)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n
[PROOF STEP]
apply (cut_tac subring,
        frule subring_Ring[of S])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Subring R S; Ring S\<rbrakk> \<Longrightarrow> pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Subring R S; Ring S\<rbrakk> \<Longrightarrow> pol_coeff S (0, f) \<and> pol_coeff S (0, g) \<longrightarrow> polyn_expr R X 0 (0, f) \<plusminus> polyn_expr R X 0 (0, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) 0
 2. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (rule impI, simp, erule conjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> polyn_expr R X 0 (0, f) \<plusminus> polyn_expr R X 0 (0, g) = (f 0 \<plusminus>\<^bsub>S\<^esub> g 0) \<cdot>\<^sub>r 1\<^sub>r
 2. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (simp add:polyn_expr0)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> f 0 \<plusminus> g 0 = (f 0 \<plusminus>\<^bsub>S\<^esub> g 0) \<cdot>\<^sub>r 1\<^sub>r
 2. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (cut_tac pol_coeff_mem[of "(0, f)" 0], simp,
        cut_tac pol_coeff_mem[of "(0, g)" 0], simp,
       frule  mem_subring_mem_ring[of S "f 0"], assumption+,
       frule  mem_subring_mem_ring[of S "g 0"], assumption+,
       frule Ring.ring_is_ag[of S],
       frule aGroup.ag_pOp_closed[of S "f 0" "g 0"], assumption+,
       frule mem_subring_mem_ring[of S "f 0 \<plusminus>\<^bsub>S\<^esub> g 0"], assumption+)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S; g 0 \<in> carrier S; f 0 \<in> carrier R; g 0 \<in> carrier R; aGroup S; f 0 \<plusminus>\<^bsub>S\<^esub> g 0 \<in> carrier S; f 0 \<plusminus>\<^bsub>S\<^esub> g 0 \<in> carrier R\<rbrakk> \<Longrightarrow> f 0 \<plusminus> g 0 = (f 0 \<plusminus>\<^bsub>S\<^esub> g 0) \<cdot>\<^sub>r 1\<^sub>r
 2. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> pol_coeff S (0, g)
 3. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, g)
 4. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> pol_coeff S (0, f)
 5. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, f)
 6. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (simp add:ring_r_one)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S; g 0 \<in> carrier S; f 0 \<in> carrier R; g 0 \<in> carrier R; aGroup S; f 0 \<plusminus>\<^bsub>S\<^esub> g 0 \<in> carrier S; f 0 \<plusminus>\<^bsub>S\<^esub> g 0 \<in> carrier R\<rbrakk> \<Longrightarrow> f 0 \<plusminus> g 0 = f 0 \<plusminus>\<^bsub>S\<^esub> g 0
 2. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> pol_coeff S (0, g)
 3. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, g)
 4. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> pol_coeff S (0, f)
 5. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, f)
 6. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (simp add:Subring_pOp_ring_pOp[of S "f 0" "g 0"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> pol_coeff S (0, g)
 2. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g); f 0 \<in> carrier S\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, g)
 3. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> pol_coeff S (0, f)
 4. \<lbrakk>Subring R S; Ring S; pol_coeff S (0, f); pol_coeff S (0, g)\<rbrakk> \<Longrightarrow> 0 \<le> fst (0, f)
 5. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc n
[PROOF STEP]
apply (simp del:npow_suc)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n\<rbrakk> \<Longrightarrow> pol_coeff S (Suc n, f) \<and> pol_coeff S (Suc n, g) \<longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (rule impI, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; pol_coeff S (n, f) \<and> pol_coeff S (n, g) \<longrightarrow> polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac n = n in  pol_coeff_pre[of _ f],
        frule_tac n = n in  pol_coeff_pre[of _ g], simp del:npow_suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X (Suc n) (Suc n, f) \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (cut_tac n = n and c = "(Suc n, f)" in polyn_Suc, simp del:npow_suc,
        simp del:npow_suc,
        thin_tac "polyn_expr R X (Suc n) (Suc n, f) =
         polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R (Suc n)\<^esup>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> polyn_expr R X (Suc n) (Suc n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (cut_tac n = n and c = "(Suc n, g)" in polyn_Suc, simp del:npow_suc,
        simp del:npow_suc,
        thin_tac "polyn_expr R X (Suc n) (Suc n, g) =
         polyn_expr R X n (Suc n, g) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R (Suc n)\<^esup>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> (polyn_expr R X n (Suc n, g) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (cut_tac c = "(Suc n, f)" and k = n in polyn_mem, assumption,
                simp del:npow_suc,
        cut_tac k = n and c = "(Suc n, g)" in polyn_mem, assumption,
                simp del:npow_suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (Suc n, f) \<in> carrier R; polyn_expr R X n (Suc n, g) \<in> carrier R\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> (polyn_expr R X n (Suc n, g) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac j = "Suc n" and c = "(Suc n, f)" in pol_coeff_mem_R, simp,
        frule_tac j = "Suc n" and c = "(Suc n, g)" in pol_coeff_mem_R, simp,
        cut_tac  X_mem_R,
        frule_tac n = "Suc n" in npClose[of "X"], simp del:npow_suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (Suc n, f) \<in> carrier R; polyn_expr R X n (Suc n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> (polyn_expr R X n (Suc n, g) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac x = "f (Suc n)" and y = "X^\<^bsup>R (Suc n)\<^esup>" in ring_tOp_closed,
         assumption+,
        frule_tac x = "g (Suc n)" and y = "X^\<^bsup>R (Suc n)\<^esup>" in ring_tOp_closed,
         assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (Suc n, f) \<in> carrier R; polyn_expr R X n (Suc n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> (polyn_expr R X n (Suc n, g) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (cut_tac ring_is_ag,
        subst aGroup.pOp_assocTr43, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (Suc n, f) \<in> carrier R; polyn_expr R X n (Suc n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> (f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> polyn_expr R X n (Suc n, g)) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac x = "f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R (Suc n)\<^esup>" and
        y = "polyn_expr R X n (Suc n, g)" in aGroup.ag_pOp_commute[of R],
        assumption+, simp del:npow_suc,
        thin_tac "f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R (Suc n)\<^esup> \<plusminus> polyn_expr R X n (Suc n, g) =
         polyn_expr R X n (Suc n, g) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R (Suc n)\<^esup>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (Suc n, f) \<in> carrier R; polyn_expr R X n (Suc n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> polyn_expr R X n (Suc n, f) \<plusminus> (polyn_expr R X n (Suc n, g) \<plusminus> f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (subst  aGroup.pOp_assocTr43[THEN sym], assumption+,
        simp del:npow_suc add:polyn_expr_restrict)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (n, f) \<in> carrier R; polyn_expr R X n (n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac c = "(Suc n, f)" and j = "Suc n" in pol_coeff_mem, simp,
        frule_tac c = "(Suc n, g)" and j = "Suc n" in pol_coeff_mem, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (n, f) \<in> carrier R; polyn_expr R X n (n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<plusminus> g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (subst ring_distrib2[THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (n, f) \<in> carrier R; polyn_expr R X n (n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac c = "(Suc n, f)" and j = "Suc n" in  pol_coeff_mem, simp,
       frule_tac c = "(Suc n, g)" and j = "Suc n" in  pol_coeff_mem, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (n, f) \<in> carrier R; polyn_expr R X n (n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply (frule_tac a = "f (Suc n)" and b = "g (Suc n)" in
                      Subring_pOp_ring_pOp[of S], simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Subring R S; Ring S; polyn_expr R X n (n, f) \<plusminus> polyn_expr R X n (n, g) = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n; pol_coeff S (Suc n, f); pol_coeff S (Suc n, g); pol_coeff S (n, f); pol_coeff S (n, g); polyn_expr R X n (n, f) \<in> carrier R; polyn_expr R X n (n, g) \<in> carrier R; f (Suc n) \<in> carrier R; g (Suc n) \<in> carrier R; X \<in> carrier R; X^\<^bsup>R Suc n\<^esup> \<in> carrier R; f (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; g (Suc n) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> \<in> carrier R; aGroup R; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S; snd (Suc n, f) (Suc n) \<in> carrier S; snd (Suc n, g) (Suc n) \<in> carrier S; f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n) = f (Suc n) \<plusminus> g (Suc n)\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup> = \<Sigma>\<^sub>e R (\<lambda>j. (f j \<plusminus>\<^bsub>S\<^esub> g j) \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) n \<plusminus> (f (Suc n) \<plusminus>\<^bsub>S\<^esub> g (Suc n)) \<cdot>\<^sub>r X^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma qty_single_val_process:
shows "val_process Mkt (qty_single asset qty) n w =
    prices Mkt asset n w * qty (Suc n) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
have "val_process Mkt (qty_single asset qty) n w =
    (sum (\<lambda>x. ((prices Mkt) x n w) * ((qty_single asset qty) x (Suc n) w)) {asset})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = (\<Sum>x\<in>{asset}. prices Mkt x n w * qty_single asset qty x (Suc n) w)
[PROOF STEP]
proof (rule subset_val_process')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {asset}
 2. support_set (qty_single asset qty) \<subseteq> {asset}
[PROOF STEP]
show "finite {asset}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {asset}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {asset}

goal (1 subgoal):
 1. support_set (qty_single asset qty) \<subseteq> {asset}
[PROOF STEP]
show "support_set (qty_single asset qty) \<subseteq> {asset}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. support_set (qty_single asset qty) \<subseteq> {asset}
[PROOF STEP]
by (simp add: single_comp_support)
[PROOF STATE]
proof (state)
this:
support_set (qty_single asset qty) \<subseteq> {asset}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
val_process Mkt (qty_single asset qty) n w = (\<Sum>x\<in>{asset}. prices Mkt x n w * qty_single asset qty x (Suc n) w)

goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
val_process Mkt (qty_single asset qty) n w = (\<Sum>x\<in>{asset}. prices Mkt x n w * qty_single asset qty x (Suc n) w)

goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
have "... = prices Mkt asset n w * qty (Suc n) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{asset}. prices Mkt x n w * qty_single asset qty x (Suc n) w) = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
unfolding qty_single_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{asset}. prices Mkt x n w * (qty_empty(asset := qty)) x (Suc n) w) = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{asset}. prices Mkt x n w * qty_single asset qty x (Suc n) w) = prices Mkt asset n w * qty (Suc n) w

goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w

goal (1 subgoal):
 1. val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
val_process Mkt (qty_single asset qty) n w = prices Mkt asset n w * qty (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_right_bound:
  fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder, no_top} \<Rightarrow>
    'b::{linorder_topology, conditionally_complete_linorder}"
  assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b"
    and bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a"
  shows "(f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
proof (cases "{x<..} \<inter> I = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {x<..} \<inter> I = {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
 2. {x<..} \<inter> I \<noteq> {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
{x<..} \<inter> I = {}

goal (2 subgoals):
 1. {x<..} \<inter> I = {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
 2. {x<..} \<inter> I \<noteq> {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x<..} \<inter> I = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x<..} \<inter> I = {}

goal (1 subgoal):
 1. (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)

goal (1 subgoal):
 1. {x<..} \<inter> I \<noteq> {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x<..} \<inter> I \<noteq> {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
{x<..} \<inter> I \<noteq> {}

goal (1 subgoal):
 1. {x<..} \<inter> I \<noteq> {} \<Longrightarrow> (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
assume a: "a < Inf (f ` ({x<..} \<inter> I))"
[PROOF STATE]
proof (state)
this:
a < Inf (f ` ({x<..} \<inter> I))

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
a < Inf (f ` ({x<..} \<inter> I))

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
assume "y \<in> {x<..} \<inter> I"
[PROOF STATE]
proof (state)
this:
y \<in> {x<..} \<inter> I

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
with False bnd
[PROOF STATE]
proof (chain)
picking this:
{x<..} \<inter> I \<noteq> {}
\<lbrakk>?a \<in> I; x < ?a\<rbrakk> \<Longrightarrow> K \<le> f ?a
y \<in> {x<..} \<inter> I
[PROOF STEP]
have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
[PROOF STATE]
proof (prove)
using this:
{x<..} \<inter> I \<noteq> {}
\<lbrakk>?a \<in> I; x < ?a\<rbrakk> \<Longrightarrow> K \<le> f ?a
y \<in> {x<..} \<inter> I

goal (1 subgoal):
 1. Inf (f ` ({x<..} \<inter> I)) \<le> f y
[PROOF STEP]
by (auto intro!: cInf_lower bdd_belowI2)
[PROOF STATE]
proof (state)
this:
Inf (f ` ({x<..} \<inter> I)) \<le> f y

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
with a
[PROOF STATE]
proof (chain)
picking this:
a < Inf (f ` ({x<..} \<inter> I))
Inf (f ` ({x<..} \<inter> I)) \<le> f y
[PROOF STEP]
have "a < f y"
[PROOF STATE]
proof (prove)
using this:
a < Inf (f ` ({x<..} \<inter> I))
Inf (f ` ({x<..} \<inter> I)) \<le> f y

goal (1 subgoal):
 1. a < f y
[PROOF STEP]
by (blast intro: less_le_trans)
[PROOF STATE]
proof (state)
this:
a < f y

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?y2 \<in> {x<..} \<inter> I \<Longrightarrow> a < f ?y2

goal (2 subgoals):
 1. \<And>a. a < Inf (f ` ({x<..} \<inter> I)) \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
 2. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y2 \<in> {x<..} \<inter> I \<Longrightarrow> a < f ?y2
[PROOF STEP]
show "eventually (\<lambda>x. a < f x) (at x within ({x<..} \<inter> I))"
[PROOF STATE]
proof (prove)
using this:
?y2 \<in> {x<..} \<inter> I \<Longrightarrow> a < f ?y2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x
[PROOF STEP]
by (auto simp: eventually_at_filter intro: exI[of _ 1] zero_less_one)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x within {x<..} \<inter> I. a < f x

goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
assume "Inf (f ` ({x<..} \<inter> I)) < a"
[PROOF STATE]
proof (state)
this:
Inf (f ` ({x<..} \<inter> I)) < a

goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
from cInf_lessD[OF _ this] False
[PROOF STATE]
proof (chain)
picking this:
f ` ({x<..} \<inter> I) \<noteq> {} \<Longrightarrow> \<exists>x\<in>f ` ({x<..} \<inter> I). x < a
{x<..} \<inter> I \<noteq> {}
[PROOF STEP]
obtain y where y: "x < y" "y \<in> I" "f y < a"
[PROOF STATE]
proof (prove)
using this:
f ` ({x<..} \<inter> I) \<noteq> {} \<Longrightarrow> \<exists>x\<in>f ` ({x<..} \<inter> I). x < a
{x<..} \<inter> I \<noteq> {}

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>x < y; y \<in> I; f y < a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < y
y \<in> I
f y < a

goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x < y
y \<in> I
f y < a
[PROOF STEP]
have "eventually (\<lambda>x. x \<in> I \<longrightarrow> f x < a) (at_right x)"
[PROOF STATE]
proof (prove)
using this:
x < y
y \<in> I
f y < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_right x. x \<in> I \<longrightarrow> f x < a
[PROOF STEP]
unfolding eventually_at_right[OF \<open>x < y\<close>]
[PROOF STATE]
proof (prove)
using this:
x < y
y \<in> I
f y < a

goal (1 subgoal):
 1. \<exists>b>x. \<forall>y>x. y < b \<longrightarrow> y \<in> I \<longrightarrow> f y < a
[PROOF STEP]
by (metis less_imp_le le_less_trans mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_right x. x \<in> I \<longrightarrow> f x < a

goal (1 subgoal):
 1. \<And>a. Inf (f ` ({x<..} \<inter> I)) < a \<Longrightarrow> \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_right x. x \<in> I \<longrightarrow> f x < a
[PROOF STEP]
show "eventually (\<lambda>x. f x < a) (at x within ({x<..} \<inter> I))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_right x. x \<in> I \<longrightarrow> f x < a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a
[PROOF STEP]
unfolding eventually_at_filter
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F xa in nhds x. xa \<noteq> x \<longrightarrow> xa \<in> {x<..} \<longrightarrow> xa \<in> I \<longrightarrow> f xa < a

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in nhds x. xa \<noteq> x \<longrightarrow> xa \<in> {x<..} \<inter> I \<longrightarrow> f xa < a
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x within {x<..} \<inter> I. f x < a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within {x<..} \<inter> I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ntcf_vcomp_ntcf_const_is_tm_cat_cone'[cat_small_cs_intros]:
  assumes "\<NN> : b <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>"
    and "\<MM> = ntcf_const \<AA> \<BB> f"
    and "f : a \<mapsto>\<^bsub>\<BB>\<^esub> b"
  shows "\<NN> \<bullet>\<^sub>N\<^sub>T\<^sub>C\<^sub>F \<MM> : a <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<NN> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F \<MM> : a <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
using assms(1,3)
[PROOF STATE]
proof (prove)
using this:
\<NN> : b <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>
f : a \<mapsto>\<^bsub>\<BB>\<^esub> b

goal (1 subgoal):
 1. \<NN> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F \<MM> : a <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
unfolding assms(2)
[PROOF STATE]
proof (prove)
using this:
\<NN> : b <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>
f : a \<mapsto>\<^bsub>\<BB>\<^esub> b

goal (1 subgoal):
 1. \<NN> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const \<AA> \<BB> f : a <\<^sub>C\<^sub>F\<^sub>.\<^sub>t\<^sub>m\<^sub>.\<^sub>c\<^sub>o\<^sub>n\<^sub>e \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^sub>.\<^sub>t\<^sub>m\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule ntcf_vcomp_ntcf_const_is_tm_cat_cone)


[STATEMENT]
lemma rbd_rfb_dual: "bd\<^sub>\<R> R = \<partial>\<^sub>F (fb\<^sub>\<R> (R\<inverse>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bd\<^sub>\<R> R = \<partial>\<^sub>F (fb\<^sub>\<R> (\<smile> R))
[PROOF STEP]
by (simp add: rfb_def rbd_def kop_def ffb_def, metis converse_converse map_dual_dual r2f_f2r_galois)


[STATEMENT]
lemma same_uptoD[dest]: assumes "same_upto j A B" "i' < n" "j' < j"
  shows "A $$ (i',j') = B $$ (i',j')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i', j') = B $$ (i', j')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
same_upto j A B
i' < n
j' < j

goal (1 subgoal):
 1. A $$ (i', j') = B $$ (i', j')
[PROOF STEP]
unfolding same_upto_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i' j'. i' < n \<longrightarrow> j' < j \<longrightarrow> A $$ (i', j') = B $$ (i', j')
i' < n
j' < j

goal (1 subgoal):
 1. A $$ (i', j') = B $$ (i', j')
[PROOF STEP]
by blast


[STATEMENT]
lemma div_cancel_aux: "c dvd a \<Longrightarrow> (d + a * b) div c = (d div c) + a div c * b" for a b c :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c dvd a \<Longrightarrow> (d + a * b) div c = d div c + a div c * b
[PROOF STEP]
by (metis div_plus_div_distrib_dvd_right dvd_div_mult dvd_trans dvd_triv_left)


[STATEMENT]
lemma omega_coinduct_eq_var1: "y = 1 + x \<cdot> y \<Longrightarrow> y \<le> x\<^sup>\<omega> + x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = (1::'a) + x \<cdot> y \<Longrightarrow> y \<le> x\<^sup>\<omega> + x\<^sup>\<star>
[PROOF STEP]
by (simp add: omega_coinduct_var1)


[STATEMENT]
lemma set_map_filter: "set (List.map_filter P xs) = the ` (P ` set xs - {None})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (List.map_filter P xs) = the ` (P ` set xs - {None})
[PROOF STEP]
by(auto simp add: List.map_filter_def intro: rev_image_eqI)


[STATEMENT]
lemma eint_add_left_cancel: "a + b = a + c \<longleftrightarrow> a = (\<infinity>::eint) \<or> b = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b = a + c) = (a = \<infinity> \<or> b = c)
[PROOF STEP]
unfolding plus_eint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((case a of eint m \<Rightarrow> case b of eint n \<Rightarrow> eint (m + n) | \<infinity> \<Rightarrow> \<infinity> | \<infinity> \<Rightarrow> \<infinity>) = (case a of eint m \<Rightarrow> case c of eint n \<Rightarrow> eint (m + n) | \<infinity> \<Rightarrow> \<infinity> | \<infinity> \<Rightarrow> \<infinity>)) = (a = \<infinity> \<or> b = c)
[PROOF STEP]
by (simp split: eint.split)


[STATEMENT]
lemma sets_eq_impl_correct_aux2:
    assumes A: "(pn', pn) \<in> pnet_rel"
    assumes WF: "rev_well_formed_pn pn"

    assumes F: "finite (((Graph.E (pn_c (pnet_\<alpha> pn')))\<inverse>)\<^sup>* `` {s})"
    shows "sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s))
      \<longleftrightarrow> pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
(pn', pn) \<in> pnet_rel
[PROOF STEP]
have S1i: "(pn_V' pn', pn_V pn) \<in> br ahs.\<alpha> ahs.invar"
[PROOF STATE]
proof (prove)
using this:
(pn', pn) \<in> pnet_rel

goal (1 subgoal):
 1. (pn_V' pn', pn_V pn) \<in> br ahs.\<alpha> ahs.invar
[PROOF STEP]
unfolding pnet_rel_def br_def pnet_\<alpha>_def
[PROOF STATE]
proof (prove)
using this:
(pn', pn) \<in> {(c, a). a = \<lparr>pn_c = (the_default 0 \<circ>\<circ>\<circ> map_op_\<alpha>) ahm_ops (pn_c' c), pn_V = ahs.\<alpha> (pn_V' c), pn_succ = (the_default [] \<circ>\<circ>\<circ> map_op_\<alpha>) ahm_ops (pn_succ' c), pn_pred = (the_default [] \<circ>\<circ>\<circ> map_op_\<alpha>) ahm_ops (pn_pred' c), pn_adjmap = (the_default [] \<circ>\<circ>\<circ> map_op_\<alpha>) ahm_ops (pn_adjmap' c), pn_s_node = pn_s_node' c, pn_t_node = pn_t_node' c\<rparr> \<and> True}

goal (1 subgoal):
 1. (pn_V' pn', pn_V pn) \<in> {(c, a). a = ahs.\<alpha> c \<and> ahs.invar c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(pn_V' pn', pn_V pn) \<in> br ahs.\<alpha> ahs.invar

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
note GI = rev_graph_of_impl_correct[OF WF A]
[PROOF STATE]
proof (state)
this:
(rev_graph_of_impl pn' ?s, rev_graph_of pn ?s) \<in> \<langle>unit_rel, nat_rel\<rangle>g_impl_rel_ext

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
have G: "graph (rev_graph_of pn s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph (rev_graph_of pn s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
graph (rev_graph_of pn s)

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
have F': "finite ((g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
using F A
[PROOF STATE]
proof (prove)
using this:
finite (((Graph.E (pn_c (pnet_\<alpha> pn')))\<inverse>)\<^sup>* `` {s})
(pn', pn) \<in> pnet_rel

goal (1 subgoal):
 1. finite ((g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
by (simp add: rev_graph_of_def pnet_\<alpha>_def pnet_rel_def br_def)
[PROOF STATE]
proof (state)
this:
finite ((g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
note S2i = reachable_impl.refine[simplified, OF F' G GI]
[PROOF STATE]
proof (state)
this:
(reachable_impl (rev_graph_of_impl pn' s), (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s)) \<in> \<langle>nat_rel\<rangle>ahs_rel bounded_hashcode_nat

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
from sets_eq_impl.refine[simplified, OF S1i S2i]
[PROOF STATE]
proof (chain)
picking this:
sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))

goal (1 subgoal):
 1. sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sets_eq_impl (pn_V' pn') (reachable_impl (rev_graph_of_impl pn' s)) = (pn_V pn = (g_E (rev_graph_of pn s))\<^sup>* `` g_V0 (rev_graph_of pn s))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l5_6:
  assumes "A B Le C D" and
    "Cong A B A' B'" and
    "Cong C D C' D'"
  shows "A' B' Le C' D'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A' B' Le C' D'
[PROOF STEP]
by (meson Cong3_def Le_def assms(1) assms(2) assms(3) cong_inner_transitivity l4_5)


[STATEMENT]
lemma not_is_poincare_line_unit_circle [simp]:
  shows "\<not> is_poincare_line unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_poincare_line unit_circle
[PROOF STEP]
by (transfer, transfer, simp)


[STATEMENT]
lemma (in monoid_mult) power_ac: "a * (a^n * x) = a^n * (a * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a ^ n * x) = a ^ n * (a * x)
[PROOF STEP]
by (metis power_Suc2 power_Suc mult.assoc)


[STATEMENT]
lemma less_le_not_le_classes1:
  "c < d \<longleftrightarrow> c \<le> d \<and> \<not> d \<le> c"
  for c d :: classes1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c < d) = (c \<le> d \<and> \<not> d \<le> c)
[PROOF STEP]
unfolding less_classes1_def less_eq_classes1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subclass1 c d = (subclass1\<^sup>=\<^sup>= c d \<and> \<not> subclass1\<^sup>=\<^sup>= d c)
[PROOF STEP]
using subclass1.simps
[PROOF STATE]
proof (prove)
using this:
subclass1 ?a1.0 ?a2.0 = ((\<exists>c. ?a1.0 = c \<and> ?a2.0 = Object \<and> c \<noteq> Object) \<or> ?a1.0 = Employee \<and> ?a2.0 = Person \<or> ?a1.0 = Customer \<and> ?a2.0 = Person)

goal (1 subgoal):
 1. subclass1 c d = (subclass1\<^sup>=\<^sup>= c d \<and> \<not> subclass1\<^sup>=\<^sup>= d c)
[PROOF STEP]
by auto


[STATEMENT]
lemma det: assumes m: "m = n" shows "det FF = det Fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat_of_rows n fs) = det (mat_of_rows n (map gso [0..<length fs]))
[PROOF STEP]
unfolding matrix_equality
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (M (length fs) * mat_of_rows n (map gso [0..<length fs])) = det (mat_of_rows n (map gso [0..<length fs]))
[PROOF STEP]
apply (subst det_mult[OF M_dim(3)], (insert Fs_dim(3) m, auto)[1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (M (length fs)) * det (mat_of_rows n (map gso [0..<length fs])) = det (mat_of_rows n (map gso [0..<length fs]))
[PROOF STEP]
apply (subst det_lower_triangular[OF _ M_dim(3)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < j; j < length fs\<rbrakk> \<Longrightarrow> M (length fs) $$ (i, j) = (0::'a)
 2. prod_list (diag_mat (M (length fs))) * det (mat_of_rows n (map gso [0..<length fs])) = det (mat_of_rows n (map gso [0..<length fs]))
[PROOF STEP]
by (subst M_index, (auto simp: \<mu>.simps)[3], unfold prod_list_diag_prod, auto simp: \<mu>.simps)


[STATEMENT]
lemma fls_lr_inverse_X_inv_power':
  fixes x :: "'a::ring_1"
  and   y :: "'b::{semiring_1,uminus}"
  shows "fls_left_inverse (fls_X_inv ^ n) x = fls_const x * fls_X ^ n"
  and   "fls_right_inverse (fls_X_inv ^ n) y = fls_const y * fls_X ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_left_inverse (fls_X_inv ^ n) x = fls_const x * fls_X ^ n &&& fls_right_inverse (fls_X_inv ^ n) y = fls_const y * fls_X ^ n
[PROOF STEP]
using fls_lr_inverse_X_inv_power(1)[of n x] fls_lr_inverse_X_inv_power(2)[of n y]
[PROOF STATE]
proof (prove)
using this:
fls_left_inverse (fls_X_inv ^ n) x = fls_shift (- int n) (fls_const x)
fls_right_inverse (fls_X_inv ^ n) y = fls_shift (- int n) (fls_const y)

goal (1 subgoal):
 1. fls_left_inverse (fls_X_inv ^ n) x = fls_const x * fls_X ^ n &&& fls_right_inverse (fls_X_inv ^ n) y = fls_const y * fls_X ^ n
[PROOF STEP]
by    (simp_all add: fls_X_power_times_conv_shift(2))


[STATEMENT]
lemma defined_inputs_set : "defined_inputs M q = {x \<in> inputs M . h M (q,x) \<noteq> {} }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. defined_inputs M q = {x \<in> FSM.inputs M. FSM.h M (q, x) \<noteq> {}}
[PROOF STEP]
by auto


[STATEMENT]
lemma gcd_code [code]:
  "gcd a b = int_of_integer (gcd_integer (of_int a) (of_int b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b = int_of_integer (gcd_integer (of_int a) (of_int b))
[PROOF STEP]
by (metis gcd_integer.abs_eq int_of_integer_integer_of_int integer_of_int_eq_of_int)


[STATEMENT]
lemma "(\<forall>x. P x \<and> Q x) = ((\<forall>x. P x) \<and> (\<forall>x. Q x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P x \<and> Q x) = ((\<forall>x. P x) \<and> (\<forall>x. Q x))
[PROOF STEP]
by blast


[STATEMENT]
lemma tendsto_mult_right_iff [simp]:
   "c \<noteq> 0 \<Longrightarrow> tendsto(\<lambda>x. f x * c) (l * c) F \<longleftrightarrow> tendsto f l F" for c :: "'a::{topological_semigroup_mult,field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> ((\<lambda>x. f x * c) \<longlongrightarrow> l * c) F = (f \<longlongrightarrow> l) F
[PROOF STEP]
by (auto simp: tendsto_mult_right dest: tendsto_mult_left [where c = "1/c"])


[STATEMENT]
lemma sup_union_right1 [simp]: "\<not> x \<in># N \<Longrightarrow> N \<union># (add_mset x M) = add_mset x (N \<union># M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin># N \<Longrightarrow> N \<union># add_mset x M = add_mset x (N \<union># M)
[PROOF STEP]
by (simp add: multiset_eq_iff not_in_iff)


[STATEMENT]
lemma "w\<^sup>2 + x\<^sup>2 + y\<^sup>2 + z\<^sup>2 = 1 \<longrightarrow> (w + x + y + z)\<^sup>2 \<le> (4::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w\<^sup>2 + x\<^sup>2 + y\<^sup>2 + z\<^sup>2 = 1 \<longrightarrow> (w + x + y + z)\<^sup>2 \<le> 4
[PROOF STEP]
by (sos "(((A<0 * R<1) + (([~4] * A=0) + (R<1 * ((R<3 * [~1/3*w + ~1/3*x + ~1/3*y + z]^2) + ((R<8/3 * [~1/2*w + ~1/2*x + y]^2) + (R<2 * [~1*w + x]^2)))))))")


[STATEMENT]
lemma sscan_sdrop[simp]: "sdrop k (sscan f xs a) = sscan f (sdrop k xs) (fold f (stake k xs) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sdrop k (sscan f xs a) = sscan f (sdrop k xs) (fold f (stake k xs) a)
[PROOF STEP]
by (induct k arbitrary: a xs) (auto)


[STATEMENT]
lemma completely_multiplicative_function_divide:
  fixes f :: "nat \<Rightarrow> 'a :: field"
  assumes "completely_multiplicative_function f"  "completely_multiplicative_function g"
  shows   "completely_multiplicative_function (\<lambda>n. f n / g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
have "completely_multiplicative_function (\<lambda>n. f n * inverse (g n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n * inverse (g n))
[PROOF STEP]
by (intro completely_multiplicative_function_mult
              completely_multiplicative_function_inverse assms)
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. f n * inverse (g n))

goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. f n * inverse (g n))

goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
have "(\<lambda>n. f n * inverse (g n)) = (\<lambda>n. f n / g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f n * inverse (g n)) = (\<lambda>n. f n / g n)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f n * inverse (g n)) = (\<lambda>n. f n / g n)

goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
completely_multiplicative_function (\<lambda>n. f n / g n)

goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. f n / g n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (\<lambda>n. f n / g n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_components_of_discrete_topology [simp]:
   "path_components_of (discrete_topology U) = (\<lambda>x. {x}) ` U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_components_of (discrete_topology U) = (\<lambda>x. {x}) ` U
[PROOF STEP]
by (auto simp: path_components_of_def image_def fun_eq_iff)


[STATEMENT]
lemma polynomial_function_inner [intro]:
  fixes i :: "'a::euclidean_space"
  shows "polynomial_function g \<Longrightarrow> polynomial_function (\<lambda>x. g x \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial_function g \<Longrightarrow> polynomial_function (\<lambda>x. g x \<bullet> i)
[PROOF STEP]
apply (subst euclidean_representation [where x=i, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial_function g \<Longrightarrow> polynomial_function (\<lambda>x. g x \<bullet> (\<Sum>b\<in>Basis. (i \<bullet> b) *\<^sub>R b))
[PROOF STEP]
apply (force simp: inner_sum_right polynomial_function_iff_Basis_inner polynomial_function_sum)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lm041:
  "({X} \<in> partitionsUniverse) = (X \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({X} \<in> partitionsUniverse) = (X \<noteq> {})
[PROOF STEP]
using is_non_overlapping_def
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping ?P = (\<forall>X\<in>?P. \<forall>Y\<in>?P. (X \<inter> Y \<noteq> {}) = (X = Y))

goal (1 subgoal):
 1. ({X} \<in> partitionsUniverse) = (X \<noteq> {})
[PROOF STEP]
by fastforce


[STATEMENT]
theorem Balog_Szemeredi_Gowers: fixes A::"'a set" and c::real
  assumes afin: "finite A" and "A \<noteq> {}" and "c>0" and "additive_energy A = 2 * c" and ass: "A \<subseteq> G"
  obtains A' where "A' \<subseteq> A" and "card A' \<ge> c^2 * card A / 4" and
    "card (differenceset A' A') \<le>  2^30 * card A / c^34"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain B and A' where bss: "B \<subseteq> A" and bne: "B \<noteq> {}" and bge: "card B \<ge> (c^4) * (card A)/16"
    and a2ss: "A' \<subseteq> A"  and a2ge: "card A' \<ge> (c^2) * (card (A))/4"
    and hcardle: "card (differenceset A' B) \<le> 2^13 * card A / c^15"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B A'. \<lbrakk>B \<subseteq> A; B \<noteq> {}; c ^ 4 * real (card A) / 16 \<le> real (card B); A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' B)) \<le> real (2 ^ 13 * card A) / c ^ 15\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms obtains_subsets_differenceset_card_bound
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
0 < c
additive_energy A = 2 * c
A \<subseteq> G
\<lbrakk>finite ?A; 0 < ?c; ?A \<noteq> {}; ?A \<subseteq> G; additive_energy ?A = 2 * ?c; \<And>B A'. \<lbrakk>B \<subseteq> ?A; B \<noteq> {}; ?c ^ 4 * real (card ?A) / 16 \<le> real (card B); A' \<subseteq> ?A; A' \<noteq> {}; ?c\<^sup>2 * real (card ?A) / 4 \<le> real (card A'); real (card (differenceset A' B)) \<le> real (2 ^ 13 * card ?A) / ?c ^ 15\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>B A'. \<lbrakk>B \<subseteq> A; B \<noteq> {}; c ^ 4 * real (card A) / 16 \<le> real (card B); A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' B)) \<le> real (2 ^ 13 * card A) / c ^ 15\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
B \<noteq> {}
c ^ 4 * real (card A) / 16 \<le> real (card B)
A' \<subseteq> A
c\<^sup>2 * real (card A) / 4 \<le> real (card A')
real (card (differenceset A' B)) \<le> real (2 ^ 13 * card A) / c ^ 15

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have Bg0: "(card B :: real) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real (card B)
[PROOF STEP]
using bne afin bss infinite_super
[PROOF STATE]
proof (prove)
using this:
B \<noteq> {}
finite A
B \<subseteq> A
\<lbrakk>?S \<subseteq> ?T; infinite ?S\<rbrakk> \<Longrightarrow> infinite ?T

goal (1 subgoal):
 1. 0 < real (card B)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < real (card B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(card  B) * card (differenceset A' A') \<le>
    card (differenceset A' B) * card (differenceset A' B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)
[PROOF STEP]
using afin a2ss bss infinite_super ass Ruzsa_triangle_ineq1 card_minusset' differenceset_commute
      sumset_subset_carrier subset_trans sumset_commute
[PROOF STATE]
proof (prove)
using this:
finite A
A' \<subseteq> A
B \<subseteq> A
\<lbrakk>?S \<subseteq> ?T; infinite ?S\<rbrakk> \<Longrightarrow> infinite ?T
A \<subseteq> G
\<lbrakk>finite ?U; ?U \<subseteq> G; finite ?V; ?V \<subseteq> G; finite ?W; ?W \<subseteq> G\<rbrakk> \<Longrightarrow> card ?U * card (differenceset ?V ?W) \<le> card (differenceset ?U ?V) * card (differenceset ?U ?W)
?A \<subseteq> G \<Longrightarrow> card (minusset ?A) = card ?A
minusset (differenceset ?B ?A) = differenceset ?A ?B
sumset ?A ?B \<subseteq> G
\<lbrakk>?A \<subseteq> ?B; ?B \<subseteq> ?C\<rbrakk> \<Longrightarrow> ?A \<subseteq> ?C
sumset ?A ?B = sumset ?B ?A

goal (1 subgoal):
 1. card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)
[PROOF STEP]
by (smt (verit, best))
[PROOF STATE]
proof (state)
this:
card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)
[PROOF STEP]
have "card B * card (differenceset A' A') \<le> (card (differenceset A' B))^2"
[PROOF STATE]
proof (prove)
using this:
card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)

goal (1 subgoal):
 1. card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2
[PROOF STEP]
using bss bss power2_eq_square
[PROOF STATE]
proof (prove)
using this:
card B * card (differenceset A' A') \<le> card (differenceset A' B) * card (differenceset A' B)
B \<subseteq> A
B \<subseteq> A
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2
[PROOF STEP]
have "(card (differenceset A' A')) \<le> (card (differenceset A' B))^2/card B"
[PROOF STATE]
proof (prove)
using this:
card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)
[PROOF STEP]
using Bg0 nonzero_mult_div_cancel_left[of "card B" "card(differenceset A' A')"]
      divide_right_mono
[PROOF STATE]
proof (prove)
using this:
card B * card (differenceset A' A') \<le> (card (differenceset A' B))\<^sup>2
0 < real (card B)
card B \<noteq> 0 \<Longrightarrow> card B * card (differenceset A' A') div card B = card (differenceset A' A')
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a / ?c \<le> ?b / ?c

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)
[PROOF STEP]
by (smt (verit) of_nat_0 of_nat_mono real_of_nat_div4)
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(card (differenceset A' B))^2  \<le> ((2^13) * (1/c^15)*(card A))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2
[PROOF STEP]
using hcardle
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' B)) \<le> real (2 ^ 13 * card A) / c ^ 15

goal (1 subgoal):
 1. real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)
real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2
[PROOF STEP]
have "(card (differenceset A' A')) \<le> ((2^13) * (1/c^15)*(card A))^2/(card B)"
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)
real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)
[PROOF STEP]
using pos_le_divide_eq[OF Bg0]
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> real ((card (differenceset A' B))\<^sup>2) / real (card B)
real ((card (differenceset A' B))\<^sup>2) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2
(?a \<le> ?b / real (card B)) = (?a * real (card B) \<le> ?b)

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(c^4) * (card A)/16 >0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c ^ 4 * real (card A) / 16
[PROOF STEP]
using assms card_0_eq
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
0 < c
additive_energy A = 2 * c
A \<subseteq> G
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})

goal (1 subgoal):
 1. 0 < c ^ 4 * real (card A) / 16
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < c ^ 4 * real (card A) / 16

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < c ^ 4 * real (card A) / 16

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "((2^13) * (1/c^15) * (card A))^2/(card B) =
    ((2^13)* (1/c^15)*(card A))^2 * (1/(card B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "((2^13)* (1/c^15) * (card A))^2 * (1/(card B)) \<le>
    ((2^13) * (1/c^15) * (card A))^2/ ((c^4) * (card A)/16)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B)) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
[PROOF STEP]
using bge calculation(2, 3) frac_le less_eq_real_def zero_le_power2
[PROOF STATE]
proof (prove)
using this:
c ^ 4 * real (card A) / 16 \<le> real (card B)
0 < c ^ 4 * real (card A) / 16
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))
\<lbrakk>(0::?'a) \<le> ?y; ?x \<le> ?y; (0::?'a) < ?w; ?w \<le> ?z\<rbrakk> \<Longrightarrow> ?x / ?z \<le> ?y / ?w
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
(0::?'a) \<le> ?a\<^sup>2

goal (1 subgoal):
 1. (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B)) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B)) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)
0 < c ^ 4 * real (card A) / 16
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B)) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
[PROOF STEP]
have "(card (differenceset A' A')) \<le> ((2^13) * (1/c^15) * (card A))^2/ ((c^4) * (card A)/16)"
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B)
0 < c ^ 4 * real (card A) / 16
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / real (card B) = (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B))
(2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 * (1 / real (card B)) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
[PROOF STEP]
have "(card (differenceset A' A')) \<le> (2^30) * (card A)/(c^34)"
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34
[PROOF STEP]
using card_0_eq assms
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> (2 ^ 13 * (1 / c ^ 15) * real (card A))\<^sup>2 / (c ^ 4 * real (card A) / 16)
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})
finite A
A \<noteq> {}
0 < c
additive_energy A = 2 * c
A \<subseteq> G

goal (1 subgoal):
 1. real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card A'); real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using a2ss a2ge that
[PROOF STATE]
proof (prove)
using this:
real (card (differenceset A' A')) \<le> real (2 ^ 30 * card A) / c ^ 34
A' \<subseteq> A
c\<^sup>2 * real (card A) / 4 \<le> real (card A')
\<lbrakk>?A' \<subseteq> A; c\<^sup>2 * real (card A) / 4 \<le> real (card ?A'); real (card (differenceset ?A' ?A')) \<le> real (2 ^ 30 * card A) / c ^ 34\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nil_in_lists: "[] \<in> lists A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<in> lists A
[PROOF STEP]
unfolding lists_def2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<in> {l. set l \<subseteq> A}
[PROOF STEP]
by auto


[STATEMENT]
lemma GroupIso : "GroupIso M T N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GroupIso M T N
[PROOF STEP]
proof (rule GroupIso.intro)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. GroupHom M T
 2. GroupIso_axioms M T N
[PROOF STEP]
show "GroupHom M T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GroupHom M T
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
GroupHom M T

goal (1 subgoal):
 1. GroupIso_axioms M T N
[PROOF STEP]
from bijective
[PROOF STATE]
proof (chain)
picking this:
bij_betw T M N
[PROOF STEP]
show "GroupIso_axioms M T N"
[PROOF STATE]
proof (prove)
using this:
bij_betw T M N

goal (1 subgoal):
 1. GroupIso_axioms M T N
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
this:
GroupIso_axioms M T N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem continuity_set_conv_imp_weak_conv:
  fixes f :: "real \<Rightarrow> real"
  assumes *: "\<And>A. A \<in> sets borel \<Longrightarrow> M (frontier A) = 0 \<Longrightarrow> (\<lambda> n. (measure (M_seq n) A)) \<longlonglongrightarrow> measure M A"
  shows "weak_conv_m M_seq M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_conv_m M_seq M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_conv_m M_seq M
[PROOF STEP]
interpret real_distribution M
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_distribution M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_conv_m M_seq M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_conv_m M_seq M
[PROOF STEP]
by (auto intro!: * simp: frontier_real_atMost isCont_cdf emeasure_eq_measure weak_conv_m_def weak_conv_def cdf_def2)
[PROOF STATE]
proof (state)
this:
weak_conv_m M_seq M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_take_columns[simp]:
  "Rep_matrix (take_columns A c) j i =
  (if i < c then (Rep_matrix A j i) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (take_columns A c) j i = (if i < c then Rep_matrix A j i else (0::'a))
[PROOF STEP]
apply (simp add: take_columns_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < c \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if i < c then Rep_matrix A j i else (0::'a))) j i = Rep_matrix A j i) \<and> (\<not> i < c \<longrightarrow> Rep_matrix (Abs_matrix (\<lambda>j i. if i < c then Rep_matrix A j i else (0::'a))) j i = (0::'a))
[PROOF STEP]
apply (simplesubst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> (if i < c then Rep_matrix A j i else (0::'a)) = (0::'a)
 2. \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> (if i < c then Rep_matrix A j i else (0::'a)) = (0::'a)
 3. (i < c \<longrightarrow> (if i < c then Rep_matrix A j i else (0::'a)) = Rep_matrix A j i) \<and> (\<not> i < c \<longrightarrow> (if i < c then Rep_matrix A j i else (0::'a)) = (0::'a))
[PROOF STEP]
apply (rule exI[of _ "nrows A"], auto, simp add: nrows_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. \<forall>j i. i < c \<longrightarrow> n \<le> i \<longrightarrow> Rep_matrix A j i = (0::'a)
[PROOF STEP]
apply (rule exI[of _ "ncols A"], auto, simp add: ncols_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mult_comp_basic_support_set:
  assumes "stock_portfolio Mkt pf1"
shows "stock_portfolio Mkt (qty_mult_comp pf1 qty)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stock_portfolio Mkt (qty_mult_comp pf1 qty)
[PROOF STEP]
using assms mult_comp_support_set[of pf1]
[PROOF STATE]
proof (prove)
using this:
stock_portfolio Mkt pf1
support_set (qty_mult_comp pf1 ?qty) \<subseteq> support_set pf1

goal (1 subgoal):
 1. stock_portfolio Mkt (qty_mult_comp pf1 qty)
[PROOF STEP]
unfolding stock_portfolio_def
[PROOF STATE]
proof (prove)
using this:
portfolio pf1 \<and> support_set pf1 \<subseteq> stocks Mkt
support_set (qty_mult_comp pf1 ?qty) \<subseteq> support_set pf1

goal (1 subgoal):
 1. portfolio (qty_mult_comp pf1 qty) \<and> support_set (qty_mult_comp pf1 qty) \<subseteq> stocks Mkt
[PROOF STEP]
using mult_comp_portfolio
[PROOF STATE]
proof (prove)
using this:
portfolio pf1 \<and> support_set pf1 \<subseteq> stocks Mkt
support_set (qty_mult_comp pf1 ?qty) \<subseteq> support_set pf1
portfolio ?pf1.0 \<Longrightarrow> portfolio (qty_mult_comp ?pf1.0 ?qty)

goal (1 subgoal):
 1. portfolio (qty_mult_comp pf1 qty) \<and> support_set (qty_mult_comp pf1 qty) \<subseteq> stocks Mkt
[PROOF STEP]
by blast


[STATEMENT]
lemma iT_Mult_mono: "A \<subseteq> B \<Longrightarrow> A \<otimes> k \<subseteq> B \<otimes> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> A \<otimes> k \<subseteq> B \<otimes> k
[PROOF STEP]
by (simp add: iT_Mult_def image_mono)


[STATEMENT]
lemma cfs_monom:
  "a \<in> carrier R ==> (monom P a m) n = (if m=n then a else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> carrier R \<Longrightarrow> monom P a m n = (if m = n then a else \<zero>)
[PROOF STEP]
using coeff_simp  P_def coeff_monom monom_closed
[PROOF STATE]
proof (prove)
using this:
?f \<in> carrier P \<Longrightarrow> coeff (UP R) ?f = ?f
P \<equiv> UP R
?a \<in> carrier R \<Longrightarrow> coeff P (monom P ?a ?m) ?n = (if ?m = ?n then ?a else \<zero>)
?a \<in> carrier R \<Longrightarrow> monom P ?a ?n \<in> carrier P

goal (1 subgoal):
 1. a \<in> carrier R \<Longrightarrow> monom P a m n = (if m = n then a else \<zero>)
[PROOF STEP]
by auto


[STATEMENT]
lemma \<beta>_inner:
  "inner_prod \<beta> \<beta> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod \<beta> \<beta> = 1
[PROOF STEP]
apply (simp add: scalar_prod_def \<beta>_eval)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<N. complex_of_real (if f i then 1 / sqrt (real M) else 0) * complex_of_real (if f i then 1 / sqrt (real M) else 0)) = 1
[PROOF STEP]
apply (subst sum.mono_neutral_cong_right[of "{0..<N}" "{i. i < N \<and> f i}"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. finite {0..<N}
 2. {i. i < N \<and> f i} \<subseteq> {0..<N}
 3. \<forall>i\<in>{0..<N} - {i. i < N \<and> f i}. complex_of_real (if f i then 1 / sqrt (real M) else 0) * complex_of_real (if f i then 1 / sqrt (real M) else 0) = 0
 4. \<And>x. x \<in> {i. i < N \<and> f i} \<Longrightarrow> complex_of_real (if f x then 1 / sqrt (real M) else 0) * complex_of_real (if f x then 1 / sqrt (real M) else 0) = ?h6 x
 5. sum ?h6 {i. i < N \<and> f i} = 1
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (card {i. i < N \<and> f i}) = complex_of_real (sqrt (real M)) * complex_of_real (sqrt (real M))
[PROOF STEP]
apply (fold M_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat M = complex_of_real (sqrt (real M)) * complex_of_real (sqrt (real M))
[PROOF STEP]
by (metis of_nat_0_le_iff of_real_of_nat_eq of_real_power power2_eq_square real_sqrt_pow2)


[STATEMENT]
lemma conga__acute:
  assumes "A B C CongA A C B"
  shows "Acute A B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Acute A B C
[PROOF STEP]
by (metis acute_sym angle_partition assms conga_distinct conga_obtuse__obtuse l11_17 l11_43)