[STATEMENT]
lemma R_state_repetition_distribution :
  assumes "OFSM M"
  and     "Suc (card (nodes M) * m) \<le> length xs"
  and     "vs@xs \<in> L M"
shows "\<exists> q \<in> nodes M . card (R M q vs xs) > m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q\<in>nodes M. m < card (R M q vs xs)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))
[PROOF STEP]
have "\<forall> q \<in> nodes M . card (R M q vs xs) \<le> m"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))

goal (1 subgoal):
 1. \<forall>q\<in>nodes M. card (R M q vs xs) \<le> m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m
[PROOF STEP]
have "sum (\<lambda> q . card (R M q vs xs)) (nodes M) \<le> sum (\<lambda> q . m) (nodes M)"
[PROOF STATE]
proof (prove)
using this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
[PROOF STEP]
by (meson sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
have "sum (\<lambda> q . m) (nodes M) \<le> card (nodes M) * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
Suc (|M| * m) \<le> length xs

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. m) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
(\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
have "sum (\<lambda> q . card (R M q vs xs)) (nodes M) \<le> card (nodes M) * m"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
(\<Sum>q\<in>nodes M. m) \<le> |M| * m

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
have "Suc (card (nodes M)*m) \<le> sum (\<lambda> q . card (R M q vs xs)) (nodes M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
using R_union_card_is_suffix_length[OF assms(1), of vs xs] assms(3,2)
[PROOF STATE]
proof (prove)
using this:
vs @ xs \<in> L M \<Longrightarrow> (\<Sum>q\<in>nodes M. card (R M q vs xs)) = length xs
vs @ xs \<in> L M
Suc (|M| * m) \<le> length xs

goal (1 subgoal):
 1. Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma generate_choices_idx :
  "cs \<in> set (generate_choices xyss)
    = (length cs = length xyss
        \<and> (\<forall> i < length cs . (fst (cs ! i)) = (fst (xyss ! i))
        \<and> ((snd (cs ! i)) = None
            \<or> ((snd (cs ! i)) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))
[PROOF STEP]
proof (induction xyss arbitrary: cs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>cs. (cs \<in> set (generate_choices [])) = (length cs = length [] \<and> (\<forall>i<length cs. fst (cs ! i) = fst ([] ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ([] ! i)))))
 2. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>cs. (cs \<in> set (generate_choices [])) = (length cs = length [] \<and> (\<forall>i<length cs. fst (cs ! i) = fst ([] ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ([] ! i)))))
 2. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cs \<in> set (generate_choices [])) = (length cs = length [] \<and> (\<forall>i<length cs. fst (cs ! i) = fst ([] ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ([] ! i)))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(cs \<in> set (generate_choices [])) = (length cs = length [] \<and> (\<forall>i<length cs. fst (cs ! i) = fst ([] ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ([] ! i)))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
case (Cons xys xyss)
[PROOF STATE]
proof (state)
this:
(?cs \<in> set (generate_choices xyss)) = (length ?cs = length xyss \<and> (\<forall>i<length ?cs. fst (?cs ! i) = fst (xyss ! i) \<and> (snd (?cs ! i) = None \<or> snd (?cs ! i) \<noteq> None \<and> the (snd (?cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
have "cs \<in> set (generate_choices (xys#xyss))
        = (length cs = length (xys#xyss)
            \<and> fst (hd cs) = fst xys
            \<and> ((snd (hd cs) = None \<or> (snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys))))
            \<and> (tl cs \<in> set (generate_choices xyss)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))
[PROOF STEP]
using generate_choices_hd_tl
[PROOF STATE]
proof (prove)
using this:
(?cs \<in> set (generate_choices (?xys # ?xyss))) = (length ?cs = length (?xys # ?xyss) \<and> fst (hd ?cs) = fst ?xys \<and> (snd (hd ?cs) = None \<or> snd (hd ?cs) \<noteq> None \<and> the (snd (hd ?cs)) \<in> set (snd ?xys)) \<and> tl ?cs \<in> set (generate_choices ?xyss))

goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))
[PROOF STEP]
have "cs \<in> set (generate_choices (xys#xyss))
    = (length cs = length (xys#xyss)
      \<and> fst (hd cs) = fst xys
      \<and> ((snd (hd cs) = None \<or> (snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys))))
      \<and> (length (tl cs) = length xyss \<and>
        (\<forall>i<length (tl cs).
          fst (tl cs ! i) = fst (xyss ! i) \<and>
          (snd (tl cs ! i) = None
            \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i))))))"
[PROOF STATE]
proof (prove)
using this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))

goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))
[PROOF STEP]
using Cons.IH[of "tl cs"]
[PROOF STATE]
proof (prove)
using this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> tl cs \<in> set (generate_choices xyss))
(tl cs \<in> set (generate_choices xyss)) = (length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))
[PROOF STEP]
have *: "cs \<in> set (generate_choices (xys#xyss))
    = (length cs = length (xys#xyss)
      \<and> fst (hd cs) = fst xys
      \<and> ((snd (hd cs) = None \<or> (snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys))))
      \<and> (\<forall>i<length (tl cs).
          fst (tl cs ! i) = fst (xyss ! i) \<and>
          (snd (tl cs ! i) = None
            \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))"
[PROOF STATE]
proof (prove)
using this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> length (tl cs) = length xyss \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
have "cs \<in> set (generate_choices (xys#xyss)) \<Longrightarrow> (length cs = length (xys # xyss) \<and>
                    (\<forall>i<length cs.
                        fst (cs ! i) = fst ((xys # xyss) ! i) \<and>
                        (snd (cs ! i) = None \<or>
                        snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
assume "cs \<in> set (generate_choices (xys#xyss))"
[PROOF STATE]
proof (state)
this:
cs \<in> set (generate_choices (xys # xyss))

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cs \<in> set (generate_choices (xys # xyss))
[PROOF STEP]
have p1: "length cs = length (xys#xyss)"
          and p2: "fst (hd cs) = fst xys "
          and p3: "((snd (hd cs) = None
                    \<or> (snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys))))"
          and p4: "(\<forall>i<length (tl cs).
                  fst (tl cs ! i) = fst (xyss ! i) \<and>
                  (snd (tl cs ! i) = None
                    \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i))))"
[PROOF STATE]
proof (prove)
using this:
cs \<in> set (generate_choices (xys # xyss))

goal (1 subgoal):
 1. (length cs = length (xys # xyss) &&& fst (hd cs) = fst xys) &&& snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys) &&& \<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
cs \<in> set (generate_choices (xys # xyss))
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. (length cs = length (xys # xyss) &&& fst (hd cs) = fst xys) &&& snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys) &&& \<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
length cs = length (xys # xyss)
fst (hd cs) = fst xys
snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)
\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length cs = length (xys # xyss)
fst (hd cs) = fst xys
snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)
\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))
[PROOF STEP]
have "length xyss = length (tl cs)" and "length (xys # xyss) = length ([hd cs] @ tl cs)"
[PROOF STATE]
proof (prove)
using this:
length cs = length (xys # xyss)
fst (hd cs) = fst xys
snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)
\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))

goal (1 subgoal):
 1. length xyss = length (tl cs) &&& length (xys # xyss) = length ([hd cs] @ tl cs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xyss = length (tl cs)
length (xys # xyss) = length ([hd cs] @ tl cs)

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
have "[hd cs]@(tl cs) = cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [hd cs] @ tl cs = cs
[PROOF STEP]
by (metis (no_types) p1 append.left_neutral append_Cons length_greater_0_conv
            list.collapse list.simps(3))
[PROOF STATE]
proof (state)
this:
[hd cs] @ tl cs = cs

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[hd cs] @ tl cs = cs
[PROOF STEP]
have p4b: "(\<forall>i<length cs. i > 0 \<longrightarrow>
                    (fst (cs ! i) = fst ((xys#xyss) ! i) \<and>
                      (snd (cs ! i) = None
                        \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys#xyss) ! i)))))"
[PROOF STATE]
proof (prove)
using this:
[hd cs] @ tl cs = cs

goal (1 subgoal):
 1. \<forall>i<length cs. 0 < i \<longrightarrow> fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))
[PROOF STEP]
using p4 list_append_idx_prop2[of xyss "tl cs" "xys#xyss" "[hd cs]@(tl cs)"
                                        "\<lambda> x y . fst x = fst y
                                                  \<and> (snd x = None
                                                      \<or> snd x \<noteq> None \<and> the (snd x) \<in> set (snd y))",
                                     OF \<open>length xyss = length (tl cs)\<close>
                                        \<open>length (xys # xyss) = length ([hd cs] @ tl cs)\<close>]
[PROOF STATE]
proof (prove)
using this:
[hd cs] @ tl cs = cs
\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))
(\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))) = (\<forall>j. j < length (([hd cs] @ tl cs) @ tl cs) \<and> length ([hd cs] @ tl cs) \<le> j \<longrightarrow> fst ((([hd cs] @ tl cs) @ tl cs) ! j) = fst (((xys # xyss) @ xyss) ! j) \<and> (snd ((([hd cs] @ tl cs) @ tl cs) ! j) = None \<or> snd ((([hd cs] @ tl cs) @ tl cs) ! j) \<noteq> None \<and> the (snd ((([hd cs] @ tl cs) @ tl cs) ! j)) \<in> set (snd (((xys # xyss) @ xyss) ! j))))

goal (1 subgoal):
 1. \<forall>i<length cs. 0 < i \<longrightarrow> fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))
[PROOF STEP]
by (metis (no_types, lifting) One_nat_def Suc_pred
            \<open>length (xys # xyss) = length ([hd cs] @ tl cs)\<close> \<open>length xyss = length (tl cs)\<close>
            length_Cons list.size(3) not_less_eq nth_Cons_pos nth_append)
[PROOF STATE]
proof (state)
this:
\<forall>i<length cs. 0 < i \<longrightarrow> fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
have p4a :"(fst (cs ! 0) = fst ((xys#xyss) ! 0) \<and> (snd (cs ! 0) = None
                \<or> snd (cs ! 0) \<noteq> None \<and> the (snd (cs ! 0)) \<in> set (snd ((xys#xyss) ! 0))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (cs ! 0) = fst ((xys # xyss) ! 0) \<and> (snd (cs ! 0) = None \<or> snd (cs ! 0) \<noteq> None \<and> the (snd (cs ! 0)) \<in> set (snd ((xys # xyss) ! 0)))
[PROOF STEP]
using p1 p2 p3
[PROOF STATE]
proof (prove)
using this:
length cs = length (xys # xyss)
fst (hd cs) = fst xys
snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)

goal (1 subgoal):
 1. fst (cs ! 0) = fst ((xys # xyss) ! 0) \<and> (snd (cs ! 0) = None \<or> snd (cs ! 0) \<noteq> None \<and> the (snd (cs ! 0)) \<in> set (snd ((xys # xyss) ! 0)))
[PROOF STEP]
by (metis hd_conv_nth length_greater_0_conv list.simps(3) nth_Cons_0)
[PROOF STATE]
proof (state)
this:
fst (cs ! 0) = fst ((xys # xyss) ! 0) \<and> (snd (cs ! 0) = None \<or> snd (cs ! 0) \<noteq> None \<and> the (snd (cs ! 0)) \<in> set (snd ((xys # xyss) ! 0)))

goal (1 subgoal):
 1. cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
using p1 p4a p4b
[PROOF STATE]
proof (prove)
using this:
length cs = length (xys # xyss)
fst (cs ! 0) = fst ((xys # xyss) ! 0) \<and> (snd (cs ! 0) = None \<or> snd (cs ! 0) \<noteq> None \<and> the (snd (cs ! 0)) \<in> set (snd ((xys # xyss) ! 0)))
\<forall>i<length cs. 0 < i \<longrightarrow> fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))

goal (1 subgoal):
 1. length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
have "(length cs = length (xys # xyss) \<and>
                    (\<forall>i<length cs.
                        fst (cs ! i) = fst ((xys # xyss) ! i) \<and>
                        (snd (cs ! i) = None \<or>
                        snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))))
                  \<Longrightarrow> cs \<in> set (generate_choices (xys#xyss))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))) \<Longrightarrow> cs \<in> set (generate_choices (xys # xyss))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> fst (hd cs) = fst xys \<and> (snd (hd cs) = None \<or> snd (hd cs) \<noteq> None \<and> the (snd (hd cs)) \<in> set (snd xys)) \<and> (\<forall>i<length (tl cs). fst (tl cs ! i) = fst (xyss ! i) \<and> (snd (tl cs ! i) = None \<or> snd (tl cs ! i) \<noteq> None \<and> the (snd (tl cs ! i)) \<in> set (snd (xyss ! i)))))

goal (1 subgoal):
 1. length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))) \<Longrightarrow> cs \<in> set (generate_choices (xys # xyss))
[PROOF STEP]
by (metis (no_types, lifting) Nitpick.size_list_simp(2) Suc_mono hd_conv_nth
        length_greater_0_conv length_tl list.sel(3) list.simps(3) nth_Cons_0 nth_tl)
[PROOF STATE]
proof (state)
this:
length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))) \<Longrightarrow> cs \<in> set (generate_choices (xys # xyss))

goal (1 subgoal):
 1. \<And>a xyss cs. (\<And>cs. (cs \<in> set (generate_choices xyss)) = (length cs = length xyss \<and> (\<forall>i<length cs. fst (cs ! i) = fst (xyss ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd (xyss ! i)))))) \<Longrightarrow> (cs \<in> set (generate_choices (a # xyss))) = (length cs = length (a # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((a # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((a # xyss) ! i)))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))) \<Longrightarrow> cs \<in> set (generate_choices (xys # xyss))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
cs \<in> set (generate_choices (xys # xyss)) \<Longrightarrow> length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i))))
length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))) \<Longrightarrow> cs \<in> set (generate_choices (xys # xyss))

goal (1 subgoal):
 1. (cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(cs \<in> set (generate_choices (xys # xyss))) = (length cs = length (xys # xyss) \<and> (\<forall>i<length cs. fst (cs ! i) = fst ((xys # xyss) ! i) \<and> (snd (cs ! i) = None \<or> snd (cs ! i) \<noteq> None \<and> the (snd (cs ! i)) \<in> set (snd ((xys # xyss) ! i)))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cinner_zero_right [simp]: "cinner x 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner x (0::'a) = 0
[PROOF STEP]
using cinner_zero_left [of x]
[PROOF STATE]
proof (prove)
using this:
cinner (0::'a) x = 0

goal (1 subgoal):
 1. cinner x (0::'a) = 0
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) complex_cnj_zero local.cinner_commute)


[STATEMENT]
lemma bi_unique_mat_rel: "bi_unique R \<Longrightarrow> bi_unique (mat_rel R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bi_unique R \<Longrightarrow> bi_unique (mat_rel R)
[PROOF STEP]
using left_unique_mat_rel[of R] right_unique_mat_rel[of R]
[PROOF STATE]
proof (prove)
using this:
left_unique R \<Longrightarrow> left_unique (mat_rel R)
right_unique R \<Longrightarrow> right_unique (mat_rel R)

goal (1 subgoal):
 1. bi_unique R \<Longrightarrow> bi_unique (mat_rel R)
[PROOF STEP]
unfolding bi_unique_def left_unique_def right_unique_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y \<Longrightarrow> \<forall>x y z. mat_rel R x z \<longrightarrow> mat_rel R y z \<longrightarrow> x = y
\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z \<Longrightarrow> \<forall>x y z. mat_rel R x y \<longrightarrow> mat_rel R x z \<longrightarrow> y = z

goal (1 subgoal):
 1. (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z) \<and> (\<forall>x y z. R x z \<longrightarrow> R y z \<longrightarrow> x = y) \<Longrightarrow> (\<forall>x y z. mat_rel R x y \<longrightarrow> mat_rel R x z \<longrightarrow> y = z) \<and> (\<forall>x y z. mat_rel R x z \<longrightarrow> mat_rel R y z \<longrightarrow> x = y)
[PROOF STEP]
by blast


[STATEMENT]
lemma add_nonneg_nonneg [simp]: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a + b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> a; (0::'a) \<le> b\<rbrakk> \<Longrightarrow> (0::'a) \<le> a + b
[PROOF STEP]
using add_mono[of 0 a 0 b]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::'a) \<le> a; (0::'a) \<le> b\<rbrakk> \<Longrightarrow> (0::'a) + (0::'a) \<le> a + b

goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> a; (0::'a) \<le> b\<rbrakk> \<Longrightarrow> (0::'a) \<le> a + b
[PROOF STEP]
by simp


[STATEMENT]
lemma fract_poly_smult [simp]: "fract_poly (smult c p) = smult (to_fract c) (fract_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly to_fract (smult c p) = smult (to_fract c) (map_poly to_fract p)
[PROOF STEP]
by (simp add: smult_conv_map_poly map_poly_map_poly o_def)


[STATEMENT]
lemma last_mirror2:
  assumes "knights_path (board n m) ps" "last ps = (i,j)"
  shows "last (mirror2 ps) = (i,int m+1-j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (mirror2 ps) = (i, int m + 1 - j)
[PROOF STEP]
unfolding mirror2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (mirror2_aux (max2 ps + min2 ps) ps) = (i, int m + 1 - j)
[PROOF STEP]
using assms last_mirror2_aux knights_path_non_nil
[PROOF STATE]
proof (prove)
using this:
knights_path (board n m) ps
last ps = (i, j)
\<lbrakk>?ps \<noteq> []; last ?ps = (?i, ?j)\<rbrakk> \<Longrightarrow> last (mirror2_aux ?m ?ps) = (?i, ?m - ?j)
knights_path ?b ?ps \<Longrightarrow> ?ps \<noteq> []

goal (1 subgoal):
 1. last (mirror2_aux (max2 ps + min2 ps) ps) = (i, int m + 1 - j)
[PROOF STEP]
by (simp add: knights_path_max2 knights_path_min2)


[STATEMENT]
lemma mem_liminf_iff: "x \<in> liminf A \<longleftrightarrow> (\<forall>\<^sub>F n in sequentially. x \<in> A n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> liminf A) = (\<forall>\<^sub>F n in sequentially. x \<in> A n)
[PROOF STEP]
by (simp add: Liminf_def) (metis (mono_tags) eventually_mono)


[STATEMENT]
lemma succ_pred_no [simp]:
    "word_succ (numeral w) = numeral w + 1"
    "word_pred (numeral w) = numeral w - 1"
    "word_succ (- numeral w) = - numeral w + 1"
    "word_pred (- numeral w) = - numeral w - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_succ (numeral w) = numeral w + 1 &&& word_pred (numeral w) = numeral w - 1) &&& word_succ (- numeral w) = - numeral w + 1 &&& word_pred (- numeral w) = - numeral w - 1
[PROOF STEP]
by (simp_all add: word_succ_p1 word_pred_m1)


[STATEMENT]
lemma (in comm_monoid_add) sum_list_distinct_selsort:
  assumes "distinct xs"
  shows "sum_list (linorder_list0.selsort le xs) = sum_list xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (linorder_list0.selsort le xs) = sum_list xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. sum_list (linorder_list0.selsort le xs) = sum_list xs
[PROOF STEP]
apply (simp add: distinct_sum_list_conv_Sum linorder_list0.distinct_selsort)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> \<Sum> (set (linorder_list0.selsort le xs)) = \<Sum> (set xs)
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct xs \<Longrightarrow> set (linorder_list0.selsort le xs) = set xs
 2. \<And>x. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> x = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> set (linorder_list0.selsort le xs) = set xs
[PROOF STEP]
by (simp add: linorder_list0.set_selsort)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> x = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x_ \<in> set xs\<rbrakk> \<Longrightarrow> x_ = x_
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ket_01_dim:
  shows "dim_vec ket_01 = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec ket_01 = 4
[PROOF STEP]
unfolding ket_01_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (ket_0 \<otimes> ket_1) = 4
[PROOF STEP]
by (simp add: ket_0_dim ket_1_dim)


[STATEMENT]
lemma face_of_Int_supporting_hyperplane_ge:
    "\<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b\<rbrakk> \<Longrightarrow> (S \<inter> {x. a \<bullet> x = b}) face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} face_of S
[PROOF STEP]
by (simp add: convex_Int convex_hyperplane face_of_Int_supporting_hyperplane_ge_strong)


[STATEMENT]
lemma real_is_int_mult[simp]: "real_is_int a \<Longrightarrow> real_is_int b \<Longrightarrow> real_is_int (a*b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real_is_int a; real_is_int b\<rbrakk> \<Longrightarrow> real_is_int (a * b)
[PROOF STEP]
apply (subst real_is_int_def2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>real_is_int a; real_is_int b\<rbrakk> \<Longrightarrow> a * b = real_of_int (int_of_real (a * b))
[PROOF STEP]
apply (simp add: int_of_real_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_unit_poly_iff: "p dvd 1 \<longleftrightarrow> (\<exists>c. p = [:c:] \<and> c dvd 1)"
  for p :: "'a::{comm_semiring_1,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd 1) = (\<exists>c. p = [:c:] \<and> c dvd (1::'a))
[PROOF STEP]
by (auto elim: is_unit_polyE simp add: is_unit_const_poly_iff)


[STATEMENT]
lemma norm_ii [simp]: "norm \<i> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod \<i> = 1
[PROOF STEP]
by (simp add: norm_complex_def)


[STATEMENT]
lemma trivial_limit_at_right_real [simp]: "\<not> trivial_limit (at_right x)"
  for x :: "'a::{no_top,dense_order,linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_right x \<noteq> bot
[PROOF STEP]
using gt_ex[of x]
[PROOF STATE]
proof (prove)
using this:
\<exists>y. x < y

goal (1 subgoal):
 1. at_right x \<noteq> bot
[PROOF STEP]
by safe (auto simp add: trivial_limit_def eventually_at_right dest: dense)


[STATEMENT]
lemma RSpanD_lincomb :
  "RSpan ms = { rs \<bullet>\<cdot> ms | rs. set rs \<subseteq> R \<and> length rs = length ms}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSpan ms = {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. RSpan ms \<subseteq> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}
 2. {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<subseteq> RSpan ms
[PROOF STEP]
show "RSpan ms \<subseteq> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RSpan ms \<subseteq> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}
[PROOF STEP]
using in_RSpan_obtain_same_length_coeffs
[PROOF STATE]
proof (prove)
using this:
?n \<in> RSpan ?ms \<Longrightarrow> \<exists>rs. set rs \<subseteq> R \<and> length rs = length ?ms \<and> ?n = rs \<bullet>\<cdot> ?ms

goal (1 subgoal):
 1. RSpan ms \<subseteq> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
RSpan ms \<subseteq> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}

goal (1 subgoal):
 1. {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<subseteq> RSpan ms
[PROOF STEP]
show "{rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<subseteq> RSpan ms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<subseteq> RSpan ms
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<Longrightarrow> x \<in> RSpan ms
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<Longrightarrow> x \<in> RSpan ms
[PROOF STEP]
assume "x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R  \<and> length rs = length ms}"
[PROOF STATE]
proof (state)
this:
x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}

goal (1 subgoal):
 1. \<And>x. x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<Longrightarrow> x \<in> RSpan ms
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}
[PROOF STEP]
obtain rs where rs: "set rs \<subseteq> R" "length rs = length ms" "x = rs \<bullet>\<cdot> ms"
[PROOF STATE]
proof (prove)
using this:
x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms}

goal (1 subgoal):
 1. (\<And>rs. \<lbrakk>set rs \<subseteq> R; length rs = length ms; x = rs \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set rs \<subseteq> R
length rs = length ms
x = rs \<bullet>\<cdot> ms

goal (1 subgoal):
 1. \<And>x. x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<Longrightarrow> x \<in> RSpan ms
[PROOF STEP]
from rs(2)
[PROOF STATE]
proof (chain)
picking this:
length rs = length ms
[PROOF STEP]
have "set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms"
[PROOF STATE]
proof (prove)
using this:
length rs = length ms

goal (1 subgoal):
 1. set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms
[PROOF STEP]
using lincomb_Nil lincomb_Cons
[PROOF STATE]
proof (prove)
using this:
length rs = length ms
?rs = [] \<or> ?ms = [] \<Longrightarrow> ?rs \<bullet>\<cdot> ?ms = (0::'m)
(?r # ?rs) \<bullet>\<cdot> (?m # ?ms) = ?r \<cdot> ?m + ?rs \<bullet>\<cdot> ?ms

goal (1 subgoal):
 1. set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms
[PROOF STEP]
by (induct rs ms rule: list_induct2) auto
[PROOF STATE]
proof (state)
this:
set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms

goal (1 subgoal):
 1. \<And>x. x \<in> {rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<Longrightarrow> x \<in> RSpan ms
[PROOF STEP]
with rs(1,3)
[PROOF STATE]
proof (chain)
picking this:
set rs \<subseteq> R
x = rs \<bullet>\<cdot> ms
set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms
[PROOF STEP]
show "x \<in> RSpan ms"
[PROOF STATE]
proof (prove)
using this:
set rs \<subseteq> R
x = rs \<bullet>\<cdot> ms
set rs \<subseteq> R \<Longrightarrow> rs \<bullet>\<cdot> ms \<in> RSpan ms

goal (1 subgoal):
 1. x \<in> RSpan ms
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x \<in> RSpan ms

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{rs \<bullet>\<cdot> ms |rs. set rs \<subseteq> R \<and> length rs = length ms} \<subseteq> RSpan ms

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_integrable_abs [simp]:
   "f square_integrable S \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) square_integrable S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f square_integrable S \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) square_integrable S
[PROOF STEP]
by (simp add: square_integrable_def borel_measurable_abs)


[STATEMENT]
lemma domino_finite:
  assumes "d \<in> domino"
  shows "finite d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
d \<in> domino

goal (1 subgoal):
 1. finite d
[PROOF STEP]
proof induct
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. finite {(i, j), (i, j + 1)}
 2. \<And>i j. finite {(i, j), (i + 1, j)}
[PROOF STEP]
fix i j :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. finite {(i, j), (i, j + 1)}
 2. \<And>i j. finite {(i, j), (i + 1, j)}
[PROOF STEP]
show "finite {(i, j), (i, j + 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(i, j), (i, j + 1)}
[PROOF STEP]
by (intro finite.intros)
[PROOF STATE]
proof (state)
this:
finite {(i, j), (i, j + 1)}

goal (1 subgoal):
 1. \<And>i j. finite {(i, j), (i + 1, j)}
[PROOF STEP]
show "finite {(i, j), (i + 1, j)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(i, j), (i + 1, j)}
[PROOF STEP]
by (intro finite.intros)
[PROOF STATE]
proof (state)
this:
finite {(i, j), (i + 1, j)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pref_drop: "u \<le>p v \<Longrightarrow> drop p u \<le>p drop p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<le>p v \<Longrightarrow> drop p u \<le>p drop p v
[PROOF STEP]
using prefI[OF sym[OF drop_append]]
[PROOF STATE]
proof (prove)
using this:
drop ?n2 ?xs2 \<le>p drop ?n2 (?xs2 \<cdot> ?ys2)

goal (1 subgoal):
 1. u \<le>p v \<Longrightarrow> drop p u \<le>p drop p v
[PROOF STEP]
unfolding prefix_def
[PROOF STATE]
proof (prove)
using this:
\<exists>zs. drop ?n2 (?xs2 \<cdot> ?ys2) = drop ?n2 ?xs2 \<cdot> zs

goal (1 subgoal):
 1. \<exists>zs. v = u \<cdot> zs \<Longrightarrow> \<exists>zs. drop p v = drop p u \<cdot> zs
[PROOF STEP]
by blast


[STATEMENT]
lemma abs_summable_on_reindex_iff:
  "inj_on g A \<Longrightarrow> (\<lambda>x. f (g x)) abs_summable_on A \<longleftrightarrow> f abs_summable_on (g ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on g A \<Longrightarrow> ((\<lambda>x. f (g x)) abs_summable_on A) = (f abs_summable_on g ` A)
[PROOF STEP]
by (intro abs_summable_on_reindex_bij_betw inj_on_imp_bij_betw)


[STATEMENT]
lemma neg_mod_plus_minus:
  assumes "odd b"
          "b>0"
  shows "(- x) mod+- b = - (x mod+- b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
obtain k :: int where k_def: "(-x) mod+- b = (-x)+ k* b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using mod_plus_minus_def
[PROOF STATE]
proof (prove)
using this:
?m mod+- ?b = (?m + \<lfloor>real_of_int ?b / 2\<rfloor>) mod ?b - \<lfloor>real_of_int ?b / 2\<rfloor>

goal (1 subgoal):
 1. (\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis; \<And>m b. m mod+- b = (m + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume a1: "\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis"
[PROOF STATE]
proof (state)
this:
- x mod+- b = - x + ?k * b \<Longrightarrow> thesis

goal (1 subgoal):
 1. \<lbrakk>\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis; \<And>m b. m mod+- b = (m + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "\<exists>i. i mod b + - (x + i) = - x mod+- b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. i mod b + - (x + i) = - x mod+- b
[PROOF STEP]
by (metis (no_types) add.commute diff_add_cancel diff_minus_eq_add
        floor_divide_of_int_eq mod_plus_minus_def of_int_numeral)
[PROOF STATE]
proof (state)
this:
\<exists>i. i mod b + - (x + i) = - x mod+- b

goal (1 subgoal):
 1. \<lbrakk>\<And>k. - x mod+- b = - x + k * b \<Longrightarrow> thesis; \<And>m b. m mod+- b = (m + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. i mod b + - (x + i) = - x mod+- b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>i. i mod b + - (x + i) = - x mod+- b

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
\<exists>i. i mod b + - (x + i) = - x mod+- b
- x mod+- b = - x + ?k * b \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis (no_types) diff_add_cancel diff_diff_add
      diff_minus_eq_add minus_diff_eq minus_mult_div_eq_mod
      mult.commute mult_minus_left)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- x mod+- b = - x + k * b

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- x mod+- b = - x + k * b
[PROOF STEP]
have "(-x) mod+- b = -(x - k*b)"
[PROOF STATE]
proof (prove)
using this:
- x mod+- b = - x + k * b

goal (1 subgoal):
 1. - x mod+- b = - (x - k * b)
[PROOF STEP]
using k_def
[PROOF STATE]
proof (prove)
using this:
- x mod+- b = - x + k * b
- x mod+- b = - x + k * b

goal (1 subgoal):
 1. - x mod+- b = - (x - k * b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- x mod+- b = - (x - k * b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- x mod+- b = - (x - k * b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
have "\<dots> = - ((x-k*b) mod+- b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x - k * b) = - ((x - k * b) mod+- b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - (x - k * b) = - ((x - k * b) mod+- b)
[PROOF STEP]
have range_xkb:"x - k * b \<in>
      {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - k * b \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}
[PROOF STEP]
using k_def mod_plus_minus_range[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
- x mod+- b = - x + k * b
?y mod+- b \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}

goal (1 subgoal):
 1. x - k * b \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}
[PROOF STEP]
by (smt (verit, ccfv_SIG) atLeastAtMost_iff)
[PROOF STATE]
proof (state)
this:
x - k * b \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}

goal (1 subgoal):
 1. - (x - k * b) = - ((x - k * b) mod+- b)
[PROOF STEP]
have "x - k*b = (x - k*b) mod+- b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - k * b = (x - k * b) mod+- b
[PROOF STEP]
using mod_plus_minus_rangeE'[OF range_xkb assms(1)]
[PROOF STATE]
proof (prove)
using this:
x - k * b = (x - k * b) mod+- b

goal (1 subgoal):
 1. x - k * b = (x - k * b) mod+- b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x - k * b = (x - k * b) mod+- b

goal (1 subgoal):
 1. - (x - k * b) = - ((x - k * b) mod+- b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - k * b = (x - k * b) mod+- b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x - k * b = (x - k * b) mod+- b

goal (1 subgoal):
 1. - (x - k * b) = - ((x - k * b) mod+- b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (x - k * b) = - ((x - k * b) mod+- b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- (x - k * b) = - ((x - k * b) mod+- b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (x - k * b) = - ((x - k * b) mod+- b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
have "-((x - k*b) mod+- b) = -(x mod+- b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((x - k * b) mod+- b) = - (x mod+- b)
[PROOF STEP]
unfolding mod_plus_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((x - k * b + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>) = - ((x + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>)
[PROOF STEP]
by (smt (verit, best) mod_mult_self1)
[PROOF STATE]
proof (state)
this:
- ((x - k * b) mod+- b) = - (x mod+- b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- x mod+- b = - (x mod+- b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- x mod+- b = - (x mod+- b)

goal (1 subgoal):
 1. - x mod+- b = - (x mod+- b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- x mod+- b = - (x mod+- b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma total_degree_degree_in_var:
  assumes "finite (monomials_of R P)"
  shows "total_degree R P \<ge> degree_in_var R P i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
proof(cases " (monomials_of R P) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. monomials_of R P = {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
 2. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
monomials_of R P = {}

goal (2 subgoals):
 1. monomials_of R P = {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
 2. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
monomials_of R P = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
monomials_of R P = {}

goal (1 subgoal):
 1. degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
unfolding total_degree_def degree_in_var_def
[PROOF STATE]
proof (prove)
using this:
monomials_of R P = {}

goal (1 subgoal):
 1. (if monomials_of R P = {} then 0 else MAX m\<in>monomials_of R P. count m i) \<le> (if monomials_of R P = {} then 0 else Max (size ` monomials_of R P))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree_in_var R P i \<le> total_degree R P

goal (1 subgoal):
 1. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
monomials_of R P \<noteq> {}

goal (1 subgoal):
 1. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
monomials_of R P \<noteq> {}
[PROOF STEP]
obtain m1 where m1_def: "m1 \<in> monomials_of R P \<and> count m1 i = degree_in_var R P i"
[PROOF STATE]
proof (prove)
using this:
monomials_of R P \<noteq> {}

goal (1 subgoal):
 1. (\<And>m1. m1 \<in> monomials_of R P \<and> count m1 i = degree_in_var R P i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson assms degree_in_var_in_monomials_of)
[PROOF STATE]
proof (state)
this:
m1 \<in> monomials_of R P \<and> count m1 i = degree_in_var R P i

goal (1 subgoal):
 1. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
have "size m1 \<ge>count m1 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count m1 i \<le> size m1
[PROOF STEP]
by (simp add: multi_set_size_count)
[PROOF STATE]
proof (state)
this:
count m1 i \<le> size m1

goal (1 subgoal):
 1. monomials_of R P \<noteq> {} \<Longrightarrow> degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
count m1 i \<le> size m1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count m1 i \<le> size m1

goal (1 subgoal):
 1. degree_in_var R P i \<le> total_degree R P
[PROOF STEP]
by (simp add: assms local.ring_axioms m1_def order.trans ring.total_degree_ineq)
[PROOF STATE]
proof (state)
this:
degree_in_var R P i \<le> total_degree R P

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lin_bound_arg_general:
  fixes A ::"('a :: {field}) mat"
  assumes "distinct (cols A)"
  assumes "A \<in> carrier_mat nr nc"
  assumes "vec_space.lin_indpt_vs nr (set (cols A))"
  shows "nc \<le> nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nc \<le> nr
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nc \<le> nr
[PROOF STEP]
have ss: "set (cols A) \<subseteq> carrier_vec nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (cols A) \<subseteq> carrier_vec nr
[PROOF STEP]
using assms cols_dim
[PROOF STATE]
proof (prove)
using this:
distinct (cols A)
A \<in> carrier_mat nr nc
vec_space.lin_indpt_vs nr (set (cols A))
set (cols ?A) \<subseteq> carrier_vec (dim_row ?A)

goal (1 subgoal):
 1. set (cols A) \<subseteq> carrier_vec nr
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set (cols A) \<subseteq> carrier_vec nr

goal (1 subgoal):
 1. nc \<le> nr
[PROOF STEP]
have "length (cols A) = nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (cols A) = nc
[PROOF STEP]
using assms(2) cols_length
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
length (cols ?A) = dim_col ?A

goal (1 subgoal):
 1. length (cols A) = nc
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (cols A) = nc

goal (1 subgoal):
 1. nc \<le> nr
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
length (cols A) = nc

goal (1 subgoal):
 1. nc \<le> nr
[PROOF STEP]
using lin_bound_arg_general_list[of "cols A" "nr"] ss assms
[PROOF STATE]
proof (prove)
using this:
length (cols A) = nc
\<lbrakk>distinct (cols A); set (cols A) \<subseteq> carrier_vec nr; vec_space.lin_indpt_vs nr (set (cols A))\<rbrakk> \<Longrightarrow> length (cols A) \<le> nr
set (cols A) \<subseteq> carrier_vec nr
distinct (cols A)
A \<in> carrier_mat nr nc
vec_space.lin_indpt_vs nr (set (cols A))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dg_prod_2_Dom_vrange: "\<R>\<^sub>\<circ> ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
proof(rule vsv.vsv_vrange_vsubset, unfold dg_cs_simps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vsv ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>)
 2. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
show "vsv ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>)
[PROOF STEP]
by (rule dg_prod_2_Dom_vsv)
[PROOF STATE]
proof (state)
this:
vsv ((\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>)

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
fix gf
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
assume prems: "gf \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (state)
this:
gf \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gf \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr>
[PROOF STEP]
obtain g f where gf_def: "gf = [g, f]\<^sub>\<circ>"
    and g: "g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>"
    and f: "f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
using this:
gf \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. (\<And>g f. \<lbrakk>gf = [g, f]\<^sub>\<circ>; g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>; f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dg_prod_2_ArrE[OF \<AA> \<BB>]) simp
[PROOF STATE]
proof (state)
this:
gf = [g, f]\<^sub>\<circ>
g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>
f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
from g f
[PROOF STATE]
proof (chain)
picking this:
g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>
f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>
[PROOF STEP]
obtain a b c d where g: "g : a \<mapsto>\<^bsub>\<AA>\<^esub> c" and f: "f : b \<mapsto>\<^bsub>\<BB>\<^esub> d"
[PROOF STATE]
proof (prove)
using this:
g \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>
f \<in>\<^sub>\<circ> \<BB>\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. (\<And>a c b d. \<lbrakk>g : a \<mapsto>\<^bsub>\<AA>\<^esub> c; f : b \<mapsto>\<^bsub>\<BB>\<^esub> d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto intro!: is_arrI)
[PROOF STATE]
proof (state)
this:
g : a \<mapsto>\<^bsub>\<AA>\<^esub> c
f : b \<mapsto>\<^bsub>\<BB>\<^esub> d

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Arr\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
from \<AA> \<BB> g f
[PROOF STATE]
proof (chain)
picking this:
digraph \<alpha> \<AA>
digraph \<alpha> \<BB>
g : a \<mapsto>\<^bsub>\<AA>\<^esub> c
f : b \<mapsto>\<^bsub>\<BB>\<^esub> d
[PROOF STEP]
show "(\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>gf\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
using this:
digraph \<alpha> \<AA>
digraph \<alpha> \<BB>
g : a \<mapsto>\<^bsub>\<AA>\<^esub> c
f : b \<mapsto>\<^bsub>\<BB>\<^esub> d

goal (1 subgoal):
 1. (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>gf\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding gf_def dg_prod_2_Dom_app[OF prems[unfolded gf_def]]
[PROOF STATE]
proof (prove)
using this:
digraph \<alpha> \<AA>
digraph \<alpha> \<BB>
g : a \<mapsto>\<^bsub>\<AA>\<^esub> c
f : b \<mapsto>\<^bsub>\<BB>\<^esub> d

goal (1 subgoal):
 1. [\<AA>\<lparr>Dom\<rparr>\<lparr>g\<rparr>, \<BB>\<lparr>Dom\<rparr>\<lparr>f\<rparr>]\<^sub>\<circ> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
by (cs_concl cs_simp: dg_cs_simps cs_intro: dg_cs_intros dg_prod_cs_intros)
[PROOF STATE]
proof (state)
this:
(\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Dom\<rparr>\<lparr>gf\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llast_LCons: "llast (LCons x xs) = (if lnull xs then x else llast xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast (LCons x xs) = (if lnull xs then x else llast xs)
[PROOF STEP]
by(cases "llength xs")(auto simp add: llast_def eSuc_def zero_enat_def not_lnull_conv split: enat.splits)


[STATEMENT]
lemma eucl_of_list_inner_le:
  fixes i::"'a::executable_euclidean_space"
  assumes i: "i \<in> Basis"
  assumes l: "length xs \<ge> DIM('a)"
  shows "eucl_of_list xs \<bullet> i = xs ! (index Basis_list i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
have "(eucl_of_list xs::'a) = eucl_of_list (take DIM('a) (xs @ (replicate (DIM('a) - length xs) 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs = eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0))
[PROOF STEP]
by (rule eucl_of_list_eq_takeI) simp
[PROOF STATE]
proof (state)
this:
eucl_of_list xs = eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0))

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eucl_of_list xs = eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0))

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
have "\<dots> \<bullet> i = xs ! (index Basis_list i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0)) \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> Basis
DIM('a) \<le> length xs

goal (1 subgoal):
 1. eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0)) \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
by (subst eucl_of_list_inner) auto
[PROOF STATE]
proof (state)
this:
eucl_of_list (take DIM('a) (xs @ replicate (DIM('a) - length xs) 0)) \<bullet> i = xs ! index Basis_list i

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eucl_of_list xs \<bullet> i = xs ! index Basis_list i

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> i = xs ! index Basis_list i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
eucl_of_list xs \<bullet> i = xs ! index Basis_list i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem ln_series_quadratic:
  assumes x: "x > (0::real)"
  shows "(\<lambda>n. (2*((x - 1) / (x + 1)) ^ (2*n+1) / of_nat (2*n+1))) sums ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
define y :: complex where "y = of_real ((x-1)/(x+1))"
[PROOF STATE]
proof (state)
this:
y = complex_of_real ((x - 1) / (x + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have x': "complex_of_real x \<noteq> of_real (-1)"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. complex_of_real x \<noteq> complex_of_real (- 1)
[PROOF STEP]
by (subst of_real_eq_iff) auto
[PROOF STATE]
proof (state)
this:
complex_of_real x \<noteq> complex_of_real (- 1)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "\<bar>x - 1\<bar> < \<bar>x + 1\<bar>"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. \<bar>x - 1\<bar> < \<bar>x + 1\<bar>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<bar>x - 1\<bar> < \<bar>x + 1\<bar>

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
hence "norm (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>x - 1\<bar> < \<bar>x + 1\<bar>

goal (1 subgoal):
 1. cmod (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1
[PROOF STEP]
by (simp add: norm_divide del: of_real_add of_real_diff)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
hence "norm (\<i> * y) < 1"
[PROOF STATE]
proof (prove)
using this:
cmod (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1

goal (1 subgoal):
 1. cmod (\<i> * y) < 1
[PROOF STEP]
unfolding y_def
[PROOF STATE]
proof (prove)
using this:
cmod (complex_of_real (x - 1) / complex_of_real (x + 1)) < 1

goal (1 subgoal):
 1. cmod (\<i> * complex_of_real ((x - 1) / (x + 1))) < 1
[PROOF STEP]
by (subst norm_mult) simp
[PROOF STATE]
proof (state)
this:
cmod (\<i> * y) < 1

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
hence "(\<lambda>n. (-2*\<i>) * ((-1)^n / of_nat (2*n+1) * (\<i>*y)^(2*n+1))) sums ((-2*\<i>) * Arctan (\<i>*y))"
[PROOF STATE]
proof (prove)
using this:
cmod (\<i> * y) < 1

goal (1 subgoal):
 1. (\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) sums (- 2 * \<i> * Arctan (\<i> * y))
[PROOF STEP]
by (intro Arctan_series sums_mult) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) sums (- 2 * \<i> * Arctan (\<i> * y))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) sums (- 2 * \<i> * Arctan (\<i> * y))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "(\<lambda>n. (-2*\<i>) * ((-1)^n / of_nat (2*n+1) * (\<i>*y)^(2*n+1))) =
                 (\<lambda>n. (-2*\<i>) * ((-1)^n * (\<i>*y*(-y\<^sup>2)^n)/of_nat (2*n+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) = (\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1)))
[PROOF STEP]
by (intro ext) (simp_all add: power_mult power_mult_distrib)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) = (\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1)))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n / of_nat (2 * n + 1) * (\<i> * y) ^ (2 * n + 1))) = (\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1)))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "\<dots> = (\<lambda>n. 2*y* ((-1) * (-y\<^sup>2))^n/of_nat (2*n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1))) = (\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1))
[PROOF STEP]
by (intro ext, subst power_mult_distrib) (simp add: algebra_simps power_mult)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1))) = (\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - 2 * \<i> * ((- 1) ^ n * (\<i> * y * (- y\<^sup>2) ^ n) / of_nat (2 * n + 1))) = (\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "\<dots> = (\<lambda>n. 2*y^(2*n+1) / of_nat (2*n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1)) = (\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1))
[PROOF STEP]
by (subst power_add, subst power_mult) (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1)) = (\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * y * (- 1 * - y\<^sup>2) ^ n / of_nat (2 * n + 1)) = (\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "\<dots> = (\<lambda>n. of_real (2*((x-1)/(x+1))^(2*n+1) / of_nat (2*n+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1)) = (\<lambda>n. complex_of_real (2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)))
[PROOF STEP]
by (intro ext) (simp add: y_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1)) = (\<lambda>n. complex_of_real (2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * y ^ (2 * n + 1) / of_nat (2 * n + 1)) = (\<lambda>n. complex_of_real (2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "\<i> * y = (of_real x - 1) / (-\<i> * (of_real x + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> * y = (complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1))
[PROOF STEP]
by (subst divide_divide_eq_left [symmetric]) (simp add: y_def)
[PROOF STATE]
proof (state)
this:
\<i> * y = (complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<i> * y = (complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1))

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
have "\<dots> = moebius 1 (-1) (-\<i>) (-\<i>) (of_real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1)) = moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)
[PROOF STEP]
by (simp add: moebius_def algebra_simps)
[PROOF STATE]
proof (state)
this:
(complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1)) = moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(complex_of_real x - 1) / (- \<i> * (complex_of_real x + 1)) = moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
from x'
[PROOF STATE]
proof (chain)
picking this:
complex_of_real x \<noteq> complex_of_real (- 1)
[PROOF STEP]
have "-2*\<i>*Arctan \<dots> = Ln (of_real x)"
[PROOF STATE]
proof (prove)
using this:
complex_of_real x \<noteq> complex_of_real (- 1)

goal (1 subgoal):
 1. - 2 * \<i> * Arctan (moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)) = Ln (complex_of_real x)
[PROOF STEP]
by (intro Ln_conv_Arctan [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
- 2 * \<i> * Arctan (moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)) = Ln (complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- 2 * \<i> * Arctan (moebius 1 (- 1) (- \<i>) (- \<i>) (complex_of_real x)) = Ln (complex_of_real x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "\<dots> = ln x"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. Ln (complex_of_real x) = complex_of_real (ln x)
[PROOF STEP]
by (rule Ln_of_real)
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real x) = complex_of_real (ln x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. complex_of_real (2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1))) sums complex_of_real (ln x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. complex_of_real (2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1))) sums complex_of_real (ln x)

goal (1 subgoal):
 1. (\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x
[PROOF STEP]
by (subst (asm) sums_of_real_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * ((x - 1) / (x + 1)) ^ (2 * n + 1) / real (2 * n + 1)) sums ln x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exact_seq_imp_exact_hom_arbitrary:
   assumes "exact_seq (G, F)"
     and "Suc i < length F"
   shows "(F ! (Suc i)) ` (carrier (G ! (Suc (Suc i)))) = kernel (G ! (Suc i)) (G ! i) (F ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
have "length (drop i F) \<ge> 2" "length (drop i G) \<ge> 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> length (drop i F) &&& 3 \<le> length (drop i G)
[PROOF STEP]
using assms(2) exact_seq_length1[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
Suc i < length F
length (fst (G, F)) = Suc (length (snd (G, F)))

goal (1 subgoal):
 1. 2 \<le> length (drop i F) &&& 3 \<le> length (drop i G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 \<le> length (drop i F)
3 \<le> length (drop i G)

goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<le> length (drop i F)
3 \<le> length (drop i G)
[PROOF STEP]
obtain l q
    where "drop i G = (G ! i) # (G ! (Suc i)) # (G ! (Suc (Suc i))) # l"
     and  "drop i F = (F ! i) # (F ! (Suc i)) # q"
[PROOF STATE]
proof (prove)
using this:
2 \<le> length (drop i F)
3 \<le> length (drop i G)

goal (1 subgoal):
 1. (\<And>l q. \<lbrakk>drop i G = G ! i # G ! Suc i # G ! Suc (Suc i) # l; drop i F = F ! i # F ! Suc i # q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Cons_nth_drop_Suc Suc_less_eq assms exact_seq_length1 fst_conv
        le_eq_less_or_eq le_imp_less_Suc prod.sel(2))
[PROOF STATE]
proof (state)
this:
drop i G = G ! i # G ! Suc i # G ! Suc (Suc i) # l
drop i F = F ! i # F ! Suc i # q

goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
drop i G = G ! i # G ! Suc i # G ! Suc (Suc i) # l
drop i F = F ! i # F ! Suc i # q

goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
using dropped_seq_is_exact_seq[OF assms(1), of i] assms(2)
        exact_seq_imp_exact_hom[of "G ! i" "G ! (Suc i)" "G ! (Suc (Suc i))" l q]
[PROOF STATE]
proof (prove)
using this:
drop i G = G ! i # G ! Suc i # G ! Suc (Suc i) # l
drop i F = F ! i # F ! Suc i # q
i < length F \<Longrightarrow> exact_seq (drop i G, drop i F)
Suc i < length F
exact_seq (G ! Suc (Suc i) # l, q)  \<longlongrightarrow>\<^bsub>?g1.0\<^esub> G ! Suc i  \<longlongrightarrow>\<^bsub>?g2.0\<^esub> G ! i \<Longrightarrow> ?g1.0 ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) ?g2.0

goal (1 subgoal):
 1. F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F ! Suc i ` carrier (G ! Suc (Suc i)) = kernel (G ! Suc i) (G ! i) (F ! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_contains_cbox:
  fixes x :: "'a :: euclidean_space"
  assumes "open A" "x \<in> A"
  obtains a b where "cbox a b \<subseteq> A" "x \<in> box a b" "\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
open A
x \<in> A
[PROOF STEP]
obtain R where R: "R > 0" "ball x R \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
open A
x \<in> A

goal (1 subgoal):
 1. (\<And>R. \<lbrakk>0 < R; ball x R \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: open_contains_ball)
[PROOF STATE]
proof (state)
this:
0 < R
ball x R \<subseteq> A

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define r :: real where "r = R / (2 * sqrt DIM('a))"
[PROOF STATE]
proof (state)
this:
r = R / (2 * sqrt (real DIM('a)))

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<open>R > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < R
[PROOF STEP]
have [simp]: "r > 0"
[PROOF STATE]
proof (prove)
using this:
0 < R

goal (1 subgoal):
 1. 0 < r
[PROOF STEP]
by (auto simp: r_def)
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define d :: 'a where "d = r *\<^sub>R Topology_Euclidean_Space.One"
[PROOF STATE]
proof (state)
this:
d = r *\<^sub>R One

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "cbox (x - d) (x + d) \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox (x - d) (x + d) \<subseteq> A
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
assume y: "y \<in> cbox (x - d) (x + d)"
[PROOF STATE]
proof (state)
this:
y \<in> cbox (x - d) (x + d)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)
[PROOF STEP]
by (subst euclidean_dist_l2) (auto simp: L2_set_def)
[PROOF STATE]
proof (state)
this:
dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
from y
[PROOF STATE]
proof (chain)
picking this:
y \<in> cbox (x - d) (x + d)
[PROOF STEP]
have "sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>(Basis::'a set). r\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
y \<in> cbox (x - d) (x + d)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>Basis. r\<^sup>2)
[PROOF STEP]
by (intro real_sqrt_le_mono sum_mono power_mono)
         (auto simp: dist_norm d_def cbox_def algebra_simps)
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>Basis. r\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>Basis. r\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
have "\<dots> = sqrt (DIM('a) * r\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>Basis. r\<^sup>2) = sqrt (real DIM('a) * r\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>Basis. r\<^sup>2) = sqrt (real DIM('a) * r\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>Basis. r\<^sup>2) = sqrt (real DIM('a) * r\<^sup>2)

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
have "DIM('a) * r\<^sup>2 = (R / 2) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real DIM('a) * r\<^sup>2 = (R / 2)\<^sup>2
[PROOF STEP]
by (simp add: r_def power_divide)
[PROOF STATE]
proof (state)
this:
real DIM('a) * r\<^sup>2 = (R / 2)\<^sup>2

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real DIM('a) * r\<^sup>2 = (R / 2)\<^sup>2

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
have "sqrt \<dots> = R / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((R / 2)\<^sup>2) = R / 2
[PROOF STEP]
using \<open>R > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < R

goal (1 subgoal):
 1. sqrt ((R / 2)\<^sup>2) = R / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt ((R / 2)\<^sup>2) = R / 2

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt ((R / 2)\<^sup>2) = R / 2

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
from \<open>R > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < R
[PROOF STEP]
have "\<dots> < R"
[PROOF STATE]
proof (prove)
using this:
0 < R

goal (1 subgoal):
 1. R / 2 < R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R / 2 < R

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist x y < R
[PROOF STEP]
have "y \<in> ball x R"
[PROOF STATE]
proof (prove)
using this:
dist x y < R

goal (1 subgoal):
 1. y \<in> ball x R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> ball x R

goal (1 subgoal):
 1. \<And>xa. xa \<in> cbox (x - d) (x + d) \<Longrightarrow> xa \<in> A
[PROOF STEP]
with R
[PROOF STATE]
proof (chain)
picking this:
0 < R
ball x R \<subseteq> A
y \<in> ball x R
[PROOF STEP]
show "y \<in> A"
[PROOF STATE]
proof (prove)
using this:
0 < R
ball x R \<subseteq> A
y \<in> ball x R

goal (1 subgoal):
 1. y \<in> A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cbox (x - d) (x + d) \<subseteq> A

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cbox (x - d) (x + d) \<subseteq> A

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that[of "x - d" "x + d"]
[PROOF STATE]
proof (prove)
using this:
cbox (x - d) (x + d) \<subseteq> A
\<lbrakk>cbox (x - d) (x + d) \<subseteq> A; x \<in> box (x - d) (x + d); \<forall>i\<in>Basis. (x - d) \<bullet> i < (x + d) \<bullet> i\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (auto simp: algebra_simps d_def box_def)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_inorder_list_separators: "sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts)
[PROOF STEP]
apply(induction ts)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sorted_less (inorder_list []) \<Longrightarrow> sorted_less (separators [])
 2. \<And>a ts. \<lbrakk>sorted_less (inorder_list ts) \<Longrightarrow> sorted_less (separators ts); sorted_less (inorder_list (a # ts))\<rbrakk> \<Longrightarrow> sorted_less (separators (a # ts))
[PROOF STEP]
apply (auto simp add: sorted_lems)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma length_stirling_row [simp]: "length (stirling_row n) = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (stirling_row n) = Suc n
[PROOF STEP]
by (simp add: stirling_row_def)