[STATEMENT]
lemma eval_pos_if_dominant_term_pos:
  assumes "basis_wf basis" "is_expansion F basis" "trimmed F"
          "fst (dominant_term F) > 0"
  shows   "eventually (\<lambda>x. eval F x > 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
have "eval F \<sim>[at_top] eval_monom (dominant_term F) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval F \<sim>[at_top] eval_monom (dominant_term F) basis
[PROOF STEP]
by (intro dominant_term assms)
[PROOF STATE]
proof (state)
this:
eval F \<sim>[at_top] eval_monom (dominant_term F) basis

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
from trimmed_imp_eventually_sgn[OF assms(1-3)]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))
[PROOF STEP]
have "\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
basis_wf basis
is_expansion F basis
trimmed F
0 < fst (dominant_term F)
[PROOF STEP]
have "eventually (\<lambda>x. eval_monom (dominant_term F) basis x > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
basis_wf basis
is_expansion F basis
trimmed F
0 < fst (dominant_term F)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval_monom (dominant_term F) basis x
[PROOF STEP]
by (intro eval_monom_pos)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < eval_monom (dominant_term F) basis x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))
\<forall>\<^sub>F x in at_top. 0 < eval_monom (dominant_term F) basis x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. sgn (eval F x) = sgn (fst (dominant_term F))
\<forall>\<^sub>F x in at_top. 0 < eval_monom (dominant_term F) basis x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < eval F x
[PROOF STEP]
by eventually_elim (insert assms, simp add: sgn_if split: if_splits)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < eval F x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem newman'':
  assumes wf: "wfP (R\<inverse>\<inverse>)"
  and lc: "\<And>a b c. R a b \<Longrightarrow> R a c \<Longrightarrow>
    \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d"
  shows "\<And>b c. R\<^sup>*\<^sup>* a b \<Longrightarrow> R\<^sup>*\<^sup>* a c \<Longrightarrow>
    \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b c. \<lbrakk>R\<^sup>*\<^sup>* a b; R\<^sup>*\<^sup>* a c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
using wf
[PROOF STATE]
proof (prove)
using this:
wfP R\<inverse>\<inverse>

goal (1 subgoal):
 1. \<And>b c. \<lbrakk>R\<^sup>*\<^sup>* a b; R\<^sup>*\<^sup>* a c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
proof induct
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x b c. \<lbrakk>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d; R\<^sup>*\<^sup>* x b; R\<^sup>*\<^sup>* x c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
case (less x b c)
[PROOF STATE]
proof (state)
this:
\<lbrakk>R\<inverse>\<inverse> ?y x; R\<^sup>*\<^sup>* ?y ?b; R\<^sup>*\<^sup>* ?y ?c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* ?b d \<and> R\<^sup>*\<^sup>* ?c d
R\<^sup>*\<^sup>* x b
R\<^sup>*\<^sup>* x c

goal (1 subgoal):
 1. \<And>x b c. \<lbrakk>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d; R\<^sup>*\<^sup>* x b; R\<^sup>*\<^sup>* x c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
note IH = \<open>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk>
                     \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d\<close>
[PROOF STATE]
proof (state)
this:
\<lbrakk>R\<inverse>\<inverse> ?y x; R\<^sup>*\<^sup>* ?y ?b; R\<^sup>*\<^sup>* ?y ?c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* ?b d \<and> R\<^sup>*\<^sup>* ?c d

goal (1 subgoal):
 1. \<And>x b c. \<lbrakk>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d; R\<^sup>*\<^sup>* x b; R\<^sup>*\<^sup>* x c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d
[PROOF STEP]
by (coherent
      \<open>R\<^sup>*\<^sup>* x c\<close> \<open>R\<^sup>*\<^sup>* x b\<close>
      refl [where 'a='a] sym
      eq_imp_rtranclp
      r_into_rtranclp [of R]
      rtranclp_trans
      lc IH [OF conversepI]
      converse_rtranclpE)
[PROOF STATE]
proof (state)
this:
\<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma canonical_separator_states :
  assumes "Inl (s1,s2) \<in> states (canonical_separator M q1 q2)"
  and     "q1 \<in> states M"
  and     "q2 \<in> states M"
shows "(s1,s2) \<in> states (product (from_FSM M q1) (from_FSM M q2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s1, s2) \<in> FSM.states (Product_FSM.product (from_FSM M q1) (from_FSM M q2))
[PROOF STEP]
using assms(1) reachable_state_is_state
[PROOF STATE]
proof (prove)
using this:
Inl (s1, s2) \<in> FSM.states (canonical_separator M q1 q2)
?q \<in> reachable_states ?M \<Longrightarrow> ?q \<in> FSM.states ?M

goal (1 subgoal):
 1. (s1, s2) \<in> FSM.states (Product_FSM.product (from_FSM M q1) (from_FSM M q2))
[PROOF STEP]
unfolding canonical_separator_simps[OF assms(2,3)]
[PROOF STATE]
proof (prove)
using this:
Inl (s1, s2) \<in> Inl ` FSM.states (Product_FSM.product (from_FSM M q1) (from_FSM M q2)) \<union> {Inr q1, Inr q2}
?q \<in> reachable_states ?M \<Longrightarrow> ?q \<in> FSM.states ?M

goal (1 subgoal):
 1. (s1, s2) \<in> FSM.states (Product_FSM.product (from_FSM M q1) (from_FSM M q2))
[PROOF STEP]
by fastforce


[STATEMENT]
theorem time_closest_pair_rec_bigo:
  "(\<lambda>xs. time (closest_pair_rec_tm xs)) \<in> O[length going_to at_top within { ps. distinct ps \<and> sorted_fst ps }]((\<lambda>n. n * ln n) o length)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
have 0: "\<And>ps. ps \<in> { ps. distinct ps \<and> sorted_fst ps } \<Longrightarrow>
           time (closest_pair_rec_tm ps) \<le> (closest_pair_recurrence o length) ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. distinct ps \<and> sorted_fst ps} \<Longrightarrow> real (time (closest_pair_rec_tm ps)) \<le> (closest_pair_recurrence \<circ> length) ps
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. distinct ps \<and> sorted_fst ps} \<Longrightarrow> real (time (closest_pair_rec_tm ps)) \<le> closest_pair_recurrence (length ps)
[PROOF STEP]
using time_closest_pair_rec_conv_closest_pair_recurrence
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct ?ps; sorted_fst ?ps\<rbrakk> \<Longrightarrow> real (time (closest_pair_rec_tm ?ps)) \<le> closest_pair_recurrence (length ?ps)

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. distinct ps \<and> sorted_fst ps} \<Longrightarrow> real (time (closest_pair_rec_tm ps)) \<le> closest_pair_recurrence (length ps)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?ps \<in> {ps. distinct ps \<and> sorted_fst ps} \<Longrightarrow> real (time (closest_pair_rec_tm ?ps)) \<le> (closest_pair_recurrence \<circ> length) ?ps

goal (1 subgoal):
 1. (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
using bigo_measure_trans[OF 0] bigthetaD1[OF closest_pair_recurrence] of_nat_0_le_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> ?A \<Longrightarrow> x \<in> {ps. distinct ps \<and> sorted_fst ps}; closest_pair_recurrence \<in> O(?f); \<And>x. x \<in> ?A \<Longrightarrow> 0 \<le> real (time (closest_pair_rec_tm x))\<rbrakk> \<Longrightarrow> (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within ?A](?f \<circ> length)
closest_pair_recurrence \<in> O(\<lambda>x. real x * ln (real x))
(0::?'a) \<le> of_nat ?n

goal (1 subgoal):
 1. (\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (time (closest_pair_rec_tm x))) \<in> O[length going_to sequentially within {ps. distinct ps \<and> sorted_fst ps}]((\<lambda>n. real n * ln (real n)) \<circ> length)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diffs_affine_hull_span:
  assumes "a \<in> S"
    shows "(\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)
[PROOF STEP]
have *: "((\<lambda>x. x - a) ` (S - {a})) = ((\<lambda>x. x - a) ` S) - {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (S - {a}) = (\<lambda>x. x - a) ` S - {0::'a}
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x - a) ` (S - {a}) = (\<lambda>x. x - a) ` S - {0::'a}

goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)
[PROOF STEP]
by (auto simp add: algebra_simps affine_hull_span2 [OF assms] *)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x - a) ` (affine hull S) = span ((\<lambda>x. x - a) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tanh_0 [simp]: "tanh 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tanh (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: tanh_def)


[STATEMENT]
lemma fds_converges_iff:
  "fds_converges f s \<longleftrightarrow> (\<lambda>n. fds_nth f n / nat_power n s) sums eval_fds f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_converges f s = (\<lambda>n. fds_nth f n / nat_power n s) sums eval_fds f s
[PROOF STEP]
by (simp add: fds_converges_def sums_iff eval_fds_def)


[STATEMENT]
lemma moebius_mu_squarefree_eq':
  assumes "squarefree n"
  shows   "moebius_mu n = (-1) ^ size (prime_factorization n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
let ?P = "prime_factorization n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
squarefree n
[PROOF STEP]
have [simp]: "n > 0"
[PROOF STATE]
proof (prove)
using this:
squarefree n

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by (auto intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
have "size ?P = sum (count ?P) (set_mset ?P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (prime_factorization n) = sum (count (prime_factorization n)) (prime_factors n)
[PROOF STEP]
by (rule size_multiset_overloaded_eq)
[PROOF STATE]
proof (state)
this:
size (prime_factorization n) = sum (count (prime_factorization n)) (prime_factors n)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size (prime_factorization n) = sum (count (prime_factorization n)) (prime_factors n)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
squarefree n
[PROOF STEP]
have "\<dots> = sum (\<lambda>_. 1) (set_mset ?P)"
[PROOF STATE]
proof (prove)
using this:
squarefree n

goal (1 subgoal):
 1. sum (count (prime_factorization n)) (prime_factors n) = (\<Sum>_\<in>prime_factors n. 1)
[PROOF STEP]
by (intro sum.cong refl, subst count_prime_factorization_prime)
       (auto simp: moebius_mu_eq_zero_iff squarefree_factorial_semiring')
[PROOF STATE]
proof (state)
this:
sum (count (prime_factorization n)) (prime_factors n) = (\<Sum>_\<in>prime_factors n. 1)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (count (prime_factorization n)) (prime_factors n) = (\<Sum>_\<in>prime_factors n. 1)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
have "\<dots> = card (set_mset ?P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>prime_factors n. 1) = card (prime_factors n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>prime_factors n. 1) = card (prime_factors n)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size (prime_factorization n) = card (prime_factors n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size (prime_factorization n) = card (prime_factors n)

goal (1 subgoal):
 1. moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)
[PROOF STEP]
by (simp add: moebius_mu_squarefree_eq[OF assms])
[PROOF STATE]
proof (state)
this:
moebius_mu n = (- (1::'a)) ^ size (prime_factorization n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcs_ends_symmetric:
  assumes "symmetric G"
  shows "(u,v) \<in> arcs_ends G \<Longrightarrow> (v,u) \<in> arcs_ends G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<in> arcs_ends G \<Longrightarrow> (v, u) \<in> arcs_ends G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
symmetric G

goal (1 subgoal):
 1. (u, v) \<in> arcs_ends G \<Longrightarrow> (v, u) \<in> arcs_ends G
[PROOF STEP]
unfolding symmetric_def sym_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (x, y) \<in> arcs_ends G \<longrightarrow> (y, x) \<in> arcs_ends G

goal (1 subgoal):
 1. (u, v) \<in> arcs_ends G \<Longrightarrow> (v, u) \<in> arcs_ends G
[PROOF STEP]
by auto


[STATEMENT]
lemma fls_integral_X_power_char0:
  "fls_integral (fls_X ^ n :: 'a :: {ring_char_0,inverse} fls) =
    inverse (of_nat (Suc n)) * fls_X ^ Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
have "(of_nat (Suc n) :: 'a) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (Suc n) \<noteq> (0::'a)
[PROOF STEP]
by (rule of_nat_neq_0)
[PROOF STATE]
proof (state)
this:
of_nat (Suc n) \<noteq> (0::'a)

goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
hence "fls_const (inverse (of_nat (Suc n) :: 'a)) = inverse (fls_const (of_nat (Suc n)))"
[PROOF STATE]
proof (prove)
using this:
of_nat (Suc n) \<noteq> (0::'a)

goal (1 subgoal):
 1. fls_const (inverse (of_nat (Suc n))) = inverse (fls_const (of_nat (Suc n)))
[PROOF STEP]
by (simp add: fls_inverse_const)
[PROOF STATE]
proof (state)
this:
fls_const (inverse (of_nat (Suc n))) = inverse (fls_const (of_nat (Suc n)))

goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fls_const (inverse (of_nat (Suc n))) = inverse (fls_const (of_nat (Suc n)))

goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
have
    "fls_integral ((fls_X::'a fls) ^ n) = fls_const (inverse (of_nat (Suc n))) * fls_X ^ Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = fls_const (inverse (of_nat (Suc n))) * fls_X ^ Suc n
[PROOF STEP]
by (rule fls_integral_X_power)
[PROOF STATE]
proof (state)
this:
fls_integral (fls_X ^ n) = fls_const (inverse (of_nat (Suc n))) * fls_X ^ Suc n

goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fls_const (inverse (of_nat (Suc n))) = inverse (fls_const (of_nat (Suc n)))
fls_integral (fls_X ^ n) = fls_const (inverse (of_nat (Suc n))) * fls_X ^ Suc n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fls_const (inverse (of_nat (Suc n))) = inverse (fls_const (of_nat (Suc n)))
fls_integral (fls_X ^ n) = fls_const (inverse (of_nat (Suc n))) * fls_X ^ Suc n

goal (1 subgoal):
 1. fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n
[PROOF STEP]
by (simp add: fls_of_nat)
[PROOF STATE]
proof (state)
this:
fls_integral (fls_X ^ n) = inverse (of_nat (Suc n)) * fls_X ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lehmers_weak_theorem:
  assumes "2 \<le> p"
  assumes min_cong1: "\<And>x. 0 < x \<Longrightarrow> x < p - 1 \<Longrightarrow> [a ^ x \<noteq> 1] (mod p)"
  assumes cong1: "[a ^ (p - 1) = 1] (mod p)"
  shows "prime p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p
[PROOF STEP]
proof (rule totient_imp_prime)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
from \<open>2 \<le> p\<close> cong1
[PROOF STATE]
proof (chain)
picking this:
2 \<le> p
[a ^ (p - 1) = 1] (mod p)
[PROOF STEP]
have "coprime a p"
[PROOF STATE]
proof (prove)
using this:
2 \<le> p
[a ^ (p - 1) = 1] (mod p)

goal (1 subgoal):
 1. coprime a p
[PROOF STEP]
by (intro mod_1_coprime_nat[of "p - 1"]) auto
[PROOF STATE]
proof (state)
this:
coprime a p

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime a p
[PROOF STEP]
have "[a ^ totient p = 1] (mod p)"
[PROOF STATE]
proof (prove)
using this:
coprime a p

goal (1 subgoal):
 1. [a ^ totient p = 1] (mod p)
[PROOF STEP]
by (intro euler_theorem) auto
[PROOF STATE]
proof (state)
this:
[a ^ totient p = 1] (mod p)

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[a ^ totient p = 1] (mod p)
[PROOF STEP]
have "totient p \<ge> p - 1 \<or> totient p = 0"
[PROOF STATE]
proof (prove)
using this:
[a ^ totient p = 1] (mod p)

goal (1 subgoal):
 1. p - 1 \<le> totient p \<or> totient p = 0
[PROOF STEP]
using min_cong1[of "totient p"]
[PROOF STATE]
proof (prove)
using this:
[a ^ totient p = 1] (mod p)
\<lbrakk>0 < totient p; totient p < p - 1\<rbrakk> \<Longrightarrow> [a ^ totient p \<noteq> 1] (mod p)

goal (1 subgoal):
 1. p - 1 \<le> totient p \<or> totient p = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
p - 1 \<le> totient p \<or> totient p = 0

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p - 1 \<le> totient p \<or> totient p = 0

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
have "totient p > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < totient p
[PROOF STEP]
using \<open>2 \<le> p\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> p

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

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < totient p

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
from \<open>p \<ge> 2\<close>
[PROOF STATE]
proof (chain)
picking this:
2 \<le> p
[PROOF STEP]
have "totient p < p"
[PROOF STATE]
proof (prove)
using this:
2 \<le> p

goal (1 subgoal):
 1. totient p < p
[PROOF STEP]
by (intro totient_less) auto
[PROOF STATE]
proof (state)
this:
totient p < p

goal (2 subgoals):
 1. totient p = p - 1
 2. 0 < p
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p - 1 \<le> totient p \<or> totient p = 0
0 < totient p
totient p < p
[PROOF STEP]
show "totient p = p - 1"
[PROOF STATE]
proof (prove)
using this:
p - 1 \<le> totient p \<or> totient p = 0
0 < totient p
totient p < p

goal (1 subgoal):
 1. totient p = p - 1
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
totient p = p - 1

goal (1 subgoal):
 1. 0 < p
[PROOF STEP]
qed (insert \<open>p \<ge> 2\<close>, auto)


[STATEMENT]
lemma finite_nonempty_ex_succ_imp_cyclic:
  assumes
    fin: "finite A" and
    nemp: "A \<noteq> {}" and
    ex_y: "\<forall>x \<in> A. \<exists>y \<in> A. (y, x) \<in> r"
  shows "\<not> acyclic r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
let ?R = "{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
have R_sub_r: "?R \<subseteq> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> r

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
have "?R \<subseteq> A \<times> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> A \<times> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> A \<times> A

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
hence fin_R: "finite ?R"
[PROOF STATE]
proof (prove)
using this:
{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> A \<times> A

goal (1 subgoal):
 1. finite {(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}
[PROOF STEP]
by (auto intro: fin dest!: infinite_super)
[PROOF STATE]
proof (state)
this:
finite {(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r}

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
have "\<not> acyclic ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> acyclicP (\<lambda>x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r)
[PROOF STEP]
by (rule notI, drule finite_acyclic_wf[OF fin_R], unfold wf_eq_minimal, drule spec[of _ A],
      use ex_y nemp in blast)
[PROOF STATE]
proof (state)
this:
\<not> acyclicP (\<lambda>x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r)

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> acyclicP (\<lambda>x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r)

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
using R_sub_r acyclic_subset
[PROOF STATE]
proof (prove)
using this:
\<not> acyclicP (\<lambda>x y. x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r)
{(x, y). x \<in> A \<and> y \<in> A \<and> (x, y) \<in> r} \<subseteq> r
\<lbrakk>acyclic ?s; ?r \<subseteq> ?s\<rbrakk> \<Longrightarrow> acyclic ?r

goal (1 subgoal):
 1. \<not> acyclic r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> acyclic r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma indets_monomial_single:
  assumes "c \<noteq> 0" and "k \<noteq> 0"
  shows "indets (monomial c (Poly_Mapping.single v k)) = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indets (monomial c (monomial k v)) = {v}
[PROOF STEP]
proof (rule, fact indets_monomial_single_subset, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<in> indets (monomial c (monomial k v))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
k \<noteq> 0
[PROOF STEP]
show "v \<in> indets (monomial c (monomial k v))"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
k \<noteq> 0

goal (1 subgoal):
 1. v \<in> indets (monomial c (monomial k v))
[PROOF STEP]
by (simp add: indets_def)
[PROOF STATE]
proof (state)
this:
v \<in> indets (monomial c (monomial k v))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in carrier) adh_imp_closure:
  assumes xpoint: "x \<in> carrier"
  and   adh: "x adh A"
  shows "x \<in> closure A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
assume notclosure: "x \<notin> closure A"
[PROOF STATE]
proof (state)
this:
x \<notin> closure A

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> closure A
[PROOF STEP]
obtain C
    where closed: "C closed"
    and   asubc:  "A \<subseteq> C"
    and   xnotinc: "x \<notin> C"
[PROOF STATE]
proof (prove)
using this:
x \<notin> closure A

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C closed; A \<subseteq> C; x \<notin> C\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: clsr_def)
[PROOF STATE]
proof (state)
this:
C closed
A \<subseteq> C
x \<notin> C

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
from closed
[PROOF STATE]
proof (chain)
picking this:
C closed
[PROOF STEP]
have "carrier - C open"
[PROOF STATE]
proof (prove)
using this:
C closed

goal (1 subgoal):
 1. carrier - C open
[PROOF STEP]
by (rule closedE)
[PROOF STATE]
proof (state)
this:
carrier - C open

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
carrier - C open

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
from xpoint xnotinc
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier
x \<notin> C
[PROOF STEP]
have "x \<in> carrier - C"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier
x \<notin> C

goal (1 subgoal):
 1. x \<in> carrier - C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> carrier - C

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
carrier - C open
x \<in> carrier - C
[PROOF STEP]
have "carrier - C \<in> nhds x"
[PROOF STATE]
proof (prove)
using this:
carrier - C open
x \<in> carrier - C

goal (1 subgoal):
 1. carrier - C \<in> nhds x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
carrier - C \<in> nhds x

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
with adh
[PROOF STATE]
proof (chain)
picking this:
x adh A
carrier - C \<in> nhds x
[PROOF STEP]
have "(carrier - C) \<inter> A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
x adh A
carrier - C \<in> nhds x

goal (1 subgoal):
 1. (carrier - C) \<inter> A \<noteq> {}
[PROOF STEP]
by (auto elim: adhCE)
[PROOF STATE]
proof (state)
this:
(carrier - C) \<inter> A \<noteq> {}

goal (1 subgoal):
 1. x \<notin> closure A \<Longrightarrow> False
[PROOF STEP]
with asubc
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> C
(carrier - C) \<inter> A \<noteq> {}
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> C
(carrier - C) \<inter> A \<noteq> {}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_inc_gt0:
  assumes "sum_list u > 0" and "length y = length u"
  shows "sum_list (inc y i u) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sum_list (inc y i u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < sum_list u
length y = length u

goal (1 subgoal):
 1. 0 < sum_list (inc y i u)
[PROOF STEP]
proof (induct y i u rule: inc.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y i u. \<lbrakk>\<lbrakk>i < length y; \<not> u ! i < y ! i; 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y (Suc i) u); 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y i u)
[PROOF STEP]
case (1 y i u)
[PROOF STATE]
proof (state)
this:
\<lbrakk>i < length y; \<not> u ! i < y ! i; 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y (Suc i) u)
0 < sum_list u
length y = length u

goal (1 subgoal):
 1. \<And>y i u. \<lbrakk>\<lbrakk>i < length y; \<not> u ! i < y ! i; 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y (Suc i) u); 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y i u)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i < length y; \<not> u ! i < y ! i; 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y (Suc i) u)
0 < sum_list u
length y = length u
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < length y; \<not> u ! i < y ! i; 0 < sum_list u; length y = length u\<rbrakk> \<Longrightarrow> 0 < sum_list (inc y (Suc i) u)
0 < sum_list u
length y = length u

goal (1 subgoal):
 1. 0 < sum_list (inc y i u)
[PROOF STEP]
by (auto simp add: inc.simps)
      (meson Suc_neq_Zero gr_zeroI set_update_memI sum_list_eq_0_iff)
[PROOF STATE]
proof (state)
this:
0 < sum_list (inc y i u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in wf_digraph) sp_non_neg_if_w_non_neg:
  assumes w_non_neg: "\<forall>e \<in> arcs G. w e \<ge> 0"
  shows "\<mu> w u v \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<mu> w u v
[PROOF STEP]
proof(cases "u \<rightarrow>\<^sup>*\<^bsub>G\<^esub> v")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
 2. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u \<rightarrow>\<^sup>* v

goal (2 subgoals):
 1. u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
 2. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
have *: "awalk u p v \<Longrightarrow> awalk_cost w p \<ge> 0" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. awalk u p v \<Longrightarrow> 0 \<le> awalk_cost w p
[PROOF STEP]
by (simp add: pos_cost_pos_awalk_cost w_non_neg)
[PROOF STATE]
proof (state)
this:
awalk u ?p2 v \<Longrightarrow> 0 \<le> awalk_cost w ?p2

goal (2 subgoals):
 1. u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
 2. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
awalk u ?p2 v \<Longrightarrow> 0 \<le> awalk_cost w ?p2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
awalk u ?p2 v \<Longrightarrow> 0 \<le> awalk_cost w ?p2

goal (1 subgoal):
 1. 0 \<le> \<mu> w u v
[PROOF STEP]
unfolding \<mu>_def
[PROOF STATE]
proof (prove)
using this:
awalk u ?p2 v \<Longrightarrow> 0 \<le> awalk_cost w ?p2

goal (1 subgoal):
 1. 0 \<le> (INF p\<in>{p. awalk u p v}. ereal (awalk_cost w p))
[PROOF STEP]
by (metis (mono_tags, lifting) INF_less_iff ereal_less_eq(5) mem_Collect_eq not_less)
[PROOF STATE]
proof (state)
this:
0 \<le> \<mu> w u v

goal (1 subgoal):
 1. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> u \<rightarrow>\<^sup>* v

goal (1 subgoal):
 1. \<not> u \<rightarrow>\<^sup>* v \<Longrightarrow> 0 \<le> \<mu> w u v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> u \<rightarrow>\<^sup>* v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> u \<rightarrow>\<^sup>* v

goal (1 subgoal):
 1. 0 \<le> \<mu> w u v
[PROOF STEP]
by (simp add: shortest_path_inf)
[PROOF STATE]
proof (state)
this:
0 \<le> \<mu> w u v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma limsup_subseq_mono:
  fixes X :: "nat \<Rightarrow> 'a :: complete_linorder"
  assumes "strict_mono r"
  shows "limsup (X \<circ> r) \<le> limsup X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (X \<circ> r) \<le> limsup X
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. limsup (X \<circ> r) \<le> limsup X
[PROOF STEP]
have "(SUP m\<in>{n..}. (X \<circ> r) m) \<le> (SUP m\<in>{n..}. X m)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup ((X \<circ> r) ` {n..}) \<le> Sup (X ` {n..})
[PROOF STEP]
proof (safe intro!: SUP_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. n \<le> m \<Longrightarrow> \<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. n \<le> m \<Longrightarrow> \<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma
[PROOF STEP]
assume "n \<le> m"
[PROOF STATE]
proof (state)
this:
n \<le> m

goal (1 subgoal):
 1. \<And>m. n \<le> m \<Longrightarrow> \<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
[PROOF STEP]
show "\<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma"
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. \<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma
[PROOF STEP]
using seq_suble[OF \<open>strict_mono r\<close>, of m]
[PROOF STATE]
proof (prove)
using this:
n \<le> m
m \<le> r m

goal (1 subgoal):
 1. \<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma
[PROOF STEP]
by (intro bexI[of _ "r m"]) auto
[PROOF STATE]
proof (state)
this:
\<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup ((X \<circ> r) ` {?n..}) \<le> Sup (X ` {?n..})

goal (1 subgoal):
 1. limsup (X \<circ> r) \<le> limsup X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup ((X \<circ> r) ` {?n..}) \<le> Sup (X ` {?n..})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sup ((X \<circ> r) ` {?n..}) \<le> Sup (X ` {?n..})

goal (1 subgoal):
 1. limsup (X \<circ> r) \<le> limsup X
[PROOF STEP]
by (auto intro!: INF_mono simp: limsup_INF_SUP comp_def)
[PROOF STATE]
proof (state)
this:
limsup (X \<circ> r) \<le> limsup X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Meet_Un: "\<Sqinter>(A \<union> B) = \<Sqinter>A \<sqinter> \<Sqinter>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>(A \<union> B) = \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> A \<union> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> A \<union> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
assume "a \<in> A \<union> B"
[PROOF STATE]
proof (state)
this:
a \<in> A \<union> B

goal (2 subgoals):
 1. \<And>a. a \<in> A \<union> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A \<union> B
[PROOF STEP]
show "\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<union> B

goal (1 subgoal):
 1. \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
assume a: "a \<in> A"
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
have "\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>A

goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>A

goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
[PROOF STEP]
have "\<dots> \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> A

goal (1 subgoal):
 1. \<Sqinter>A \<sqsubseteq> a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqsubseteq> a

goal (2 subgoals):
 1. a \<in> A \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
 2. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a

goal (1 subgoal):
 1. \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a

goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
assume a: "a \<in> B"
[PROOF STATE]
proof (state)
this:
a \<in> B

goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
have "\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>B

goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> \<Sqinter>B

goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
a \<in> B
[PROOF STEP]
have "\<dots> \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> B

goal (1 subgoal):
 1. \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Sqinter>B \<sqsubseteq> a

goal (1 subgoal):
 1. a \<in> B \<Longrightarrow> \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a

goal (1 subgoal):
 1. \<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Sqinter>A \<sqinter> \<Sqinter>B \<sqsubseteq> a

goal (1 subgoal):
 1. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
assume b: "\<forall>a \<in> A \<union> B. b \<sqsubseteq> a"
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>A \<union> B. b \<sqsubseteq> a

goal (1 subgoal):
 1. \<And>b. \<forall>a\<in>A \<union> B. b \<sqsubseteq> a \<Longrightarrow> b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
show "b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<sqsubseteq> \<Sqinter>A
 2. b \<sqsubseteq> \<Sqinter>B
[PROOF STEP]
show "b \<sqsubseteq> \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<sqsubseteq> \<Sqinter>A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
assume "a \<in> A"
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
[PROOF STEP]
have "a \<in>  A \<union> B"
[PROOF STATE]
proof (prove)
using this:
a \<in> A

goal (1 subgoal):
 1. a \<in> A \<union> B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a \<in> A \<union> B

goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
with b
[PROOF STATE]
proof (chain)
picking this:
\<forall>a\<in>A \<union> B. b \<sqsubseteq> a
a \<in> A \<union> B
[PROOF STEP]
show "b \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>A \<union> B. b \<sqsubseteq> a
a \<in> A \<union> B

goal (1 subgoal):
 1. b \<sqsubseteq> a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
b \<sqsubseteq> a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<sqsubseteq> \<Sqinter>A

goal (1 subgoal):
 1. b \<sqsubseteq> \<Sqinter>B
[PROOF STEP]
show "b \<sqsubseteq> \<Sqinter>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<sqsubseteq> \<Sqinter>B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
assume "a \<in> B"
[PROOF STATE]
proof (state)
this:
a \<in> B

goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> B
[PROOF STEP]
have "a \<in>  A \<union> B"
[PROOF STATE]
proof (prove)
using this:
a \<in> B

goal (1 subgoal):
 1. a \<in> A \<union> B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a \<in> A \<union> B

goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> b \<sqsubseteq> a
[PROOF STEP]
with b
[PROOF STATE]
proof (chain)
picking this:
\<forall>a\<in>A \<union> B. b \<sqsubseteq> a
a \<in> A \<union> B
[PROOF STEP]
show "b \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>A \<union> B. b \<sqsubseteq> a
a \<in> A \<union> B

goal (1 subgoal):
 1. b \<sqsubseteq> a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
b \<sqsubseteq> a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<sqsubseteq> \<Sqinter>B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<sqsubseteq> \<Sqinter>A \<sqinter> \<Sqinter>B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_mult_pos_neg:
  assumes "0 < x" and "0 < r" and "s < 0"
  shows "x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
have "x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s
[PROOF STEP]
using powrat_mult_pos assms neg_0_less_iff_less
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; 0 < ?r; 0 < ?s\<rbrakk> \<Longrightarrow> ?x pow\<^sub>\<rat> (?r * ?s) = (?x pow\<^sub>\<rat> ?r) pow\<^sub>\<rat> ?s
0 < x
0 < r
s < 0
((0::?'a) < - ?a) = (?a < (0::?'a))

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (r * - s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> - s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
by (simp add: powrat_minus)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_comm:
  fixes A B :: "'a::comm_ring mat"
  assumes A: "A \<in> carrier_mat n n" and B: "B \<in> carrier_mat n n"
  shows "trace (A * B) = trace (B * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (A * B) = trace (B * A)
[PROOF STEP]
proof (simp add: trace_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
have "(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i,j) * B $$ (j,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i))
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>x. x \<in> {0..<n} \<Longrightarrow> (A * B) $$ (x, x) = (\<Sum>j = 0..<n. A $$ (x, j) * B $$ (j, x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>x. x \<in> {0..<n} \<Longrightarrow> (A * B) $$ (x, x) = (\<Sum>j = 0..<n. A $$ (x, j) * B $$ (j, x))
[PROOF STEP]
by (auto simp add: scalar_prod_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i,j) * B $$ (j,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i))
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. \<Sum>j = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0..<n. col A j \<bullet> row B j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. col A j \<bullet> row B j)
[PROOF STEP]
by (metis (no_types, lifting) A B atLeastLessThan_iff carrier_matD index_col index_row scalar_prod_def sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. col A j \<bullet> row B j)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<n. A $$ (i, j) * B $$ (j, i)) = (\<Sum>j = 0..<n. col A j \<bullet> row B j)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0..<n. row B j \<bullet> col A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. col A j \<bullet> row B j) = (\<Sum>j = 0..<n. row B j \<bullet> col A j)
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>x. x \<in> {0..<n} \<Longrightarrow> col A x \<bullet> row B x = row B x \<bullet> col A x
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x < n \<Longrightarrow> col A x \<bullet> row B x = row B x \<bullet> col A x
[PROOF STEP]
apply (subst comm_scalar_prod[where n=n])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x < n \<Longrightarrow> col A x \<in> carrier_vec n
 2. \<And>x. x < n \<Longrightarrow> row B x \<in> carrier_vec n
 3. \<And>x. x < n \<Longrightarrow> row B x \<bullet> col A x = row B x \<bullet> col A x
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x < n \<Longrightarrow> col A x \<in> carrier_vec n
 2. \<And>x. x < n \<Longrightarrow> row B x \<in> carrier_vec n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (2 subgoals):
 1. \<And>x. x < n \<Longrightarrow> col A x \<in> carrier_vec n
 2. \<And>x. x < n \<Longrightarrow> row B x \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. col A j \<bullet> row B j) = (\<Sum>j = 0..<n. row B j \<bullet> col A j)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. col A j \<bullet> row B j) = (\<Sum>j = 0..<n. row B j \<bullet> col A j)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0..<n. (B * A) $$ (j, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. row B j \<bullet> col A j) = (\<Sum>j = 0..<n. (B * A) $$ (j, j))
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>x. x \<in> {0..<n} \<Longrightarrow> row B x \<bullet> col A x = (B * A) $$ (x, x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (2 subgoals):
 1. {0..<n} = {0..<n}
 2. \<And>x. x \<in> {0..<n} \<Longrightarrow> row B x \<bullet> col A x = (B * A) $$ (x, x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. row B j \<bullet> col A j) = (\<Sum>j = 0..<n. (B * A) $$ (j, j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>j = 0..<n. (B * A) $$ (j, j))
[PROOF STEP]
show "(\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>j = 0..<n. (B * A) $$ (j, j))

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
using A B
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. (A * B) $$ (i, i)) = (\<Sum>j = 0..<n. (B * A) $$ (j, j))
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_row A. (A * B) $$ (i, i)) = (\<Sum>i = 0..<dim_row B. (B * A) $$ (i, i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_filter_conv_card:
  "length(filter p xs) = card{i. i < length xs \<and> p(xs!i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)}
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (filter p []) = card {i. i < length [] \<and> p ([] ! i)}
 2. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. length (filter p []) = card {i. i < length [] \<and> p ([] ! i)}
 2. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter p []) = card {i. i < length [] \<and> p ([] ! i)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (filter p []) = card {i. i < length [] \<and> p ([] ! i)}

goal (1 subgoal):
 1. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
let ?S = "{i. i < length xs \<and> p(xs!i)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
have fin: "finite ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i < length xs \<and> p (xs ! i)}
[PROOF STEP]
by(fast intro: bounded_nat_set_is_finite)
[PROOF STATE]
proof (state)
this:
finite {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. \<And>a xs. length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)} \<Longrightarrow> length (filter p (a # xs)) = card {i. i < length (a # xs) \<and> p ((a # xs) ! i)}
[PROOF STEP]
show ?case (is "?l = card ?S'")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
assume "p x"
[PROOF STATE]
proof (state)
this:
p x

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
hence eq: "?S' = insert 0 (Suc ` ?S)"
[PROOF STATE]
proof (prove)
using this:
p x

goal (1 subgoal):
 1. {i. i < length (x # xs) \<and> p ((x # xs) ! i)} = insert 0 (Suc ` {i. i < length xs \<and> p (xs ! i)})
[PROOF STEP]
by(auto simp: image_def split:nat.split dest:gr0_implies_Suc)
[PROOF STATE]
proof (state)
this:
{i. i < length (x # xs) \<and> p ((x # xs) ! i)} = insert 0 (Suc ` {i. i < length xs \<and> p (xs ! i)})

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "length (filter p (x # xs)) = Suc(card ?S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter p (x # xs)) = Suc (card {i. i < length xs \<and> p (xs ! i)})
[PROOF STEP]
using Cons \<open>p x\<close>
[PROOF STATE]
proof (prove)
using this:
length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)}
p x

goal (1 subgoal):
 1. length (filter p (x # xs)) = Suc (card {i. i < length xs \<and> p (xs ! i)})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = Suc (card {i. i < length xs \<and> p (xs ! i)})

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = Suc (card {i. i < length xs \<and> p (xs ! i)})

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "\<dots> = Suc(card(Suc ` ?S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card {i. i < length xs \<and> p (xs ! i)}) = Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)}))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. Suc (card {i. i < length xs \<and> p (xs ! i)}) = Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)}))
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
Suc (card {i. i < length xs \<and> p (xs ! i)}) = Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)}))

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (card {i. i < length xs \<and> p (xs ! i)}) = Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)}))

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "\<dots> = card ?S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)})) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
using eq fin
[PROOF STATE]
proof (prove)
using this:
{i. i < length (x # xs) \<and> p ((x # xs) ! i)} = insert 0 (Suc ` {i. i < length xs \<and> p (xs ! i)})
finite {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)})) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
by (simp add:card_insert_if)
[PROOF STATE]
proof (state)
this:
Suc (card (Suc ` {i. i < length xs \<and> p (xs ! i)})) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal (2 subgoals):
 1. ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
 2. \<not> ?P \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal (1 subgoal):
 1. length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
assume "\<not> p x"
[PROOF STATE]
proof (state)
this:
\<not> p x

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
hence eq: "?S' = Suc ` ?S"
[PROOF STATE]
proof (prove)
using this:
\<not> p x

goal (1 subgoal):
 1. {i. i < length (x # xs) \<and> p ((x # xs) ! i)} = Suc ` {i. i < length xs \<and> p (xs ! i)}
[PROOF STEP]
by(auto simp add: image_def split:nat.split elim:lessE)
[PROOF STATE]
proof (state)
this:
{i. i < length (x # xs) \<and> p ((x # xs) ! i)} = Suc ` {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "length (filter p (x # xs)) = card ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter p (x # xs)) = card {i. i < length xs \<and> p (xs ! i)}
[PROOF STEP]
using Cons \<open>\<not> p x\<close>
[PROOF STATE]
proof (prove)
using this:
length (filter p xs) = card {i. i < length xs \<and> p (xs ! i)}
\<not> p x

goal (1 subgoal):
 1. length (filter p (x # xs)) = card {i. i < length xs \<and> p (xs ! i)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = card {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = card {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "\<dots> = card(Suc ` ?S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < length xs \<and> p (xs ! i)} = card (Suc ` {i. i < length xs \<and> p (xs ! i)})
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. card {i. i < length xs \<and> p (xs ! i)} = card (Suc ` {i. i < length xs \<and> p (xs ! i)})
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card {i. i < length xs \<and> p (xs ! i)} = card (Suc ` {i. i < length xs \<and> p (xs ! i)})

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {i. i < length xs \<and> p (xs ! i)} = card (Suc ` {i. i < length xs \<and> p (xs ! i)})

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
have "\<dots> = card ?S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (Suc ` {i. i < length xs \<and> p (xs ! i)}) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
using eq fin
[PROOF STATE]
proof (prove)
using this:
{i. i < length (x # xs) \<and> p ((x # xs) ! i)} = Suc ` {i. i < length xs \<and> p (xs ! i)}
finite {i. i < length xs \<and> p (xs ! i)}

goal (1 subgoal):
 1. card (Suc ` {i. i < length xs \<and> p (xs ! i)}) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
by (simp add:card_insert_if)
[PROOF STATE]
proof (state)
this:
card (Suc ` {i. i < length xs \<and> p (xs ! i)}) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal (1 subgoal):
 1. \<not> p x \<Longrightarrow> length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal (1 subgoal):
 1. length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (filter p (x # xs)) = card {i. i < length (x # xs) \<and> p ((x # xs) ! i)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma v_minus_p_orthogonal_complement:
  fixes X::"'a::{euclidean_space} set"
  assumes subspace_S: "subspace S"
  and ind_X: "independent X"
  and X: "X \<subseteq> S"
  and span_X: "S \<subseteq> span X"
  and o: "pairwise orthogonal X"
  shows "(v - proj_onto v X) \<in> orthogonal_complement S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v - proj_onto v X \<in> orthogonal_complement S
[PROOF STEP]
unfolding in_orthogonal_complement_basis[OF subspace_S ind_X X span_X]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>X. orthogonal a (v - proj_onto v X)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> X \<Longrightarrow> orthogonal a (v - proj_onto v X)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> X \<Longrightarrow> orthogonal a (v - proj_onto v X)
[PROOF STEP]
assume a: "a \<in> X"
[PROOF STATE]
proof (state)
this:
a \<in> X

goal (1 subgoal):
 1. \<And>a. a \<in> X \<Longrightarrow> orthogonal a (v - proj_onto v X)
[PROOF STEP]
let ?p="proj_onto v X"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> X \<Longrightarrow> orthogonal a (v - proj_onto v X)
[PROOF STEP]
show "orthogonal a (v - ?p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal a (v - proj_onto v X)
[PROOF STEP]
unfolding orthogonal_commute[of a "v-?p"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal (v - proj_onto v X) a
[PROOF STEP]
by (rule orthogonal_proj_set[OF a _ o])
       (simp add: independent_bound_general[OF ind_X])
[PROOF STATE]
proof (state)
this:
orthogonal a (v - proj_onto v X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_mult_const_right_iff:
  fixes c :: "'a::{field,topological_semigroup_mult}"
  assumes "c \<noteq> 0"
  shows "convergent (\<lambda>n. f n * c) \<longleftrightarrow> convergent f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. f n * c) = convergent f
[PROOF STEP]
using convergent_mult_const_iff[OF assms, of f]
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. c * f n) = convergent f

goal (1 subgoal):
 1. convergent (\<lambda>n. f n * c) = convergent f
[PROOF STEP]
by (simp add: mult_ac)


[STATEMENT]
lemma linear_order_from_list_position_refl:
  "refl_on (set xs) (set (linear_order_from_list_position xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl_on (set xs) (set (linear_order_from_list_position xs))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (linear_order_from_list_position xs) \<subseteq> set xs \<times> set xs
 2. \<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (linear_order_from_list_position xs)
[PROOF STEP]
show "set (linear_order_from_list_position xs) \<subseteq> set xs \<times> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (linear_order_from_list_position xs) \<subseteq> set xs \<times> set xs
[PROOF STEP]
unfolding linear_order_from_list_position_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>x. (x, x)) xs) \<union> set (non_sym_dist_pairs xs) \<subseteq> set xs \<times> set xs
[PROOF STEP]
using non_sym_dist_pairs_subset[of xs]
[PROOF STATE]
proof (prove)
using this:
set (non_sym_dist_pairs xs) \<subseteq> set xs \<times> set xs

goal (1 subgoal):
 1. set (map (\<lambda>x. (x, x)) xs) \<union> set (non_sym_dist_pairs xs) \<subseteq> set xs \<times> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (linear_order_from_list_position xs) \<subseteq> set xs \<times> set xs

goal (1 subgoal):
 1. \<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (linear_order_from_list_position xs)
[PROOF STEP]
show "\<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (linear_order_from_list_position xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (linear_order_from_list_position xs)
[PROOF STEP]
unfolding linear_order_from_list_position_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (map (\<lambda>x. (x, x)) xs) \<union> set (non_sym_dist_pairs xs)
[PROOF STEP]
using non_sym_dist_pairs_subset[of xs]
[PROOF STATE]
proof (prove)
using this:
set (non_sym_dist_pairs xs) \<subseteq> set xs \<times> set xs

goal (1 subgoal):
 1. \<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> set (map (\<lambda>x. (x, x)) xs) \<union> set (non_sym_dist_pairs xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> set xs \<Longrightarrow> (?x, ?x) \<in> set (linear_order_from_list_position xs)

goal:
No subgoals!
[PROOF STEP]
qed