[STATEMENT]
lemma (in ring) telescopic_base:
  assumes "subfield K R" "subfield F R"
    and "dimension n K F" and "dimension m F E"
  shows "dimension (n * m) K E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dimension (n * m) K E
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
dimension m F E

goal (1 subgoal):
 1. dimension (n * m) K E
[PROOF STEP]
proof (induct m arbitrary: E)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>E. dimension 0 F E \<Longrightarrow> dimension (n * 0) K E
 2. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
dimension 0 F E

goal (2 subgoals):
 1. \<And>E. dimension 0 F E \<Longrightarrow> dimension (n * 0) K E
 2. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
dimension 0 F E

goal (1 subgoal):
 1. dimension (n * 0) K E
[PROOF STEP]
using dimension_zero[OF assms(2)] zero_dim
[PROOF STATE]
proof (prove)
using this:
dimension 0 F E
dimension 0 F ?E \<Longrightarrow> ?E = {\<zero>}
dimension 0 ?K {\<zero>}

goal (1 subgoal):
 1. dimension (n * 0) K E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dimension (n * 0) K E

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
dimension m F ?E \<Longrightarrow> dimension (n * m) K ?E
dimension (Suc m) F E

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
obtain Vs
    where Vs: "set Vs \<subseteq> carrier R" "length Vs = Suc m" "independent F Vs" "Span F Vs = E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Vs. \<lbrakk>set Vs \<subseteq> carrier R; length Vs = Suc m; local.independent F Vs; Span F Vs = E\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_base[OF assms(2) Suc(2)]
[PROOF STATE]
proof (prove)
using this:
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent F Vs \<and> length Vs = Suc m \<and> Span F Vs = E

goal (1 subgoal):
 1. (\<And>Vs. \<lbrakk>set Vs \<subseteq> carrier R; length Vs = Suc m; local.independent F Vs; Span F Vs = E\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set Vs \<subseteq> carrier R
length Vs = Suc m
local.independent F Vs
Span F Vs = E

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set Vs \<subseteq> carrier R
length Vs = Suc m
local.independent F Vs
Span F Vs = E
[PROOF STEP]
obtain v Vs' where v: "Vs = v # Vs'"
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier R
length Vs = Suc m
local.independent F Vs
Span F Vs = E

goal (1 subgoal):
 1. (\<And>v Vs'. Vs = v # Vs' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson length_Suc_conv)
[PROOF STATE]
proof (state)
this:
Vs = v # Vs'

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
hence li: "independent F [ v ]" "independent F Vs'" and inter: "Span F [ v ] \<inter> Span F Vs' = { \<zero> }"
[PROOF STATE]
proof (prove)
using this:
Vs = v # Vs'

goal (1 subgoal):
 1. (local.independent F [v] &&& local.independent F Vs') &&& Span F [v] \<inter> Span F Vs' = {\<zero>}
[PROOF STEP]
using Vs(3) independent_split[OF assms(2), of "[ v ]" Vs']
[PROOF STATE]
proof (prove)
using this:
Vs = v # Vs'
local.independent F Vs
local.independent F ([v] @ Vs') \<Longrightarrow> local.independent F Vs'
local.independent F ([v] @ Vs') \<Longrightarrow> local.independent F [v]
local.independent F ([v] @ Vs') \<Longrightarrow> Span F [v] \<inter> Span F Vs' = {\<zero>}

goal (1 subgoal):
 1. (local.independent F [v] &&& local.independent F Vs') &&& Span F [v] \<inter> Span F Vs' = {\<zero>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.independent F [v]
local.independent F Vs'
Span F [v] \<inter> Span F Vs' = {\<zero>}

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
have "dimension n K (Span F [ v ])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dimension n K (Span F [v])
[PROOF STEP]
using dimension_independent[OF li(1)] telescopic_base_aux[OF assms(1-3)]
[PROOF STATE]
proof (prove)
using this:
dimension (length [v]) F (Span F [v])
dimension 1 F ?E \<Longrightarrow> dimension n K ?E

goal (1 subgoal):
 1. dimension n K (Span F [v])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dimension n K (Span F [v])

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dimension n K (Span F [v])

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
have "dimension (n * m) K (Span F Vs')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dimension (n * m) K (Span F Vs')
[PROOF STEP]
using Suc(1) dimension_independent[OF li(2)] Vs(2)
[PROOF STATE]
proof (prove)
using this:
dimension m F ?E \<Longrightarrow> dimension (n * m) K ?E
dimension (length Vs') F (Span F Vs')
length Vs = Suc m

goal (1 subgoal):
 1. dimension (n * m) K (Span F Vs')
[PROOF STEP]
unfolding v
[PROOF STATE]
proof (prove)
using this:
dimension m F ?E \<Longrightarrow> dimension (n * m) K ?E
dimension (length Vs') F (Span F Vs')
length (v # Vs') = Suc m

goal (1 subgoal):
 1. dimension (n * m) K (Span F Vs')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dimension (n * m) K (Span F Vs')

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dimension n K (Span F [v])
dimension (n * m) K (Span F Vs')
[PROOF STEP]
have "dimension (n * Suc m) K (Span F [ v ] <+>\<^bsub>R\<^esub> Span F Vs')"
[PROOF STATE]
proof (prove)
using this:
dimension n K (Span F [v])
dimension (n * m) K (Span F Vs')

goal (1 subgoal):
 1. dimension (n * Suc m) K (Span F [v] <+> Span F Vs')
[PROOF STEP]
using dimension_direct_sum_space[OF assms(1) _ _ inter]
[PROOF STATE]
proof (prove)
using this:
dimension n K (Span F [v])
dimension (n * m) K (Span F Vs')
\<lbrakk>dimension ?n K (Span F [v]); dimension ?m K (Span F Vs')\<rbrakk> \<Longrightarrow> dimension (?n + ?m) K (Span F [v] <+> Span F Vs')

goal (1 subgoal):
 1. dimension (n * Suc m) K (Span F [v] <+> Span F Vs')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dimension (n * Suc m) K (Span F [v] <+> Span F Vs')

goal (1 subgoal):
 1. \<And>m E. \<lbrakk>\<And>E. dimension m F E \<Longrightarrow> dimension (n * m) K E; dimension (Suc m) F E\<rbrakk> \<Longrightarrow> dimension (n * Suc m) K E
[PROOF STEP]
thus "dimension (n * Suc m) K E"
[PROOF STATE]
proof (prove)
using this:
dimension (n * Suc m) K (Span F [v] <+> Span F Vs')

goal (1 subgoal):
 1. dimension (n * Suc m) K E
[PROOF STEP]
using Span_append_eq_set_add[OF assms(2) li[THEN independent_in_carrier]] Vs(4) v
[PROOF STATE]
proof (prove)
using this:
dimension (n * Suc m) K (Span F [v] <+> Span F Vs')
Span F ([v] @ Vs') = Span F [v] <+> Span F Vs'
Span F Vs = E
Vs = v # Vs'

goal (1 subgoal):
 1. dimension (n * Suc m) K E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dimension (n * Suc m) K E

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) pdivides_imp_roots_incl:
  assumes "p \<in> carrier (poly_ring R)" and "q \<in> carrier (poly_ring R)" "q \<noteq> []"
  shows "p pdivides q \<Longrightarrow> roots p \<subseteq># roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p pdivides q \<Longrightarrow> roots p \<subseteq># roots q
[PROOF STEP]
proof (rule roots_inclI[OF assms])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p pdivides q; a \<in> carrier R; p \<noteq> []\<rbrakk> \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
interpret UP: domain "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
using univ_poly_is_domain[OF carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
domain (poly_ring R)

goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p pdivides q; a \<in> carrier R; p \<noteq> []\<rbrakk> \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>p pdivides q; a \<in> carrier R; p \<noteq> []\<rbrakk> \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
assume "p pdivides q" and a: "a \<in> carrier R"
[PROOF STATE]
proof (state)
this:
p pdivides q
a \<in> carrier R

goal (1 subgoal):
 1. \<And>a. \<lbrakk>p pdivides q; a \<in> carrier R; p \<noteq> []\<rbrakk> \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
hence "[ \<one> , \<ominus> a ] \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
using this:
p pdivides q
a \<in> carrier R

goal (1 subgoal):
 1. [\<one>, \<ominus> a] \<in> carrier (poly_ring R)
[PROOF STEP]
unfolding sym[OF univ_poly_carrier] polynomial_def
[PROOF STATE]
proof (prove)
using this:
p pdivides q
a \<in> carrier R

goal (1 subgoal):
 1. [\<one>, \<ominus> a] = [] \<or> set [\<one>, \<ominus> a] \<subseteq> carrier R \<and> lead_coeff [\<one>, \<ominus> a] \<noteq> \<zero>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. \<And>a. \<lbrakk>p pdivides q; a \<in> carrier R; p \<noteq> []\<rbrakk> \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
with \<open>p pdivides q\<close>
[PROOF STATE]
proof (chain)
picking this:
p pdivides q
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
[PROOF STEP]
show "([\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> (alg_mult p a)) pdivides q"
[PROOF STATE]
proof (prove)
using this:
p pdivides q
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
using UP.divides_trans[of _p q] le_alg_mult_imp_pdivides[OF a assms(1)]
[PROOF STATE]
proof (prove)
using this:
p pdivides q
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
\<lbrakk>?a divides\<^bsub>poly_ring R\<^esub> p; p divides\<^bsub>poly_ring R\<^esub> q; ?a \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> ?a divides\<^bsub>poly_ring R\<^esub> q
?n \<le> alg_mult p a \<Longrightarrow> [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> ?n pdivides p

goal (1 subgoal):
 1. [\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q
[PROOF STEP]
by (auto simp add: pdivides_def)
[PROOF STATE]
proof (state)
this:
[\<one>, \<ominus> a] [^]\<^bsub>poly_ring R\<^esub> alg_mult p a pdivides q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_connected_imp_connected_space:
  assumes "path_connected_space X"
  shows "connected_space X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_space X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. connected_space X
[PROOF STEP]
have *: "\<exists>S. connectedin X S \<and> g 0 \<in> S \<and> g 1 \<in> S" if "pathin X g" for g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S. connectedin X S \<and> g 0 \<in> S \<and> g 1 \<in> S
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. connectedin X ?S
 2. g 0 \<in> ?S
 3. g 1 \<in> ?S
[PROOF STEP]
have "continuous_map (subtopology euclideanreal {0..1}) X g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
using connectedin_absolute that
[PROOF STATE]
proof (prove)
using this:
connectedin (subtopology ?X ?S) ?S = connectedin ?X ?S
pathin X g

goal (1 subgoal):
 1. continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
by (simp add: pathin_def)
[PROOF STATE]
proof (state)
this:
continuous_map (top_of_set {0..1}) X g

goal (3 subgoals):
 1. connectedin X ?S
 2. g 0 \<in> ?S
 3. g 1 \<in> ?S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_map (top_of_set {0..1}) X g
[PROOF STEP]
show "connectedin X (g ` {0..1})"
[PROOF STATE]
proof (prove)
using this:
continuous_map (top_of_set {0..1}) X g

goal (1 subgoal):
 1. connectedin X (g ` {0..1})
[PROOF STEP]
by (rule connectedin_continuous_map_image) auto
[PROOF STATE]
proof (state)
this:
connectedin X (g ` {0..1})

goal (2 subgoals):
 1. g 0 \<in> g ` {0..1}
 2. g 1 \<in> g ` {0..1}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
pathin X ?g \<Longrightarrow> \<exists>S. connectedin X S \<and> ?g 0 \<in> S \<and> ?g 1 \<in> S

goal (1 subgoal):
 1. connected_space X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_space X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path_connected_space X

goal (1 subgoal):
 1. connected_space X
[PROOF STEP]
by (auto intro: * simp add: path_connected_space_def connected_space_subconnected Ball_def)
[PROOF STATE]
proof (state)
this:
connected_space X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "~finite(UNIV::('a::ref)set) \<Longrightarrow>
  VARS xs elem next alloc p q
  {Xs = xs \<and> p = (Null::'a)}
  WHILE xs \<noteq> []
  INV {islist next p \<and> set(list next p) \<subseteq> set alloc \<and>
       map elem (rev(list next p)) @ xs = Xs}
  DO q := new(set alloc); alloc := q#alloc;
     q^.next := p; q^.elem := hd xs; xs := tl xs; p := q
  OD
  {islist next p \<and> map elem (rev(list next p)) = Xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV \<Longrightarrow> {Xs = xs \<and> p = Null}
WHILE xs \<noteq> [] INV {islist next p \<and> set (list next p) \<subseteq> set alloc \<and> map elem (rev (list next p)) @ xs = Xs}  VAR {0}
DO q := new (set alloc); alloc := q # alloc; next := next(q := p); elem := elem(q := hd xs); xs := tl xs; p := q OD
{islist next p \<and> map elem (rev (list next p)) = Xs}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs elem next alloc p. \<lbrakk>infinite UNIV; islist next p \<and> set (list next p) \<subseteq> set alloc \<and> map elem (rev (list next p)) @ xs = Xs \<and> xs \<noteq> []\<rbrakk> \<Longrightarrow> islist (next(new (set alloc) := p)) (new (set alloc)) \<and> set (list (next(new (set alloc) := p)) (new (set alloc))) \<subseteq> insert (new (set alloc)) (set alloc) \<and> map (elem(new (set alloc) := hd xs)) (rev (list (next(new (set alloc) := p)) (new (set alloc)))) @ tl xs = Xs
[PROOF STEP]
apply (clarsimp simp: subset_insert_iff neq_Nil_conv fun_upd_apply new_notin)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bilinear_rsub: "bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y
[PROOF STEP]
using bilinear_radd [of h _ x "- y"]
[PROOF STATE]
proof (prove)
using this:
bilinear h \<Longrightarrow> h ?x (x + - y) = h ?x x + h ?x (- y)

goal (1 subgoal):
 1. bilinear h \<Longrightarrow> h z (x - y) = h z x - h z y
[PROOF STEP]
by (simp add: bilinear_rneg)


[STATEMENT]
lemma converse_Image_singleton_Domain:
  assumes runiq: "runiq R"
      and runiq_conv: "runiq (R\<inverse>)"
      and domain: "x \<in> Domain R"
  shows "R\<inverse> `` R `` {x} = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
have sup: "{x} \<subseteq> R\<inverse> `` R `` {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x} \<subseteq> R\<inverse> `` R `` {x}
[PROOF STEP]
using domain
[PROOF STATE]
proof (prove)
using this:
x \<in> Domain R

goal (1 subgoal):
 1. {x} \<subseteq> R\<inverse> `` R `` {x}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{x} \<subseteq> R\<inverse> `` R `` {x}

goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
have "trivial (R `` {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial (R `` {x})
[PROOF STEP]
using runiq domain
[PROOF STATE]
proof (prove)
using this:
runiq R
x \<in> Domain R

goal (1 subgoal):
 1. trivial (R `` {x})
[PROOF STEP]
by (metis runiq_def trivial_singleton)
[PROOF STATE]
proof (state)
this:
trivial (R `` {x})

goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
trivial (R `` {x})
[PROOF STEP]
have "trivial (R\<inverse> `` R `` {x})"
[PROOF STATE]
proof (prove)
using this:
trivial (R `` {x})

goal (1 subgoal):
 1. trivial (R\<inverse> `` R `` {x})
[PROOF STEP]
using assms runiq_def
[PROOF STATE]
proof (prove)
using this:
trivial (R `` {x})
runiq R
runiq (R\<inverse>)
x \<in> Domain R
runiq ?R = (\<forall>X. trivial X \<longrightarrow> trivial (?R `` X))

goal (1 subgoal):
 1. trivial (R\<inverse> `` R `` {x})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
trivial (R\<inverse> `` R `` {x})

goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
trivial (R\<inverse> `` R `` {x})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trivial (R\<inverse> `` R `` {x})

goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
using sup
[PROOF STATE]
proof (prove)
using this:
trivial (R\<inverse> `` R `` {x})
{x} \<subseteq> R\<inverse> `` R `` {x}

goal (1 subgoal):
 1. R\<inverse> `` R `` {x} = {x}
[PROOF STEP]
by (metis singleton_sub_trivial_uniq subset_antisym trivial_def)
[PROOF STATE]
proof (state)
this:
R\<inverse> `` R `` {x} = {x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Affine_msum_aform:
  assumes "d \<ge> degree_aform X"
  shows "Affine (msum_aform d X Y) = {x + y |x y. x \<in> Affine X \<and> y \<in> Affine Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Affine (msum_aform d X Y) = {x + y |x y. x \<in> Affine X \<and> y \<in> Affine Y}
[PROOF STEP]
using Joints_msum_aform[OF assms, of Nil Y, simplified, unfolded mem_Joints_singleton]
[PROOF STATE]
proof (prove)
using this:
Joints [msum_aform d X Y] = {(x + y) # ys |x y ys. y \<in> Affine Y \<and> (\<exists>y. x # ys = [y] \<and> y \<in> Affine X)}

goal (1 subgoal):
 1. Affine (msum_aform d X Y) = {x + y |x y. x \<in> Affine X \<and> y \<in> Affine Y}
[PROOF STEP]
by (auto simp add: Joints_singleton_image Collect_extract_image[where g="\<lambda>x. [x]"]
    inj_image_eq_iff[OF inj_Cons] )


[STATEMENT]
lemma linear_conv_bounded_linear:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
  shows "linear f \<longleftrightarrow> bounded_linear f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear f = bounded_linear f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. linear f \<Longrightarrow> bounded_linear f
 2. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
assume "linear f"
[PROOF STATE]
proof (state)
this:
linear f

goal (2 subgoals):
 1. linear f \<Longrightarrow> bounded_linear f
 2. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear f
[PROOF STEP]
interpret f: linear f
[PROOF STATE]
proof (prove)
using this:
linear f

goal (1 subgoal):
 1. linear f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. linear f \<Longrightarrow> bounded_linear f
 2. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
show "bounded_linear f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (f x) \<le> norm x * K
[PROOF STEP]
have "\<exists>B. \<forall>x. norm (f x) \<le> B * norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. \<forall>x. norm (f x) \<le> B * norm x
[PROOF STEP]
using \<open>linear f\<close>
[PROOF STATE]
proof (prove)
using this:
linear f

goal (1 subgoal):
 1. \<exists>B. \<forall>x. norm (f x) \<le> B * norm x
[PROOF STEP]
by (rule linear_bounded)
[PROOF STATE]
proof (state)
this:
\<exists>B. \<forall>x. norm (f x) \<le> B * norm x

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (f x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. \<forall>x. norm (f x) \<le> B * norm x
[PROOF STEP]
show "\<exists>K. \<forall>x. norm (f x) \<le> norm x * K"
[PROOF STATE]
proof (prove)
using this:
\<exists>B. \<forall>x. norm (f x) \<le> B * norm x

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (f x) \<le> norm x * K
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x. norm (f x) \<le> norm x * K

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bounded_linear f

goal (1 subgoal):
 1. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
assume "bounded_linear f"
[PROOF STATE]
proof (state)
this:
bounded_linear f

goal (1 subgoal):
 1. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded_linear f
[PROOF STEP]
interpret f: bounded_linear f
[PROOF STATE]
proof (prove)
using this:
bounded_linear f

goal (1 subgoal):
 1. bounded_linear f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded_linear f \<Longrightarrow> linear f
[PROOF STEP]
show "linear f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear f
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
linear f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_abs_ereal [tendsto_intros]:
  assumes "(u \<longlongrightarrow> (l::ereal)) F"
  shows "((\<lambda>n. abs(u n)) \<longlongrightarrow> abs l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. \<bar>u n\<bar>) \<longlongrightarrow> \<bar>l\<bar>) F
[PROOF STEP]
using continuous_ereal_abs assms
[PROOF STATE]
proof (prove)
using this:
continuous_on UNIV abs
(u \<longlongrightarrow> l) F

goal (1 subgoal):
 1. ((\<lambda>n. \<bar>u n\<bar>) \<longlongrightarrow> \<bar>l\<bar>) F
[PROOF STEP]
by (metis UNIV_I continuous_on tendsto_compose)


[STATEMENT]
lemma p_le_n: "p \<le> 2*n + 40"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<le> 2 * n + 40
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<le> 2 * n + 40
[PROOF STEP]
have "p \<le> 2 * (max n 19) + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<le> 2 * max n 19 + 2
[PROOF STEP]
by (subst p_def, rule prime_above_upper_bound)
[PROOF STATE]
proof (state)
this:
p \<le> 2 * max n 19 + 2

goal (1 subgoal):
 1. p \<le> 2 * n + 40
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p \<le> 2 * max n 19 + 2

goal (1 subgoal):
 1. p \<le> 2 * n + 40
[PROOF STEP]
have "... \<le> 2 * n + 40"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * max n 19 + 2 \<le> 2 * n + 40
[PROOF STEP]
by (cases "n \<ge> 19", auto)
[PROOF STATE]
proof (state)
this:
2 * max n 19 + 2 \<le> 2 * n + 40

goal (1 subgoal):
 1. p \<le> 2 * n + 40
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p \<le> 2 * n + 40
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<le> 2 * n + 40

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_le_harm: "ln (real n + 1) \<le> (harm n :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
assume IH: "ln (real n + 1) \<le> harm n"
[PROOF STATE]
proof (state)
this:
ln (real n + 1) \<le> harm n

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
have "ln (real (Suc n) + 1) = ln (real n + 1) + (ln (real n + 2) - ln (real n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (Suc n) + 1) = ln (real n + 1) + (ln (real n + 2) - ln (real n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (real (Suc n) + 1) = ln (real n + 1) + (ln (real n + 2) - ln (real n + 1))

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (Suc n) + 1) = ln (real n + 1) + (ln (real n + 2) - ln (real n + 1))

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
have "(ln (real n + 2) - ln (real n + 1)) \<le> 1 / real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n + 2) - ln (real n + 1) \<le> 1 / real (Suc n)
[PROOF STEP]
using ln_diff_le_inverse[of "real n + 1"]
[PROOF STATE]
proof (prove)
using this:
1 \<le> real n + 1 \<Longrightarrow> ln (real n + 1 + 1) - ln (real n + 1) < 1 / (real n + 1)

goal (1 subgoal):
 1. ln (real n + 2) - ln (real n + 1) \<le> 1 / real (Suc n)
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
ln (real n + 2) - ln (real n + 1) \<le> 1 / real (Suc n)

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real n + 2) - ln (real n + 1) \<le> 1 / real (Suc n)

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
note IH
[PROOF STATE]
proof (state)
this:
ln (real n + 1) \<le> harm n

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real n + 1) \<le> harm n

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
have "harm n + 1 / real (Suc n) = harm (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm n + 1 / real (Suc n) = harm (Suc n)
[PROOF STEP]
by (simp add: harm_Suc field_simps)
[PROOF STATE]
proof (state)
this:
harm n + 1 / real (Suc n) = harm (Suc n)

goal (2 subgoals):
 1. ln (real 0 + 1) \<le> harm 0
 2. \<And>n. ln (real n + 1) \<le> harm n \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> ln (real n + 1) + x \<le> ln (real n + 1) + y; \<And>x y. x \<le> y \<Longrightarrow> x + 1 / real (Suc n) \<le> y + 1 / real (Suc n)\<rbrakk> \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)
[PROOF STEP]
show "ln (real (Suc n) + 1) \<le> harm (Suc n)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> ln (real n + 1) + x \<le> ln (real n + 1) + y; \<And>x y. x \<le> y \<Longrightarrow> x + 1 / real (Suc n) \<le> y + 1 / real (Suc n)\<rbrakk> \<Longrightarrow> ln (real (Suc n) + 1) \<le> harm (Suc n)

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

goal (1 subgoal):
 1. ln (real 0 + 1) \<le> harm 0
[PROOF STEP]
qed (simp_all add: harm_def)


[STATEMENT]
lemma initial_segment_Cons [simp]: "initial_segment (x#xs) (y#ys) \<longleftrightarrow> x=y \<and> initial_segment xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. initial_segment (x # xs) (y # ys) = (x = y \<and> initial_segment xs ys)
[PROOF STEP]
by (metis append_Cons initial_segment.simps list.inject)


[STATEMENT]
lemma matrix_sum_remove:
  fixes f :: "nat \<Rightarrow> 'b::semiring_1 mat"
  assumes j: "j < n"
    and df: "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d)"
    and f': "(\<And>k. f' k = (if k = j then 0\<^sub>m d d else f k))"
  shows "matrix_sum d f n = f j + matrix_sum d f' n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have df': "\<And>k. k < n \<Longrightarrow> f' k \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n \<Longrightarrow> f' k \<in> carrier_mat d d
[PROOF STEP]
using f' df
[PROOF STATE]
proof (prove)
using this:
f' ?k = (if ?k = j then 0\<^sub>m d d else f ?k)
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>k. k < n \<Longrightarrow> f' k \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> f' ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have dsf: "k < n \<Longrightarrow> matrix_sum d f k \<in> carrier_mat d d" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> matrix_sum d f k \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim[OF df]
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < ?n \<Longrightarrow> ?k1 k < n) \<Longrightarrow> matrix_sum d (\<lambda>k. f (?k1 k)) ?n \<in> carrier_mat d d

goal (1 subgoal):
 1. k < n \<Longrightarrow> matrix_sum d f k \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> matrix_sum d f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have dsf': "k < n \<Longrightarrow> matrix_sum d f' k \<in> carrier_mat d d" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> matrix_sum d f' k \<in> carrier_mat d d
[PROOF STEP]
using matrix_sum_dim[OF df']
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < ?n \<Longrightarrow> ?k1 k < n) \<Longrightarrow> matrix_sum d (\<lambda>k. f' (?k1 k)) ?n \<in> carrier_mat d d

goal (1 subgoal):
 1. k < n \<Longrightarrow> matrix_sum d f' k \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < n \<Longrightarrow> matrix_sum d f' ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have flj: "\<And>k. k < j \<Longrightarrow> f' k = f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < j \<Longrightarrow> f' k = f k
[PROOF STEP]
using j f'
[PROOF STATE]
proof (prove)
using this:
j < n
f' ?k = (if ?k = j then 0\<^sub>m d d else f ?k)

goal (1 subgoal):
 1. \<And>k. k < j \<Longrightarrow> f' k = f k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < j \<Longrightarrow> f' ?k = f ?k

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < j \<Longrightarrow> f' ?k = f ?k
[PROOF STEP]
have "matrix_sum d f j = matrix_sum d f' j"
[PROOF STATE]
proof (prove)
using this:
?k < j \<Longrightarrow> f' ?k = f ?k

goal (1 subgoal):
 1. matrix_sum d f j = matrix_sum d f' j
[PROOF STEP]
using matrix_sum_cong[of j f' f, OF flj] df df' j
[PROOF STATE]
proof (prove)
using this:
?k < j \<Longrightarrow> f' ?k = f ?k
(\<And>k. k < j \<Longrightarrow> k < j) \<Longrightarrow> matrix_sum ?d f' j = matrix_sum ?d f j
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> f' ?k \<in> carrier_mat d d
j < n

goal (1 subgoal):
 1. matrix_sum d f j = matrix_sum d f' j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f j = matrix_sum d f' j

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
matrix_sum d f j = matrix_sum d f' j
[PROOF STEP]
have eqj: "matrix_sum d f (Suc j) = f j + matrix_sum d f' (Suc j)"
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f j = matrix_sum d f' j

goal (1 subgoal):
 1. matrix_sum d f (Suc j) = f j + matrix_sum d f' (Suc j)
[PROOF STEP]
unfolding matrix_sum.simps
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f j = matrix_sum d f' j

goal (1 subgoal):
 1. f j + matrix_sum d f j = f j + (f' j + matrix_sum d f' j)
[PROOF STEP]
by (subst (1) f', simp add: df dsf' j)
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc j) = f j + matrix_sum d f' (Suc j)

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have lm: "(j + 1) + l \<le> n \<Longrightarrow> matrix_sum d f ((j + 1) + l) = f j + matrix_sum d f' ((j + 1) + l)" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j + 1 + 0 \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + 0) = f j + matrix_sum d f' (j + 1 + 0)
 2. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
j + 1 + 0 \<le> n

goal (2 subgoals):
 1. j + 1 + 0 \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + 0) = f j + matrix_sum d f' (j + 1 + 0)
 2. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f (j + 1 + 0) = f j + matrix_sum d f' (j + 1 + 0)
[PROOF STEP]
using j eqj
[PROOF STATE]
proof (prove)
using this:
j < n
matrix_sum d f (Suc j) = f j + matrix_sum d f' (Suc j)

goal (1 subgoal):
 1. matrix_sum d f (j + 1 + 0) = f j + matrix_sum d f' (j + 1 + 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (j + 1 + 0) = f j + matrix_sum d f' (j + 1 + 0)

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
case (Suc l)
[PROOF STATE]
proof (state)
this:
j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
j + 1 + Suc l \<le> n

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
j + 1 + Suc l \<le> n
[PROOF STEP]
have eq: "matrix_sum d f ((j + 1) + l) = f j + matrix_sum d f' ((j + 1) + l)"
[PROOF STATE]
proof (prove)
using this:
j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
j + 1 + Suc l \<le> n

goal (1 subgoal):
 1. matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
have s: "((j + 1) + Suc l) = Suc ((j + 1) + l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + 1 + Suc l = Suc (j + 1 + l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j + 1 + Suc l = Suc (j + 1 + l)

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
have eqf': "f' (j + 1 + l) = f (j + 1 + l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' (j + 1 + l) = f (j + 1 + l)
[PROOF STEP]
using f' Suc
[PROOF STATE]
proof (prove)
using this:
f' ?k = (if ?k = j then 0\<^sub>m d d else f ?k)
j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
j + 1 + Suc l \<le> n

goal (1 subgoal):
 1. f' (j + 1 + l) = f (j + 1 + l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' (j + 1 + l) = f (j + 1 + l)

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
have dims: "f (j + 1 + l) \<in> carrier_mat d d" "f j \<in> carrier_mat d d" "matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (j + 1 + l) \<in> carrier_mat d d &&& f j \<in> carrier_mat d d &&& matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d
[PROOF STEP]
using df df' dsf' Suc
[PROOF STATE]
proof (prove)
using this:
?k < n \<Longrightarrow> f ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> f' ?k \<in> carrier_mat d d
?k < n \<Longrightarrow> matrix_sum d f' ?k \<in> carrier_mat d d
j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l)
j + 1 + Suc l \<le> n

goal (1 subgoal):
 1. f (j + 1 + l) \<in> carrier_mat d d &&& f j \<in> carrier_mat d d &&& matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (j + 1 + l) \<in> carrier_mat d d
f j \<in> carrier_mat d d
matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>l. \<lbrakk>j + 1 + l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + l) = f j + matrix_sum d f' (j + 1 + l); j + 1 + Suc l \<le> n\<rbrakk> \<Longrightarrow> matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)
[PROOF STEP]
apply (subst (1 2) s)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f (Suc (j + 1 + l)) = f j + matrix_sum d f' (Suc (j + 1 + l))
[PROOF STEP]
unfolding matrix_sum.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (j + 1 + l) + matrix_sum d f (j + 1 + l) = f j + (f' (j + 1 + l) + matrix_sum d f' (j + 1 + l))
[PROOF STEP]
apply (subst eq, subst eqf')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (j + 1 + l) + (f j + matrix_sum d f' (j + 1 + l)) = f j + (f (j + 1 + l) + matrix_sum d f' (j + 1 + l))
[PROOF STEP]
apply (mat_assoc d)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d
 2. f (j + 1 + l) \<in> carrier_mat d d
 3. f j \<in> carrier_mat d d
[PROOF STEP]
using dims
[PROOF STATE]
proof (prove)
using this:
f (j + 1 + l) \<in> carrier_mat d d
f j \<in> carrier_mat d d
matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d

goal (3 subgoals):
 1. matrix_sum d f' (j + 1 + l) \<in> carrier_mat d d
 2. f (j + 1 + l) \<in> carrier_mat d d
 3. f j \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (j + 1 + Suc l) = f j + matrix_sum d f' (j + 1 + Suc l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
j + 1 + ?l \<le> n \<Longrightarrow> matrix_sum d f (j + 1 + ?l) = f j + matrix_sum d f' (j + 1 + ?l)

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
have p: "(j + 1) + (n - j - 1) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + 1 + (n - j - 1) \<le> n
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < n

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

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
using lm[OF p] j
[PROOF STATE]
proof (prove)
using this:
matrix_sum d f (j + 1 + (n - j - 1)) = f j + matrix_sum d f' (j + 1 + (n - j - 1))
j < n

goal (1 subgoal):
 1. matrix_sum d f n = f j + matrix_sum d f' n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f n = f j + matrix_sum d f' n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_nth_derivative_lt_0:
  "higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. higher_differentiable_on {..<0} f 0 \<and> (\<forall>t<0. nth_derivative 0 f t 1 = 0)
 2. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. higher_differentiable_on {..<0} f 0 \<and> (\<forall>t<0. nth_derivative 0 f t 1 = 0)
 2. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
have rewr: "a \<in> {..<0} \<Longrightarrow> \<not>0 < a" for a::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {..<0} \<Longrightarrow> \<not> 0 < a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?a \<in> {..<0} \<Longrightarrow> \<not> 0 < ?a

goal (2 subgoals):
 1. higher_differentiable_on {..<0} f 0 \<and> (\<forall>t<0. nth_derivative 0 f t 1 = 0)
 2. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on {..<0} f 0 \<and> (\<forall>t<0. nth_derivative 0 f t 1 = 0)
[PROOF STEP]
by (auto simp: higher_differentiable_on.simps f_def rewr
        simp del: lessThan_iff
        cong: continuous_on_cong)
[PROOF STATE]
proof (state)
this:
higher_differentiable_on {..<0} f 0 \<and> (\<forall>t<0. nth_derivative 0 f t 1 = 0)

goal (1 subgoal):
 1. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)

goal (1 subgoal):
 1. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
have "t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at t" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at t
[PROOF STEP]
by (rule differentiable_eqI[where g=0 and X="{..<0}"])
      (auto simp: zero_fun_def frechet_derivative_const Suc.IH)
[PROOF STATE]
proof (state)
this:
?t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at ?t

goal (1 subgoal):
 1. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at ?t
[PROOF STEP]
have "frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at t) 1 = 0" if "t < 0" for t
[PROOF STATE]
proof (prove)
using this:
?t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at ?t

goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at t) 1 = 0
[PROOF STEP]
using that Suc.IH
[PROOF STATE]
proof (prove)
using this:
?t < 0 \<Longrightarrow> (\<lambda>x. nth_derivative k f x 1) differentiable at ?t
t < 0
higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)

goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at t) 1 = 0
[PROOF STEP]
by (subst frechet_derivative_transform_within_open[where X="{..<0}" and g =0])
      (auto simp: frechet_derivative_zero_fun)
[PROOF STATE]
proof (state)
this:
?t < 0 \<Longrightarrow> frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at ?t) 1 = 0

goal (1 subgoal):
 1. \<And>k. higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0) \<Longrightarrow> higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)
?t < 0 \<Longrightarrow> frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at ?t) 1 = 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
higher_differentiable_on {..<0} f k \<and> (\<forall>t<0. nth_derivative k f t 1 = 0)
?t < 0 \<Longrightarrow> frechet_derivative (\<lambda>x. nth_derivative k f x 1) (at ?t) 1 = 0

goal (1 subgoal):
 1. higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)
[PROOF STEP]
by (auto simp: higher_differentiable_on.simps f_differentiable_at_neg
        frechet_derivative_f_at_neg zero_fun_def
        simp flip: frechet_derivative_nth_derivative_commute
        simp del: lessThan_iff
        intro!: higher_differentiable_on_const
        cong: higher_differentiable_on_cong)
[PROOF STATE]
proof (state)
this:
higher_differentiable_on {..<0} f (Suc k) \<and> (\<forall>t<0. nth_derivative (Suc k) f t 1 = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm051:
  assumes "finite X" "x > Max X"
  shows "x \<notin> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> X
[PROOF STEP]
using assms Max.coboundedI
[PROOF STATE]
proof (prove)
using this:
finite X
Max X < x
\<lbrakk>finite ?A; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<le> Max ?A

goal (1 subgoal):
 1. x \<notin> X
[PROOF STEP]
by (metis leD)


[STATEMENT]
lemma random_aux_rec:
  fixes random_aux :: "natural \<Rightarrow> 'a"
  assumes "random_aux 0 = rhs 0"
    and "\<And>k. random_aux (Code_Numeral.Suc k) = rhs (Code_Numeral.Suc k)"
  shows "random_aux k = rhs k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_aux k = rhs k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
random_aux 0 = rhs 0
random_aux (Code_Numeral.Suc ?k) = rhs (Code_Numeral.Suc ?k)

goal (1 subgoal):
 1. random_aux k = rhs k
[PROOF STEP]
by (rule natural.induct)


[STATEMENT]
lemma PosOrd_partial:
  shows "partial_order_on UNIV {(v1, v2). v1 :\<sqsubseteq>val v2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_order_on UNIV {(v1, v2). v1 :\<sqsubseteq>val v2}
[PROOF STEP]
apply(simp add: partial_order_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. preorder_on UNIV {(x, y). x :\<sqsubseteq>val y} \<and> antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(simp add: preorder_on_def refl_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. x :\<sqsubseteq>val x) \<and> trans {(x, y). x :\<sqsubseteq>val y} \<and> antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(simp add: PosOrdeq_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans {(x, y). x :\<sqsubseteq>val y} \<and> antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. trans {(x, y). x :\<sqsubseteq>val y}
 2. antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(rule transI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y z. \<lbrakk>(x, y) \<in> {(x, y). x :\<sqsubseteq>val y}; (y, z) \<in> {(x, y). x :\<sqsubseteq>val y}\<rbrakk> \<Longrightarrow> (x, z) \<in> {(x, y). x :\<sqsubseteq>val y}
 2. antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(auto intro: PosOrdeq_trans)[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. antisym {(x, y). x :\<sqsubseteq>val y}
[PROOF STEP]
apply(rule antisymI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>(x, y) \<in> {(x, y). x :\<sqsubseteq>val y}; (y, x) \<in> {(x, y). x :\<sqsubseteq>val y}\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply(simp add: PosOrdeq_antisym)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filter_nth_ex_nth:
  assumes "n < length (filter P xs)"
  shows "\<exists>m. n \<le> m \<and> m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length (filter P xs)

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
[PROOF STEP]
proof(induct xs rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n < length (filter P []) \<Longrightarrow> \<exists>m\<ge>n. m < length [] \<and> filter P [] ! n = [] ! m \<and> filter P (take m []) = take n (filter P [])
 2. \<And>x xs. \<lbrakk>n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs); n < length (filter P (xs @ [x]))\<rbrakk> \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
n < length (filter P [])

goal (2 subgoals):
 1. n < length (filter P []) \<Longrightarrow> \<exists>m\<ge>n. m < length [] \<and> filter P [] ! n = [] ! m \<and> filter P (take m []) = take n (filter P [])
 2. \<And>x xs. \<lbrakk>n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs); n < length (filter P (xs @ [x]))\<rbrakk> \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
n < length (filter P [])

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length [] \<and> filter P [] ! n = [] ! m \<and> filter P (take m []) = take n (filter P [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length [] \<and> filter P [] ! n = [] ! m \<and> filter P (take m []) = take n (filter P [])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs); n < length (filter P (xs @ [x]))\<rbrakk> \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs); n < length (filter P (xs @ [x]))\<rbrakk> \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
n < length (filter P (xs @ [x]))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>n < length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs); n < length (filter P (xs @ [x]))\<rbrakk> \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
proof(cases "P x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. \<not> P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
\<not> P x

goal (2 subgoals):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. \<not> P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
from \<open>n < length (filter P (xs @ [x]))\<close>
[PROOF STATE]
proof (chain)
picking this:
n < length (filter P (xs @ [x]))
[PROOF STEP]
have "n < length (filter P xs)"
[PROOF STATE]
proof (prove)
using this:
n < length (filter P (xs @ [x]))

goal (1 subgoal):
 1. n < length (filter P xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n < length (filter P xs)

goal (2 subgoals):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. \<not> P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
hence "\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)"
[PROOF STATE]
proof (prove)
using this:
n < length (filter P xs)

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
[PROOF STEP]
by(rule snoc)
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)

goal (2 subgoals):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. \<not> P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
by(auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))

goal (1 subgoal):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case [simp]: True
[PROOF STATE]
proof (state)
this:
P x

goal (1 subgoal):
 1. P x \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
proof(cases "n = length (filter P xs)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. n \<noteq> length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> length (filter P xs)

goal (2 subgoals):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. n \<noteq> length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
with \<open>n < length (filter P (xs @ [x]))\<close>
[PROOF STATE]
proof (chain)
picking this:
n < length (filter P (xs @ [x]))
n \<noteq> length (filter P xs)
[PROOF STEP]
have "n < length (filter P xs)"
[PROOF STATE]
proof (prove)
using this:
n < length (filter P (xs @ [x]))
n \<noteq> length (filter P xs)

goal (1 subgoal):
 1. n < length (filter P xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n < length (filter P xs)

goal (2 subgoals):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. n \<noteq> length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n < length (filter P xs)

goal (2 subgoals):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. n \<noteq> length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
hence "\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)"
[PROOF STATE]
proof (prove)
using this:
n < length (filter P xs)

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
[PROOF STEP]
by(rule snoc)
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)

goal (2 subgoals):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
 2. n \<noteq> length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n < length (filter P xs)
\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n < length (filter P xs)
\<exists>m\<ge>n. m < length xs \<and> filter P xs ! n = xs ! m \<and> filter P (take m xs) = take n (filter P xs)

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
by(auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
case [simp]: True
[PROOF STATE]
proof (state)
this:
n = length (filter P xs)

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
hence "filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs"
[PROOF STATE]
proof (prove)
using this:
n = length (filter P xs)

goal (1 subgoal):
 1. filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
have "length xs < length (xs @ [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs < length (xs @ [x])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs < length (xs @ [x])

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length xs < length (xs @ [x])

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
have "length xs \<ge> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<le> length xs

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n \<le> length xs

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
have "filter P (take (length xs) (xs @ [x])) = take n (filter P (xs @ [x]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (take (length xs) (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter P (take (length xs) (xs @ [x])) = take n (filter P (xs @ [x]))

goal (1 subgoal):
 1. n = length (filter P xs) \<Longrightarrow> \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs
length xs < length (xs @ [x])
n \<le> length xs
filter P (take (length xs) (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filter P (xs @ [x]) ! n = (xs @ [x]) ! length xs
length xs < length (xs @ [x])
n \<le> length xs
filter P (take (length xs) (xs @ [x])) = take n (filter P (xs @ [x]))

goal (1 subgoal):
 1. \<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>m\<ge>n. m < length (xs @ [x]) \<and> filter P (xs @ [x]) ! n = (xs @ [x]) ! m \<and> filter P (take m (xs @ [x])) = take n (filter P (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Group) sg_mult_closedl:"\<lbrakk>G \<guillemotright> H; x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow>
                    h \<cdot> x \<in> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; x \<in> carrier G; h \<in> H\<rbrakk> \<Longrightarrow> h \<cdot> x \<in> carrier G
[PROOF STEP]
apply (frule sg_subset_elem[of "H" "h"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; x \<in> carrier G; h \<in> H; h \<in> carrier G\<rbrakk> \<Longrightarrow> h \<cdot> x \<in> carrier G
[PROOF STEP]
apply (simp add:mult_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_of_graph_rulesD[dest]:
  assumes "set_of_graph_rules Rs" "R \<in> Rs"
  shows "finite_graph (fst R)" "finite_graph (snd R)" "subgraph (fst R) (snd R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_graph (fst R) &&& finite_graph (snd R) &&& subgraph (fst R) (snd R)
[PROOF STEP]
using assms(1)[unfolded set_of_graph_rules_def] assms(2)
        rev_finite_subset[of "vertices (snd R)"]
        rev_finite_subset[of "edges (snd R)"]
[PROOF STATE]
proof (prove)
using this:
\<forall>R\<in>Rs. graph_rule R
R \<in> Rs
\<lbrakk>finite (vertices (snd R)); ?A \<subseteq> vertices (snd R)\<rbrakk> \<Longrightarrow> finite ?A
\<lbrakk>finite (edges (snd R)); ?A \<subseteq> edges (snd R)\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite_graph (fst R) &&& finite_graph (snd R) &&& subgraph (fst R) (snd R)
[PROOF STEP]
unfolding subgraph_def graph_union_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>R\<in>Rs. (graph (fst R) \<and> graph (snd R) \<and> edges (fst R) \<subseteq> edges (snd R) \<and> vertices (fst R) \<subseteq> vertices (snd R)) \<and> finite_graph (snd R)
R \<in> Rs
\<lbrakk>finite (vertices (snd R)); ?A \<subseteq> vertices (snd R)\<rbrakk> \<Longrightarrow> finite ?A
\<lbrakk>finite (edges (snd R)); ?A \<subseteq> edges (snd R)\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite_graph (fst R) &&& finite_graph (snd R) &&& graph (fst R) \<and> graph (snd R) \<and> edges (fst R) \<subseteq> edges (snd R) \<and> vertices (fst R) \<subseteq> vertices (snd R)
[PROOF STEP]
by auto


[STATEMENT]
lemma take_Suc_conv_app_nth:
  "i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs!i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]
[PROOF STEP]
proof (induct xs arbitrary: i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> take (Suc i) [] = take i [] @ [[] ! i]
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]; i < length (a # xs)\<rbrakk> \<Longrightarrow> take (Suc i) (a # xs) = take i (a # xs) @ [(a # xs) ! i]
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
i < length []

goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> take (Suc i) [] = take i [] @ [[] ! i]
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]; i < length (a # xs)\<rbrakk> \<Longrightarrow> take (Suc i) (a # xs) = take i (a # xs) @ [(a # xs) ! i]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i < length []

goal (1 subgoal):
 1. take (Suc i) [] = take i [] @ [[] ! i]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take (Suc i) [] = take i [] @ [[] ! i]

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]; i < length (a # xs)\<rbrakk> \<Longrightarrow> take (Suc i) (a # xs) = take i (a # xs) @ [(a # xs) ! i]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]; i < length (a # xs)\<rbrakk> \<Longrightarrow> take (Suc i) (a # xs) = take i (a # xs) @ [(a # xs) ! i]
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
?i < length xs_ \<Longrightarrow> take (Suc ?i) xs_ = take ?i xs_ @ [xs_ ! ?i]
i < length (a_ # xs_)

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> take (Suc i) xs = take i xs @ [xs ! i]; i < length (a # xs)\<rbrakk> \<Longrightarrow> take (Suc i) (a # xs) = take i (a # xs) @ [(a # xs) ! i]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < length xs_ \<Longrightarrow> take (Suc ?i) xs_ = take ?i xs_ @ [xs_ ! ?i]
i < length (a_ # xs_)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i < length xs_ \<Longrightarrow> take (Suc ?i) xs_ = take ?i xs_ @ [xs_ ! ?i]
i < length (a_ # xs_)

goal (1 subgoal):
 1. take (Suc i) (a_ # xs_) = take i (a_ # xs_) @ [(a_ # xs_) ! i]
[PROOF STEP]
by (cases i) auto
[PROOF STATE]
proof (state)
this:
take (Suc i) (a_ # xs_) = take i (a_ # xs_) @ [(a_ # xs_) ! i]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_mult_inv: assumes p: "poly_inv p" and q: "poly_inv q"
  shows "poly_inv (poly_mult p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_inv (poly_mult p q)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
poly_inv p

goal (1 subgoal):
 1. poly_inv (poly_mult p q)
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_inv [] \<Longrightarrow> poly_inv (poly_mult [] q)
 2. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
poly_inv []

goal (2 subgoals):
 1. poly_inv [] \<Longrightarrow> poly_inv (poly_mult [] q)
 2. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
poly_inv []

goal (1 subgoal):
 1. poly_inv (poly_mult [] q)
[PROOF STEP]
by (simp add: poly_inv_def)
[PROOF STATE]
proof (state)
this:
poly_inv (poly_mult [] q)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
case (Cons mc p)
[PROOF STATE]
proof (state)
this:
poly_inv p \<Longrightarrow> poly_inv (poly_mult p q)
poly_inv (mc # p)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
obtain m c where mc: "mc = (m,c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m c. mc = (m, c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases mc, auto)
[PROOF STATE]
proof (state)
this:
mc = (m, c)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
poly_inv (mc # p)
mc = (m, c)
[PROOF STEP]
have p: "poly_inv p"
[PROOF STATE]
proof (prove)
using this:
poly_inv (mc # p)
mc = (m, c)

goal (1 subgoal):
 1. poly_inv p
[PROOF STEP]
unfolding poly_inv_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>c\<in>snd ` set (mc # p). c \<noteq> (0::'b)) \<and> distinct (map fst (mc # p))
mc = (m, c)

goal (1 subgoal):
 1. (\<forall>c\<in>snd ` set p. c \<noteq> (0::'b)) \<and> distinct (map fst p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_inv p

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>poly_inv p \<Longrightarrow> poly_inv (poly_mult p q); poly_inv (a # p)\<rbrakk> \<Longrightarrow> poly_inv (poly_mult (a # p) q)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_inv (poly_mult (mc # p) q)
[PROOF STEP]
by (simp add: mc, rule poly_add_inv[OF monom_mult_poly_inv[OF q] Cons(1)[OF p]])
[PROOF STATE]
proof (state)
this:
poly_inv (poly_mult (mc # p) q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma discounted_cong:
  assumes "\<forall>n w. X n w = Y n w"
  shows "\<forall> n w. discounted_value r X n w = discounted_value r Y n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. discounted_value r X n w = discounted_value r Y n w
[PROOF STEP]
by (simp add: assms discounted_value_def)


[STATEMENT]
lemma standard_simplex_mono:
  assumes "p \<le> q"
  shows "standard_simplex p \<subseteq> standard_simplex q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. standard_simplex p \<subseteq> standard_simplex q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<le> q

goal (1 subgoal):
 1. standard_simplex p \<subseteq> standard_simplex q
[PROOF STEP]
proof (clarsimp simp: standard_simplex_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>p \<le> q; \<forall>i. 0 \<le> x i \<and> x i \<le> 1; \<forall>i>p. x i = 0; sum x {..p} = 1\<rbrakk> \<Longrightarrow> sum x {..q} = 1
[PROOF STEP]
fix x :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>p \<le> q; \<forall>i. 0 \<le> x i \<and> x i \<le> 1; \<forall>i>p. x i = 0; sum x {..p} = 1\<rbrakk> \<Longrightarrow> sum x {..q} = 1
[PROOF STEP]
assume "\<forall>i. 0 \<le> x i \<and> x i \<le> 1" and "\<forall>i>p. x i = 0" and "sum x {..p} = 1"
[PROOF STATE]
proof (state)
this:
\<forall>i. 0 \<le> x i \<and> x i \<le> 1
\<forall>i>p. x i = 0
sum x {..p} = 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>p \<le> q; \<forall>i. 0 \<le> x i \<and> x i \<le> 1; \<forall>i>p. x i = 0; sum x {..p} = 1\<rbrakk> \<Longrightarrow> sum x {..q} = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i. 0 \<le> x i \<and> x i \<le> 1
\<forall>i>p. x i = 0
sum x {..p} = 1
[PROOF STEP]
show "sum x {..q} = 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. 0 \<le> x i \<and> x i \<le> 1
\<forall>i>p. x i = 0
sum x {..p} = 1

goal (1 subgoal):
 1. sum x {..q} = 1
[PROOF STEP]
using sum.mono_neutral_left [of "{..q}" "{..p}" x] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i. 0 \<le> x i \<and> x i \<le> 1
\<forall>i>p. x i = 0
sum x {..p} = 1
\<lbrakk>finite {..q}; {..p} \<subseteq> {..q}; \<forall>i\<in>{..q} - {..p}. x i = 0\<rbrakk> \<Longrightarrow> sum x {..p} = sum x {..q}
p \<le> q

goal (1 subgoal):
 1. sum x {..q} = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum x {..q} = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem msgrel_imp_eq_freenonces: "U \<sim> V \<Longrightarrow> freenonces U = freenonces V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<sim> V \<Longrightarrow> freenonces U = freenonces V
[PROOF STEP]
by (induct set: msgrel) auto


[STATEMENT]
lemma relcompp_exists: "relcompp r r' x y = (\<exists> u . r x u \<and> r' u y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r OO r') x y = (\<exists>u. r x u \<and> r' u y)
[PROOF STEP]
by auto


[STATEMENT]
lemma bool18: "(False = True) = False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (False = True) = False
[PROOF STEP]
by blast


[STATEMENT]
lemma powreal_mult_power: "a > 0 \<Longrightarrow> a pow\<^sub>\<real> (n * x) = (a pow\<^sub>\<real> x) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<real> (real n * x) = (a pow\<^sub>\<real> x) ^ n
[PROOF STEP]
by (metis mult.commute powreal_gt_zero powreal_mult powreal_power_eq)


[STATEMENT]
lemma star_d_omega_top:
  "x\<^sup>\<star> * d(x\<^sup>\<omega>) * top = x\<^sup>\<star> * bot \<squnion> d(x\<^sup>\<omega>) * top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> * d (x\<^sup>\<omega>) * top = x\<^sup>\<star> * bot \<squnion> d (x\<^sup>\<omega>) * top
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x\<^sup>\<star> * d (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * bot \<squnion> d (x\<^sup>\<omega>) * top
 2. x\<^sup>\<star> * bot \<squnion> d (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * d (x\<^sup>\<omega>) * top
[PROOF STEP]
apply (metis le_supI2 mult_domain_top star_mult_omega)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> * bot \<squnion> d (x\<^sup>\<omega>) * top \<le> x\<^sup>\<star> * d (x\<^sup>\<omega>) * top
[PROOF STEP]
by (metis ils.il_inf_associative le_supI mult_left_one mult_left_sub_dist_sup_right mult_right_sub_dist_sup_left star.circ_right_unfold_1 sup_monoid.add_0_right)


[STATEMENT]
lemma  nmi_disj[no_atp]: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists>u\<in> U. u \<le> x) ;
  \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists>u\<in> U. u \<le> x)\<rbrakk> \<Longrightarrow>
  \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists>u\<in> U. u \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. \<not> P1' \<and> P1 x \<longrightarrow> (\<exists>u\<in>U. u \<le> x); \<forall>x. \<not> P2' \<and> P2 x \<longrightarrow> (\<exists>u\<in>U. u \<le> x)\<rbrakk> \<Longrightarrow> \<forall>x. \<not> (P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow> (\<exists>u\<in>U. u \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma C1_differentiable_on_add [simp, derivative_intros]:
  "f C1_differentiable_on S \<Longrightarrow> g C1_differentiable_on S \<Longrightarrow> (\<lambda>x. f x + g x) C1_differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f C1_differentiable_on S; g C1_differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) C1_differentiable_on S
[PROOF STEP]
unfolding C1_differentiable_on_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<forall>x\<in>S. f differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative f (at x)); (\<forall>x\<in>S. g differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative g (at x))\<rbrakk> \<Longrightarrow> (\<forall>x\<in>S. (\<lambda>x. f x + g x) differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative (\<lambda>x. f x + g x) (at x))
[PROOF STEP]
by (auto intro: continuous_intros)


[STATEMENT]
lemma [code abstract]:
  \<open>Word.the_int (of_bl bs :: 'a word) = horner_sum of_bool 2 (take LENGTH('a::len) (rev bs))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Word.the_int (of_bl bs) = horner_sum of_bool 2 (take LENGTH('a) (rev bs))
[PROOF STEP]
apply (simp add: of_bl_eq flip: take_bit_horner_sum_bit_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uint (horner_sum of_bool 2 (rev bs)) = take_bit LENGTH('a) (horner_sum of_bool 2 (rev bs))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>bs. take_bit LENGTH('a) (horner_sum of_bool 2 (rev bs)) = take_bit LENGTH('a) (horner_sum of_bool 2 (rev bs))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_sqrt_wlog: "(\<And>x. x \<ge> 0 \<Longrightarrow> P x (x\<^sup>2)) \<Longrightarrow> P \<bar>x\<bar> (x\<^sup>2)"
  for x::"'a::linordered_idom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. (0::'a) \<le> x \<Longrightarrow> P x (x\<^sup>2)) \<Longrightarrow> P \<bar>x\<bar> (x\<^sup>2)
[PROOF STEP]
by (metis abs_ge_zero power2_abs)


[STATEMENT]
lemma euler_genus_da: "H.euler_genus = G.euler_genus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.euler_genus = G.euler_genus
[PROOF STEP]
unfolding G.euler_genus_def H.euler_genus_def G.euler_char_def H.euler_char_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int (2 * card H.sccs) - int (card H.isolated_verts) - (int (card (verts H)) - int (card (arcs H) div 2) + int (card H.face_cycle_sets))) div 2 = (int (2 * card G.sccs) - int (card G.isolated_verts) - (int (card (verts G)) - int (card (arcs G) div 2) + int (card G.face_cycle_sets))) div 2
[PROOF STEP]
by (simp add: isolated_verts_da verts_H card_arcs_da card_sccs_da card_face_cycle_sets_da)


[STATEMENT]
lemma measurable_pred_countable[measurable (raw)]:
  assumes "countable X"
  shows
    "(\<And>i. i \<in> X \<Longrightarrow> Measurable.pred M (\<lambda>x. P x i)) \<Longrightarrow> Measurable.pred M (\<lambda>x. \<forall>i\<in>X. P x i)"
    "(\<And>i. i \<in> X \<Longrightarrow> Measurable.pred M (\<lambda>x. P x i)) \<Longrightarrow> Measurable.pred M (\<lambda>x. \<exists>i\<in>X. P x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<forall>i\<in>X. P x i)) &&& ((\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<exists>i\<in>X. P x i))
[PROOF STEP]
unfolding pred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>i. i \<in> X \<Longrightarrow> {x \<in> space M. P x i} \<in> sets M) \<Longrightarrow> {x \<in> space M. Ball X (P x)} \<in> sets M) &&& ((\<And>i. i \<in> X \<Longrightarrow> {x \<in> space M. P x i} \<in> sets M) \<Longrightarrow> {x \<in> space M. Bex X (P x)} \<in> sets M)
[PROOF STEP]
by (auto intro!: sets.sets_Collect_countable_All' sets.sets_Collect_countable_Ex' assms)


[STATEMENT]
lemma (in PolynRg) deg_pols_add1:"\<lbrakk>p \<in> carrier R; q \<in> carrier R;
                (deg R S X p) < (deg R S X q)\<rbrakk>  \<Longrightarrow>
                              deg R S X (p \<plusminus> q) = deg R S X q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p < deg R S X q\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) = deg R S X q
[PROOF STEP]
apply (cut_tac ring_is_ag,
       case_tac "p = \<zero>\<^bsub>R\<^esub>", simp add:deg_def aGroup.ag_l_zero,
       case_tac "q = \<zero>\<^bsub>R\<^esub>", simp add:deg_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<in> carrier R; \<zero> \<in> carrier R; an (deg_n R S X p) < - \<infinity>; aGroup R; p \<noteq> \<zero>; q = \<zero>\<rbrakk> \<Longrightarrow> p \<plusminus> \<zero> \<noteq> \<zero> \<longrightarrow> an (deg_n R S X (p \<plusminus> \<zero>)) = - \<infinity>
 2. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p < deg R S X q; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) = deg R S X q
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<in> carrier R; \<zero> \<in> carrier R; an (deg_n R S X p) < - \<infinity>; aGroup R; p \<noteq> \<zero>; q = \<zero>; p \<plusminus> \<zero> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> an (deg_n R S X (p \<plusminus> \<zero>)) = - \<infinity>
 2. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p < deg R S X q; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) = deg R S X q
[PROOF STEP]
apply (simp add:an_def z_neq_minf)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<in> carrier R; \<zero> \<in> carrier R; ant (int (deg_n R S X p)) < - \<infinity>; aGroup R; p \<noteq> \<zero>; q = \<zero>; p \<plusminus> \<zero> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p < deg R S X q; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) = deg R S X q
[PROOF STEP]
apply (fold an_def,
        frule aless_imp_le[of "an (deg_n R S X p)" " - \<infinity>"],
        cut_tac minf_le_any[of "an (deg_n R S X p)"],
        frule ale_antisym[of "an (deg_n R S X p)" "- \<infinity>"], assumption+,
        simp add:an_neq_minf)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p < deg R S X q; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) = deg R S X q
[PROOF STEP]
apply (simp add:deg_def, simp add:aless_nat_less,
       frule less_deg_add_nonzero[of p q], assumption+,
       simp, frule polyn_deg_add1[of p q], assumption+, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma powreal_int:
  assumes "x > 0"
  shows "x pow\<^sub>\<real> i = (if i \<ge> 0 then x ^ nat i else 1 / x ^ nat (-i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
 2. \<not> ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
assume "i < 0"
[PROOF STATE]
proof (state)
this:
i < 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
 2. \<not> ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
have r: "x pow\<^sub>\<real> i = 1 / x  pow\<^sub>\<real> (-i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<real> real_of_int i = 1 / x pow\<^sub>\<real> real_of_int (- i)
[PROOF STEP]
by (simp add: assms powreal_minus divide_inverse)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<real> real_of_int i = 1 / x pow\<^sub>\<real> real_of_int (- i)

goal (2 subgoals):
 1. ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
 2. \<not> ?P \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
using \<open>i < 0\<close> \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
i < 0
0 < x

goal (1 subgoal):
 1. x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
by (simp add: r field_simps powreal_power_eq [symmetric])
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))

goal (1 subgoal):
 1. \<not> i < 0 \<Longrightarrow> x pow\<^sub>\<real> real_of_int i = (if 0 \<le> i then x ^ nat i else 1 / x ^ nat (- i))
[PROOF STEP]
qed (simp add: assms powreal_power_eq[symmetric])


[STATEMENT]
lemma Qp_smult_l_distr:
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "b \<in> carrier Q\<^sub>p"
  assumes "P \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  shows "(a \<oplus> b) \<odot>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> P = (a \<odot>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> P)  \<oplus>\<^bsub> Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> (b \<odot>\<^bsub>Q\<^sub>p[\<X>\<^bsub>n\<^esub>]\<^esub> P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<oplus> b) \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P = a \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> b \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. (a \<oplus> b) \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P = a \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P \<oplus>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> b \<odot>\<^bsub>Q\<^sub>p [\<X>\<^bsub>n\<^esub>]\<^esub> P
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
P \<in> carrier (Pring Q\<^sub>p {..<n})

goal (1 subgoal):
 1. (a \<oplus> b) \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P = a \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P \<oplus>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> b \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P
[PROOF STEP]
using Qp.Pring_smult_l_distr
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
P \<in> carrier (Pring Q\<^sub>p {..<n})
\<lbrakk>?a \<in> carrier Q\<^sub>p; ?b \<in> carrier Q\<^sub>p; ?x \<in> carrier (Pring Q\<^sub>p ?I)\<rbrakk> \<Longrightarrow> (?a \<oplus> ?b) \<odot>\<^bsub>Pring Q\<^sub>p ?I\<^esub> ?x = ?a \<odot>\<^bsub>Pring Q\<^sub>p ?I\<^esub> ?x \<oplus>\<^bsub>Pring Q\<^sub>p ?I\<^esub> ?b \<odot>\<^bsub>Pring Q\<^sub>p ?I\<^esub> ?x

goal (1 subgoal):
 1. (a \<oplus> b) \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P = a \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P \<oplus>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> b \<odot>\<^bsub>Pring Q\<^sub>p {..<n}\<^esub> P
[PROOF STEP]
by blast