[STATEMENT]
lemma INF_INF_partition_nat3:
  fixes f :: "nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice"
  shows "(\<Sqinter>i. \<Sqinter>j. f i j) =
    (\<Sqinter>i. \<Sqinter>j\<in>{j. i = j}. f i j) \<sqinter>
    (\<Sqinter>i. \<Sqinter>j\<in>{j. i < j}. f i j) \<sqinter>
    (\<Sqinter>i. \<Sqinter>j\<in>{j. j < i}. f i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "(\<Sqinter>i. \<Sqinter>j. f i j) = (\<Sqinter>i. ((\<Sqinter>j\<in>{j. i = j}. f i j) \<sqinter>
                                  (\<Sqinter>j\<in>{j. i < j}. f i j) \<sqinter>
                                  (\<Sqinter>j\<in>{j. j < i}. f i j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j}) \<sqinter> \<Sqinter> (f i ` {j::nat. i < j}) \<sqinter> \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp add: INF_partition_nat3)
[PROOF STATE]
proof (state)
this:
(\<Sqinter>i::nat. \<Sqinter> range ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j}) \<sqinter> \<Sqinter> (f i ` {j::nat. i < j}) \<sqinter> \<Sqinter> (f i ` {j::nat. j < i}))

goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sqinter>i::nat. \<Sqinter> range ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j}) \<sqinter> \<Sqinter> (f i ` {j::nat. i < j}) \<sqinter> \<Sqinter> (f i ` {j::nat. j < i}))

goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "... = (\<Sqinter>i. \<Sqinter>j\<in>{j. i = j}. f i j) \<sqinter>
                   (\<Sqinter>i. \<Sqinter>j\<in>{j. i < j}. f i j) \<sqinter>
                   (\<Sqinter>i. \<Sqinter>j\<in>{j. j < i}. f i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j}) \<sqinter> \<Sqinter> (f i ` {j::nat. i < j}) \<sqinter> \<Sqinter> (f i ` {j::nat. j < i})) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp add: INF_inf_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sqinter>i::nat. \<Sqinter> ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i ` {j::nat. i = j}) \<sqinter> \<Sqinter> (f i ` {j::nat. i < j}) \<sqinter> \<Sqinter> (f i ` {j::nat. j < i})) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))

goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sqinter>i::nat. \<Sqinter> range ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sqinter>i::nat. \<Sqinter> range ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))

goal (1 subgoal):
 1. (\<Sqinter>i::nat. \<Sqinter> range (f i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sqinter>i::nat. \<Sqinter> range ((f::nat \<Rightarrow> nat \<Rightarrow> 'a::refinement_lattice) i)) = (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i = j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. i < j})) \<sqinter> (\<Sqinter>i::nat. \<Sqinter> (f i ` {j::nat. j < i}))

goal:
No subgoals!
variables:
f :: nat \<Rightarrow> nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma inf_continuous_iff_at_right:
  fixes f :: "'a::{complete_linorder, linorder_topology, first_countable_topology} \<Rightarrow>
    'b::{complete_linorder, linorder_topology}"
  shows "inf_continuous f \<longleftrightarrow> (\<forall>x. continuous (at_right x) f) \<and> mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf_continuous f = ((\<forall>x. continuous (at_right x) f) \<and> mono f)
[PROOF STEP]
using inf_continuous_at_right[of f] continuous_at_right_imp_inf_continuous[of f]
    inf_continuous_mono[of f]
[PROOF STATE]
proof (prove)
using this:
inf_continuous f \<Longrightarrow> continuous (at_right ?x) f
\<lbrakk>mono f; \<And>x. continuous (at_right x) f\<rbrakk> \<Longrightarrow> inf_continuous f
inf_continuous f \<Longrightarrow> mono f

goal (1 subgoal):
 1. inf_continuous f = ((\<forall>x. continuous (at_right x) f) \<and> mono f)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in pair_sigma_finite) emeasure_pair_measure_alt2:
  assumes A: "A \<in> sets (M1 \<Otimes>\<^sub>M M2)"
  shows "emeasure (M1 \<Otimes>\<^sub>M M2) A = (\<integral>\<^sup>+y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2)"
    (is "_ = ?\<nu> A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2
[PROOF STEP]
have [simp]: "\<And>y. (Pair y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1))) = (\<lambda>x. (x, y)) -` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. Pair y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1)) = (\<lambda>x. (x, y)) -` A
[PROOF STEP]
using sets.sets_into_space[OF A]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> space (M1 \<Otimes>\<^sub>M M2)

goal (1 subgoal):
 1. \<And>y. Pair y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1)) = (\<lambda>x. (x, y)) -` A
[PROOF STEP]
by (auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
Pair ?y -` ((\<lambda>(x, y). (y, x)) -` A \<inter> space (M2 \<Otimes>\<^sub>M M1)) = (\<lambda>x. (x, ?y)) -` A

goal (1 subgoal):
 1. emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> sets (M1 \<Otimes>\<^sub>M M2)

goal (1 subgoal):
 1. emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2
[PROOF STEP]
by (subst distr_pair_swap)
       (simp_all del: vimage_Int add: measurable_sets[OF measurable_pair_swap']
                 M1.emeasure_pair_measure_alt emeasure_distr[OF measurable_pair_swap' A])
[PROOF STATE]
proof (state)
this:
emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ y. emeasure M1 ((\<lambda>x. (x, y)) -` A) \<partial>M2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fprod_finsert: "(finsert a as) |\<times>| (finsert b bs) =
   finsert (a, b) (fimage (\<lambda>b. (a, b)) bs |\<union>| fimage (\<lambda>a. (a, b)) as |\<union>| (as |\<times>| bs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsert a as |\<times>| finsert b bs = finsert (a, b) (Pair a |`| bs |\<union>| (\<lambda>a. (a, b)) |`| as |\<union>| as |\<times>| bs)
[PROOF STEP]
apply (simp add: fprod_def fset_both_sides Abs_fset_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert (a, b) (fset as \<times> insert b (fset bs) \<union> insert a (fset as) \<times> fset bs) = insert (a, b) (Pair a ` fset bs \<union> (\<lambda>a. (a, b)) ` fset as \<union> fset as \<times> fset bs)
[PROOF STEP]
by auto


[STATEMENT]
lemma distr_bst_of_list_tree_sigma_count_space: "
   distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list =
     distr (random_perm xs) (count_space (trees A)) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (count_space (trees A)) bst_of_list
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. distr (random_perm xs) (tree_sigma (count_space A)) bst_of_list = distr (random_perm xs) (count_space (trees A)) bst_of_list
[PROOF STEP]
by (intro distr_cong)  (auto intro!: sets_tree_sigma_count_space)


[STATEMENT]
lemma "(((G-->A) --> J) --> D --> E) --> (((H-->B)-->I)-->C-->J)
      --> (A-->H) --> F --> G --> (((C-->B)-->I)-->D)-->(A-->C)
      --> (((F-->A)-->B) --> I) --> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((G \<longrightarrow> A) \<longrightarrow> J) \<longrightarrow> D \<longrightarrow> E) \<longrightarrow> (((H \<longrightarrow> B) \<longrightarrow> I) \<longrightarrow> C \<longrightarrow> J) \<longrightarrow> (A \<longrightarrow> H) \<longrightarrow> F \<longrightarrow> G \<longrightarrow> (((C \<longrightarrow> B) \<longrightarrow> I) \<longrightarrow> D) \<longrightarrow> (A \<longrightarrow> C) \<longrightarrow> (((F \<longrightarrow> A) \<longrightarrow> B) \<longrightarrow> I) \<longrightarrow> E
[PROOF STEP]
by iprover


[STATEMENT]
lemma "[| (x::nat) ~= y; a + 2 = b; a < y; y < b; a < x; x < b |] ==> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> y; a + 2 = b; a < y; y < b; a < x; x < b\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by linarith


[STATEMENT]
lemma fls_base_factor_mult_fls_X_inv_power:
  shows "fls_base_factor (fls_X_inv ^ n * f) = fls_base_factor f"
  and   "fls_base_factor (f * fls_X_inv ^ n) = fls_base_factor f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_base_factor (fls_X_inv ^ n * f) = fls_base_factor f &&& fls_base_factor (f * fls_X_inv ^ n) = fls_base_factor f
[PROOF STEP]
using fls_base_factor_shift[of "int n" f]
[PROOF STATE]
proof (prove)
using this:
fls_base_factor (fls_shift (int n) f) = fls_base_factor f

goal (1 subgoal):
 1. fls_base_factor (fls_X_inv ^ n * f) = fls_base_factor f &&& fls_base_factor (f * fls_X_inv ^ n) = fls_base_factor f
[PROOF STEP]
by    (auto simp: fls_X_inv_power_times_conv_shift)


[STATEMENT]
lemma "4 * r\<^sup>2 = p\<^sup>2 - 4 * q \<and> r \<ge> (0::real) \<and> x\<^sup>2 + p * x + q = 0 \<longrightarrow>
    2 * (x::real) = - p + 2 * r \<or> 2 * x = - p - 2 * r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * r\<^sup>2 = p\<^sup>2 - 4 * q \<and> 0 \<le> r \<and> x\<^sup>2 + p * x + q = 0 \<longrightarrow> 2 * x = - p + 2 * r \<or> 2 * x = - p - 2 * r
[PROOF STEP]
by sos


[STATEMENT]
lemma filtermap_at_top_linear_eq:
  fixes c::"'a::linordered_field"
  assumes "c\<noteq>0"
  shows "filtermap (\<lambda>x. x * c + b) at_top = (if c>0 then at_top else at_bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
proof (cases "c>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
 2. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
(0::'a) < c

goal (2 subgoals):
 1. (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
 2. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) < c
[PROOF STEP]
have "filtermap (\<lambda>x. x * c + b) at_top = at_top"
[PROOF STATE]
proof (prove)
using this:
(0::'a) < c

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = at_top
[PROOF STEP]
apply (intro filtermap_fun_inverse[of "\<lambda>x. (x-b) / c"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (0::'a) < c \<Longrightarrow> LIM x at_top. (x - b) / c :> at_top
 2. (0::'a) < c \<Longrightarrow> LIM x at_top. x * c + b :> at_top
 3. (0::'a) < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. (x - b) / c * c + b = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> LIM x at_top. (x - b) / c :> at_top
[PROOF STEP]
unfolding eventually_at_top_linorder filterlim_at_top
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> \<forall>Z. \<exists>N. \<forall>n\<ge>N. Z \<le> (n - b) / c
[PROOF STEP]
by (meson le_diff_eq pos_le_divide_eq)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (0::'a) < c \<Longrightarrow> LIM x at_top. x * c + b :> at_top
 2. (0::'a) < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. (x - b) / c * c + b = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> LIM x at_top. x * c + b :> at_top
[PROOF STEP]
unfolding eventually_at_top_linorder filterlim_at_top
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> \<forall>Z. \<exists>N. \<forall>n\<ge>N. Z \<le> n * c + b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Z. (0::'a) < c \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. Z \<le> n * c + b
[PROOF STEP]
by (metis mult.commute real_le_affinity)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> \<forall>\<^sub>F x in at_top. (x - b) / c * c + b = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. x * c + b) at_top = at_top

goal (2 subgoals):
 1. (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
 2. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap (\<lambda>x. x * c + b) at_top = at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. x * c + b) at_top = at_top

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
using \<open>c>0\<close>
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. x * c + b) at_top = at_top
(0::'a) < c

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)

goal (1 subgoal):
 1. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (0::'a) < c

goal (1 subgoal):
 1. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (0::'a) < c
[PROOF STEP]
have "c<0"
[PROOF STATE]
proof (prove)
using this:
\<not> (0::'a) < c

goal (1 subgoal):
 1. c < (0::'a)
[PROOF STEP]
using \<open>c\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> (0::'a) < c
c \<noteq> (0::'a)

goal (1 subgoal):
 1. c < (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c < (0::'a)

goal (1 subgoal):
 1. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c < (0::'a)
[PROOF STEP]
have "filtermap (\<lambda>x. x * c + b) at_top = at_bot"
[PROOF STATE]
proof (prove)
using this:
c < (0::'a)

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = at_bot
[PROOF STEP]
apply (intro filtermap_fun_inverse[of "\<lambda>x. (x-b) / c"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. c < (0::'a) \<Longrightarrow> LIM x at_bot. (x - b) / c :> at_top
 2. c < (0::'a) \<Longrightarrow> LIM x at_top. x * c + b :> at_bot
 3. c < (0::'a) \<Longrightarrow> \<forall>\<^sub>F x in at_bot. (x - b) / c * c + b = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> LIM x at_bot. (x - b) / c :> at_top
[PROOF STEP]
unfolding eventually_at_bot_linorder filterlim_at_top
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> \<forall>Z. \<exists>N. \<forall>n\<le>N. Z \<le> (n - b) / c
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c < (0::'a) \<Longrightarrow> LIM x at_top. x * c + b :> at_bot
 2. c < (0::'a) \<Longrightarrow> \<forall>\<^sub>F x in at_bot. (x - b) / c * c + b = x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> LIM x at_top. x * c + b :> at_bot
[PROOF STEP]
unfolding eventually_at_top_linorder filterlim_at_bot
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> \<forall>Z. \<exists>N. \<forall>n\<ge>N. n * c + b \<le> Z
[PROOF STEP]
by (meson le_diff_eq neg_divide_le_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < (0::'a) \<Longrightarrow> \<forall>\<^sub>F x in at_bot. (x - b) / c * c + b = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. x * c + b) at_top = at_bot

goal (1 subgoal):
 1. \<not> (0::'a) < c \<Longrightarrow> filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap (\<lambda>x. x * c + b) at_top = at_bot
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. x * c + b) at_top = at_bot

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
using \<open>c<0\<close>
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>x. x * c + b) at_top = at_bot
c < (0::'a)

goal (1 subgoal):
 1. filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filtermap (\<lambda>x. x * c + b) at_top = (if (0::'a) < c then at_top else at_bot)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_children_Cons:
  \<open>set (children A r (p # z)) =
    {hs @ ts |hs ts. hs \<in> set (parts A r p) \<and>
      ts \<in> set (children (remdups (A @ subtermFms (concat (parts A r p)))) r z)}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (children A r (p # z)) = {hs @ ts |hs ts. hs \<in> set (parts A r p) \<and> ts \<in> set (children (remdups (A @ subtermFms (concat (parts A r p)))) r z)}
[PROOF STEP]
using list_prod_is_cartesian
[PROOF STATE]
proof (prove)
using this:
set (list_prod ?hs ?ts) = {h @ t |h t. h \<in> set ?hs \<and> t \<in> set ?ts}

goal (1 subgoal):
 1. set (children A r (p # z)) = {hs @ ts |hs ts. hs \<in> set (parts A r p) \<and> ts \<in> set (children (remdups (A @ subtermFms (concat (parts A r p)))) r z)}
[PROOF STEP]
by (metis children.simps(2))


[STATEMENT]
lemma vdw_lemmaE:
  fixes a b :: int
  assumes "vdw_lemma k m l n"
    "b + 1 \<ge> a + int n" "col \<in> {a..b} \<rightarrow> {..<k}"
  obtains start steps where
    "\<And>i. i < m \<Longrightarrow> steps i > 0"
    "is_multi_arith_prog_on (l+1) m start steps a b"
    "let f = multi_arith_prog m start steps
     in  \<forall>c \<in> {0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall> j \<le> s. c j < l) \<longrightarrow>
            col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>steps start. \<lbrakk>\<And>i. i < m \<Longrightarrow> 0 < steps i; is_multi_arith_prog_on (l + 1) m start steps a b; let f = multi_arith_prog m start steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms that
[PROOF STATE]
proof (prove)
using this:
vdw_lemma k m l n
a + int n \<le> b + 1
col \<in> {a..b} \<rightarrow> {..<k}
\<lbrakk>\<And>i. i < m \<Longrightarrow> 0 < ?steps i; is_multi_arith_prog_on (l + 1) m ?start ?steps a b; let f = multi_arith_prog m ?start ?steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>steps start. \<lbrakk>\<And>i. i < m \<Longrightarrow> 0 < steps i; is_multi_arith_prog_on (l + 1) m start steps a b; let f = multi_arith_prog m start steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vdw_lemma_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a b col. a + int n \<le> b + 1 \<and> col \<in> {a..b} \<rightarrow> {..<k} \<longrightarrow> (\<exists>start steps. (\<forall>i<m. 0 < steps i) \<and> is_multi_arith_prog_on (l + 1) m start steps a b \<and> (let f = multi_arith_prog m start steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))))
a + int n \<le> b + 1
col \<in> {a..b} \<rightarrow> {..<k}
\<lbrakk>\<And>i. i < m \<Longrightarrow> 0 < ?steps i; is_multi_arith_prog_on (l + 1) m ?start ?steps a b; let f = multi_arith_prog m ?start ?steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>steps start. \<lbrakk>\<And>i. i < m \<Longrightarrow> 0 < steps i; is_multi_arith_prog_on (l + 1) m start steps a b; let f = multi_arith_prog m start steps in \<forall>c\<in>{0..<m} \<rightarrow> {0..l}. \<forall>s<m. (\<forall>j\<le>s. c j < l) \<longrightarrow> col (f c) = col (f (\<lambda>i. if i \<le> s then 0 else c i))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma list_concat_minus_list_concat: "(s @ t) - (s @ z) = t - z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s @ t - (s @ z) = t - z
[PROOF STEP]
by (simp add: minus_list_def)


[STATEMENT]
lemma rel_star_contl: "X O Y^* = (\<Union>n. X O rel_dioid.power Y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X O Y\<^sup>* = (\<Union>n. X O rel_dioid.power Y n)
[PROOF STEP]
by (metis rel_star_def relcomp_UNION_distrib)


[STATEMENT]
lemma int_xor_assoc: "(x XOR y) XOR z = x XOR (y XOR z)"
  for x y z :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x XOR y) XOR z = x XOR y XOR z
[PROOF STEP]
by (auto simp add: bin_eq_iff bin_nth_ops)


[STATEMENT]
lemma eq_dfa_error: "\<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) bss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) bss)
[PROOF STEP]
apply (induct bss)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) [])
 2. \<And>a bss. \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) bss) \<Longrightarrow> \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) (a # bss))
[PROOF STEP]
apply (simp add: eq_dfa_def split_beta dfa_accepting_def nth_append)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a bss. \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) bss) \<Longrightarrow> \<not> dfa_accepting (eq_dfa n ks l) (dfa_steps (eq_dfa n ks l) (length (snd (dioph_dfs n ks l))) (a # bss))
[PROOF STEP]
apply (simp add: eq_dfa_def split_beta nth_append dfa_trans_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma if_Not_x: "(if p then \<not> x else x) = (p = (\<not> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p then \<not> x else x) = (p = (\<not> x))
[PROOF STEP]
by auto


[STATEMENT]
lemma pred_mono: "\<lbrakk> m < n; 0 < m \<rbrakk> \<Longrightarrow> m - Suc 0 < n - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < n; 0 < m\<rbrakk> \<Longrightarrow> m - Suc 0 < n - Suc 0
[PROOF STEP]
by simp


[STATEMENT]
lemma [simp]: "rank 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank 0 = 0
[PROOF STEP]
by (simp add: rank_def) (metis (lifting) HPow_iff Least_equality Ord_0 Vset_succ zero_le)


[STATEMENT]
lemma total_def_var_1: "is_total x \<longleftrightarrow> x ; 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_total x = (x ; 1 = 1)
[PROOF STEP]
by (metis inf_top_right le_iff_inf one_conv total_one is_total_def)


[STATEMENT]
lemma "wordinterval_compress (RangeUnion (RangeUnion (WordInterval (1::32 word) 5)
                                                        (WordInterval 8 10)) (WordInterval 3 7)) =
       WordInterval 1 10"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_compress (RangeUnion (RangeUnion (WordInterval 1 5) (WordInterval 8 10)) (WordInterval 3 7)) = WordInterval 1 10
[PROOF STEP]
by eval


[STATEMENT]
lemma INT_synlr_bot [simp]:
  "(\<Inter>R. unsynlr R) = {\<bottom>} \<times> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (range unsynlr) = {\<bottom>} \<times> UNIV
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<forall>x. (a, b) \<in> unsynlr x \<Longrightarrow> a = \<bottom>
[PROOF STEP]
apply (drule spec[of _ "mksynlr ({\<bottom>} \<times> UNIV)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> unsynlr (mksynlr ({\<bottom>} \<times> UNIV)) \<Longrightarrow> a = \<bottom>
[PROOF STEP]
apply (metis bot_synlr_def mem_Sigma_iff singletonE unsynlr_bot)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cblinfun_of_mat_inverse:
  fixes M::"complex mat"
  defines "nA \<equiv> length (canonical_basis :: 'a::{basis_enum,complex_normed_vector} list)"
    and "nB \<equiv> length (canonical_basis :: 'b::{basis_enum,complex_normed_vector} list)"
  assumes "M \<in> carrier_mat nB nA"
  shows "mat_of_cblinfun (cblinfun_of_mat M :: 'a \<Rightarrow>\<^sub>C\<^sub>L 'b) = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (cblinfun_of_mat M) = M
[PROOF STEP]
by (smt (verit) assms(3) basis_enum_of_vec_inverse carrier_matD(1) carrier_vecD cblinfun_of_mat.rep_eq dim_mult_mat_vec eq_mat_on_vecI mat_carrier mat_of_cblinfun_def mat_of_cblinfun_cblinfun_apply nA_def nB_def)


[STATEMENT]
lemma id_matrix_dim: "dim_row (id_matrix nr nc) = nr" "dim_col (id_matrix nr nc) = nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (id_matrix nr nc) = nr &&& dim_col (id_matrix nr nc) = nc
[PROOF STEP]
by (simp_all add: id_matrix_def)


[STATEMENT]
lemma concat_eq_append_conv:
  "concat xss = ys @ zs \<longleftrightarrow>
  (if xss = [] then ys = [] \<and> zs = []
   else \<exists>xss1 xs xs' xss2. xss = xss1 @ (xs @ xs') # xss2 \<and> ys = concat xss1 @ xs \<and> zs = xs' @ concat xss2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (concat xss = ys @ zs) = (if xss = [] then ys = [] \<and> zs = [] else \<exists>xss1 xs xs' xss2. xss = xss1 @ (xs @ xs') # xss2 \<and> ys = concat xss1 @ xs \<and> zs = xs' @ concat xss2)
[PROOF STEP]
by(auto dest: concat_eq_appendD)


[STATEMENT]
lemma joinable_iff_join_not_null:
    shows "joinable t u \<longleftrightarrow> t \<squnion> u \<noteq> null"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. joinable t u = (t \<squnion> u \<noteq> null)
[PROOF STEP]
by (metis join_def joinable_iff_arr_join not_arr_null)


[STATEMENT]
lemma cnt_compose:
  "\<lbrakk> f \<in> cnt S T; g \<in> cnt T U \<rbrakk> \<Longrightarrow> (g \<circ> f) \<in> cnt S U "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> cnt S T; g \<in> cnt T U\<rbrakk> \<Longrightarrow> g \<circ> f \<in> cnt S U
[PROOF STEP]
by (auto intro!: cntI funcset_comp elim!: cntE simp add: vimage_comp)


[STATEMENT]
lemma of_complex_divide_of_complex [simp]:
  assumes "z2 \<noteq> 0"
  shows "(of_complex z1) :\<^sub>h (of_complex z2) = of_complex (z1 / z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex z1 :\<^sub>h of_complex z2 = of_complex (z1 / z2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> 0

goal (1 subgoal):
 1. of_complex z1 :\<^sub>h of_complex z2 = of_complex (z1 / z2)
[PROOF STEP]
unfolding divide_def
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> 0

goal (1 subgoal):
 1. of_complex z1 *\<^sub>h reciprocal (of_complex z2) = of_complex (z1 / z2)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z2 z1. z2 \<noteq> 0 \<Longrightarrow> of_complex_hcoords z1 *\<^sub>h\<^sub>c reciprocal_hcoords (of_complex_hcoords z2) \<approx> of_complex_hcoords (z1 / z2)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z2 z1. z2 \<noteq> 0 \<Longrightarrow> of_complex_cvec z1 *\<^sub>v reciprocal_cvec (of_complex_cvec z2) \<approx>\<^sub>v of_complex_cvec (z1 / z2)
[PROOF STEP]
by (simp, rule_tac x="1/z2" in exI, simp)


[STATEMENT]
lemma length_permute_list [simp]: "length (permute_list f xs) = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (permute_list f xs) = length xs
[PROOF STEP]
by (simp add: permute_list_def)


[STATEMENT]
lemma mat_of_cols_mult_mat_vec_permute_list:
  fixes v ::"'a::comm_ring list"
  assumes "f permutes {..<length ss}"
  assumes "length ss = length v"
  shows
    "mat_of_cols nr (permute_list f ss) *\<^sub>v vec_of_list (permute_list f v) =
     mat_of_cols nr ss *\<^sub>v vec_of_list v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols nr (permute_list f ss) *\<^sub>v vec_of_list (permute_list f v) = mat_of_cols nr ss *\<^sub>v vec_of_list v
[PROOF STEP]
unfolding mat_of_cols_def mult_mat_vec_def vec_eq_iff scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec (dim_row (mat nr (length (permute_list f ss)) (\<lambda>(i, j). permute_list f ss ! j $ i))) (\<lambda>i. \<Sum>ia = 0..<dim_vec (vec_of_list (permute_list f v)). row (mat nr (length (permute_list f ss)) (\<lambda>(i, j). permute_list f ss ! j $ i)) i $ ia * vec_of_list (permute_list f v) $ ia)) = dim_vec (vec (dim_row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i))) (\<lambda>i. \<Sum>ia = 0..<dim_vec (vec_of_list v). row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i)) i $ ia * vec_of_list v $ ia)) \<and> (\<forall>i<dim_vec (vec (dim_row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i))) (\<lambda>i. \<Sum>ia = 0..<dim_vec (vec_of_list v). row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i)) i $ ia * vec_of_list v $ ia)). vec (dim_row (mat nr (length (permute_list f ss)) (\<lambda>(i, j). permute_list f ss ! j $ i))) (\<lambda>i. \<Sum>ia = 0..<dim_vec (vec_of_list (permute_list f v)). row (mat nr (length (permute_list f ss)) (\<lambda>(i, j). permute_list f ss ! j $ i)) i $ ia * vec_of_list (permute_list f v) $ ia) $ i = vec (dim_row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i))) (\<lambda>i. \<Sum>ia = 0..<dim_vec (vec_of_list v). row (mat nr (length ss) (\<lambda>(i, j). ss ! j $ i)) i $ ia * vec_of_list v $ ia) $ i)
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
assume "i < nr"
[PROOF STATE]
proof (state)
this:
i < nr

goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
from sum.permute[OF assms(1)]
[PROOF STATE]
proof (chain)
picking this:
sum ?g {..<length ss} = sum (?g \<circ> f) {..<length ss}
[PROOF STEP]
have "(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) =
  sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}"
[PROOF STATE]
proof (prove)
using this:
sum ?g {..<length ss} = sum (?g \<circ> f) {..<length ss}

goal (1 subgoal):
 1. (\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}

goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}

goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
have "... = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss} = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)
[PROOF STEP]
using assms(2) calculation lessThan_atLeast0
[PROOF STATE]
proof (prove)
using this:
length ss = length v
(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}
{..<?n} = {0..<?n}

goal (1 subgoal):
 1. sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss} = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss} = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)

goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}
sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss} = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)
[PROOF STEP]
have *: "(\<Sum>ia = 0..<length v.
             ss ! f ia $ i * v ! f ia) =
         (\<Sum>ia = 0..<length v.
             ss ! ia $ i * v ! ia)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>ia<length ss. ss ! f ia $ i * v ! f ia) = sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss}
sum ((\<lambda>ia. ss ! f ia $ i * v ! f ia) \<circ> f) {..<length ss} = (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia)

goal (1 subgoal):
 1. (\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia) = (\<Sum>ia = 0..<length v. ss ! ia $ i * v ! ia)
[PROOF STEP]
by (metis (mono_tags, lifting) \<open>\<And>g. sum g {..<length ss} = sum (g \<circ> f) {..<length ss}\<close> assms(2) comp_apply lessThan_atLeast0 sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia) = (\<Sum>ia = 0..<length v. ss ! ia $ i * v ! ia)

goal (1 subgoal):
 1. \<And>i. i < nr \<Longrightarrow> (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
show "(\<Sum>ia = 0..<length v.
         vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia *
         vec_of_list (permute_list f v) $ ia) =
         (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
using assms *
[PROOF STATE]
proof (prove)
using this:
f permutes {..<length ss}
length ss = length v
(\<Sum>ia = 0..<length v. ss ! f ia $ i * v ! f ia) = (\<Sum>ia = 0..<length v. ss ! ia $ i * v ! ia)

goal (1 subgoal):
 1. (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)
[PROOF STEP]
by (auto simp add: permute_list_nth vec_of_list_index)
[PROOF STATE]
proof (state)
this:
(\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. permute_list f ss ! j $ i) $ ia * vec_of_list (permute_list f v) $ ia) = (\<Sum>ia = 0..<length v. vec (length ss) (\<lambda>j. ss ! j $ i) $ ia * vec_of_list v $ ia)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_set_fold [code]: "A - set xs = fold Set.remove xs A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - set xs = fold Set.remove xs A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A - set xs = fold Set.remove xs A
[PROOF STEP]
interpret comp_fun_idem Set.remove
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_idem Set.remove
[PROOF STEP]
by (fact comp_fun_idem_remove)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A - set xs = fold Set.remove xs A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - set xs = fold Set.remove xs A
[PROOF STEP]
by (simp add: minus_fold_remove [of _ A] fold_set_fold)
[PROOF STATE]
proof (state)
this:
A - set xs = fold Set.remove xs A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equiv_funE:
  assumes "f \<cong> g"
  obtains n c\<^sub>1 c\<^sub>2 where "c\<^sub>1 > 0" and "c\<^sub>2 > 0"
    and "\<And>m. m > n \<Longrightarrow> f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c\<^sub>1 c\<^sub>2 n. \<lbrakk>0 < c\<^sub>1; 0 < c\<^sub>2; \<And>m. n < m \<Longrightarrow> f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<cong> g

goal (1 subgoal):
 1. (\<And>c\<^sub>1 c\<^sub>2 n. \<lbrakk>0 < c\<^sub>1; 0 < c\<^sub>2; \<And>m. n < m \<Longrightarrow> f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equiv_fun_def
[PROOF STATE]
proof (prove)
using this:
\<exists>c\<^sub>1>0. \<exists>c\<^sub>2>0. \<exists>n. \<forall>m>n. f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m

goal (1 subgoal):
 1. (\<And>c\<^sub>1 c\<^sub>2 n. \<lbrakk>0 < c\<^sub>1; 0 < c\<^sub>2; \<And>m. n < m \<Longrightarrow> f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma fold_mset_union [simp]: "fold_mset f s (M + N) = fold_mset f (fold_mset f s M) N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_mset f s (M + N) = fold_mset f (fold_mset f s M) N
[PROOF STEP]
by (induct M) (simp_all add: fold_mset_fun_left_comm)


[STATEMENT]
lemma lincomb_list_alt2:
  assumes "\<And>v. v \<in> set s \<Longrightarrow> dim_vec v = n"
  assumes "\<And>i. i \<in> set ls \<Longrightarrow> i < length s"
  shows "
    sumlist (map2 (\<lambda>i j. i \<cdot>\<^sub>v s ! j) (map (\<lambda>i. c i) ls) ls) =
    sumlist (map2 (\<lambda>i j. i \<cdot>\<^sub>v s ! j) (map (\<lambda>i. c i) (filter (\<lambda>i. c i \<noteq> 0) ls)) (filter (\<lambda>i. c i \<noteq> 0) ls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> set ls \<Longrightarrow> ?i1 < length s

goal (1 subgoal):
 1. M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls))
[PROOF STEP]
proof (induction ls)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i \<in> set [] \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c []) []) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) [])) (filter (\<lambda>i. c i \<noteq> (0::'a)) []))
 2. \<And>a ls. \<lbrakk>(\<And>i. i \<in> set ls \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)); \<And>i. i \<in> set (a # ls) \<Longrightarrow> i < length s\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # ls)) (a # ls)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
?i1 \<in> set [] \<Longrightarrow> ?i1 < length s

goal (2 subgoals):
 1. (\<And>i. i \<in> set [] \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c []) []) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) [])) (filter (\<lambda>i. c i \<noteq> (0::'a)) []))
 2. \<And>a ls. \<lbrakk>(\<And>i. i \<in> set ls \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)); \<And>i. i \<in> set (a # ls) \<Longrightarrow> i < length s\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # ls)) (a # ls)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i1 \<in> set [] \<Longrightarrow> ?i1 < length s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> set [] \<Longrightarrow> ?i1 < length s

goal (1 subgoal):
 1. M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c []) []) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) [])) (filter (\<lambda>i. c i \<noteq> (0::'a)) []))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c []) []) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) [])) (filter (\<lambda>i. c i \<noteq> (0::'a)) []))

goal (1 subgoal):
 1. \<And>a ls. \<lbrakk>(\<And>i. i \<in> set ls \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)); \<And>i. i \<in> set (a # ls) \<Longrightarrow> i < length s\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # ls)) (a # ls)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ls. \<lbrakk>(\<And>i. i \<in> set ls \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)); \<And>i. i \<in> set (a # ls) \<Longrightarrow> i < length s\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # ls)) (a # ls)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls)))
[PROOF STEP]
case (Cons a s)
[PROOF STATE]
proof (state)
this:
(\<And>i. i \<in> set s \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
?i1 \<in> set (a # s) \<Longrightarrow> ?i1 < length s

goal (1 subgoal):
 1. \<And>a ls. \<lbrakk>(\<And>i. i \<in> set ls \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c ls) ls) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)) (filter (\<lambda>i. c i \<noteq> (0::'a)) ls)); \<And>i. i \<in> set (a # ls) \<Longrightarrow> i < length s\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # ls)) (a # ls)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # ls)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>i. i \<in> set s \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
?i1 \<in> set (a # s) \<Longrightarrow> ?i1 < length s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> set s \<Longrightarrow> i < length s) \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
?i1 \<in> set (a # s) \<Longrightarrow> ?i1 < length s

goal (1 subgoal):
 1. M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # s)) (a # s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # s))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # s)))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> (0::'a) \<cdot>\<^sub>v s ! a + M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
[PROOF STEP]
apply (subst smult_l_null)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> s ! a \<in> carrier_vec n
 2. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> 0\<^sub>v n + M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
[PROOF STEP]
apply (simp add: assms(1) carrier_vecI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> 0\<^sub>v n + M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
[PROOF STEP]
apply (subst left_zero_vec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) \<in> carrier_vec n
 2. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
[PROOF STEP]
apply (subst sumlist_carrier)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> set (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) \<subseteq> carrier_vec n
 2. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> True
 3. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a)\<rbrakk> \<Longrightarrow> M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c s) s) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s)); \<And>i. i = a \<or> i \<in> set s \<Longrightarrow> i < length s; c a = (0::'a); (aa, b) \<in> set (zip (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) s)) (filter (\<lambda>i. c i \<noteq> (0::'a)) s))\<rbrakk> \<Longrightarrow> s ! b \<in> carrier_vec n
[PROOF STEP]
by (metis (no_types, lifting) assms(1) carrier_dim_vec mem_Collect_eq nth_mem set_filter set_zip_rightD)
[PROOF STATE]
proof (state)
this:
M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (a # s)) (a # s)) = M.sumlist (map2 (\<lambda>x y. x \<cdot>\<^sub>v s ! y) (map c (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # s))) (filter (\<lambda>i. c i \<noteq> (0::'a)) (a # s)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_right_inverse':
  fixes   f :: "'a::ring_1 fls"
  assumes "x * f $$ fls_subdegree f = 1" "f $$ fls_subdegree f * y = 1"
  \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close>
  shows   "f * fls_left_inverse f x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * fls_left_inverse f x = 1
[PROOF STEP]
using   assms fls_left_inverse_eq_fls_right_inverse[of x f y] fls_right_inverse[of f y]
[PROOF STATE]
proof (prove)
using this:
x * f $$ fls_subdegree f = (1::'a)
f $$ fls_subdegree f * y = (1::'a)
\<lbrakk>x * f $$ fls_subdegree f = (1::'a); f $$ fls_subdegree f * y = (1::'a)\<rbrakk> \<Longrightarrow> fls_left_inverse f x = fls_right_inverse f y
f $$ fls_subdegree f * y = (1::'a) \<Longrightarrow> f * fls_right_inverse f y = 1

goal (1 subgoal):
 1. f * fls_left_inverse f x = 1
[PROOF STEP]
by      simp


[STATEMENT]
lemma equiv_eq_app_right: "equiv UNIV (eq_app_right L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv UNIV (eq_app_right L)
[PROOF STEP]
by (simp add: equivI refl_on_def sym_def trans_def eq_app_right_def)


[STATEMENT]
lemma representation_sum:
  "independent basis \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> v i \<in> span basis) \<Longrightarrow>
    representation basis (sum v I) = (\<lambda>b. \<Sum>i\<in>I. representation basis (v i) b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>independent basis; \<And>i. i \<in> I \<Longrightarrow> v i \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (sum v I) = (\<lambda>b. \<Sum>i\<in>I. representation basis (v i) b)
[PROOF STEP]
by (induction I rule: infinite_finite_induct)
     (auto simp: representation_zero representation_add span_sum)


[STATEMENT]
lemma oLimit_shift:
"\<forall>n. f n < oLimit f \<Longrightarrow> oLimit (\<lambda>n. f (n + k)) = oLimit f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f n < oLimit f \<Longrightarrow> oLimit (\<lambda>n. f (n + k)) = oLimit f
[PROOF STEP]
apply (induct_tac k, simp, rename_tac k)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<forall>n. f n < oLimit f; oLimit (\<lambda>n. f (n + k)) = oLimit f\<rbrakk> \<Longrightarrow> oLimit (\<lambda>n. f (n + Suc k)) = oLimit f
[PROOF STEP]
apply (simp only: add_Suc_right add_Suc[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>\<forall>n. f n < oLimit f; oLimit (\<lambda>n. f (n + k)) = oLimit f\<rbrakk> \<Longrightarrow> oLimit (\<lambda>n. f (Suc n + k)) = oLimit f
[PROOF STEP]
apply (rule trans[OF oLimit_Suc], simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vertex_set_int:
  assumes "SimplicialComplex Y"
  shows   "\<Union>(X\<inter>Y) = \<Union>X \<inter> \<Union>Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (X \<inter> Y) = \<Union> X \<inter> \<Union> Y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (X \<inter> Y) \<subseteq> \<Union> X \<inter> \<Union> Y
 2. \<Union> X \<inter> \<Union> Y \<subseteq> \<Union> (X \<inter> Y)
[PROOF STEP]
have "\<And>v. v \<in> \<Union>X \<inter> \<Union>Y \<Longrightarrow> v\<in> \<Union>(X\<inter>Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. v \<in> \<Union> X \<inter> \<Union> Y \<Longrightarrow> v \<in> \<Union> (X \<inter> Y)
[PROOF STEP]
using faces SimplicialComplex.faces[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<subseteq> ?x\<rbrakk> \<Longrightarrow> ?y \<in> X
\<lbrakk>?x \<in> Y; ?y \<subseteq> ?x\<rbrakk> \<Longrightarrow> ?y \<in> Y

goal (1 subgoal):
 1. \<And>v. v \<in> \<Union> X \<inter> \<Union> Y \<Longrightarrow> v \<in> \<Union> (X \<inter> Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?v \<in> \<Union> X \<inter> \<Union> Y \<Longrightarrow> ?v \<in> \<Union> (X \<inter> Y)

goal (2 subgoals):
 1. \<Union> (X \<inter> Y) \<subseteq> \<Union> X \<inter> \<Union> Y
 2. \<Union> X \<inter> \<Union> Y \<subseteq> \<Union> (X \<inter> Y)
[PROOF STEP]
thus "\<Union>(X\<inter>Y) \<supseteq> \<Union>X \<inter> \<Union>Y"
[PROOF STATE]
proof (prove)
using this:
?v \<in> \<Union> X \<inter> \<Union> Y \<Longrightarrow> ?v \<in> \<Union> (X \<inter> Y)

goal (1 subgoal):
 1. \<Union> X \<inter> \<Union> Y \<subseteq> \<Union> (X \<inter> Y)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<Union> X \<inter> \<Union> Y \<subseteq> \<Union> (X \<inter> Y)

goal (1 subgoal):
 1. \<Union> (X \<inter> Y) \<subseteq> \<Union> X \<inter> \<Union> Y
[PROOF STEP]
qed auto


[STATEMENT]
lemma prime_factors_list:
  fixes n :: nat assumes "3 < n" "\<not> prime n"
  shows "\<exists> qs. prime_factors n = set qs \<and> prod_list qs = n \<and> length qs \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
3 < n
\<not> prime n

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
proof (induction n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y < n; 3 < ?y; \<not> prime ?y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors ?y = set qs \<and> prod_list qs = ?y \<and> 2 \<le> length qs
3 < n
\<not> prime n

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
obtain p where "p \<in> prime_factors n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. p \<in># prime_factorization n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>n > 3\<close> prime_factors_elem
[PROOF STATE]
proof (prove)
using this:
3 < n
1 < ?n \<Longrightarrow> \<exists>p. p \<in># prime_factorization ?n

goal (1 subgoal):
 1. (\<And>p. p \<in># prime_factorization n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
p \<in># prime_factorization n

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in># prime_factorization n
[PROOF STEP]
have p':"2 \<le> p" "p \<le> n" "p dvd n" "prime p"
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization n

goal (1 subgoal):
 1. (2 \<le> p &&& p \<le> n) &&& p dvd n &&& prime p
[PROOF STEP]
using \<open>3 < n\<close>
[PROOF STATE]
proof (prove)
using this:
p \<in># prime_factorization n
3 < n

goal (1 subgoal):
 1. (2 \<le> p &&& p \<le> n) &&& p dvd n &&& prime p
[PROOF STEP]
by (auto elim: p_in_prime_factorsE)
[PROOF STATE]
proof (state)
this:
2 \<le> p
p \<le> n
p dvd n
prime p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
2 \<le> p
p \<le> n
p dvd n
prime p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
assume "n div p > 3" "\<not> prime (n div p)"
[PROOF STATE]
proof (state)
this:
3 < n div p
\<not> prime (n div p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
3 < n div p
\<not> prime (n div p)
[PROOF STEP]
obtain qs
        where "prime_factors (n div p) = set qs" "prod_list qs = (n div p)" "length qs \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
3 < n div p
\<not> prime (n div p)

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>prime_factors (n div p) = set qs; prod_list qs = n div p; 2 \<le> length qs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using p'
[PROOF STATE]
proof (prove)
using this:
3 < n div p
\<not> prime (n div p)
2 \<le> p
p \<le> n
p dvd n
prime p

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>prime_factors (n div p) = set qs; prod_list qs = n div p; 2 \<le> length qs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by atomize_elim (auto intro: less simp: div_gt_0)
[PROOF STATE]
proof (state)
this:
prime_factors (n div p) = set qs
prod_list qs = n div p
2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime_factors (n div p) = set qs
prod_list qs = n div p
2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
have "prime_factors (p * (n div p)) = insert p (prime_factors (n div p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
using \<open>3 < n\<close> \<open>2 \<le> p\<close> \<open>p \<le> n\<close> \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
3 < n
2 \<le> p
p \<le> n
prime p

goal (1 subgoal):
 1. prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
by (auto simp: prime_factors_product div_gt_0 prime_factors_of_prime)
[PROOF STATE]
proof (state)
this:
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prime_factors (n div p) = set qs
prod_list qs = n div p
2 \<le> length qs
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
have "prime_factors n = set (p # qs)" "prod_list (p # qs) = n" "length (p#qs) \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
prime_factors (n div p) = set qs
prod_list qs = n div p
2 \<le> length qs
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))

goal (1 subgoal):
 1. prime_factors n = set (p # qs) &&& prod_list (p # qs) = n &&& 2 \<le> length (p # qs)
[PROOF STEP]
using \<open>p dvd n\<close>
[PROOF STATE]
proof (prove)
using this:
prime_factors (n div p) = set qs
prod_list qs = n div p
2 \<le> length qs
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
p dvd n

goal (1 subgoal):
 1. prime_factors n = set (p # qs) &&& prod_list (p # qs) = n &&& 2 \<le> length (p # qs)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
prime_factors n = set (p # qs)
prod_list (p # qs) = n
2 \<le> length (p # qs)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
prime_factors n = set (p # qs)
prod_list (p # qs) = n
2 \<le> length (p # qs)

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
assume "prime (n div p)"
[PROOF STATE]
proof (state)
this:
prime (n div p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime (n div p)
[PROOF STEP]
obtain qs
        where "prime_factors (n div p) = set qs" "prod_list qs = (n div p)" "length qs = 1"
[PROOF STATE]
proof (prove)
using this:
prime (n div p)

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>prime_factors (n div p) = set qs; prod_list qs = n div p; length qs = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_factors_list_prime
[PROOF STATE]
proof (prove)
using this:
prime (n div p)
prime ?n \<Longrightarrow> \<exists>qs. prime_factors ?n = set qs \<and> prod_list qs = ?n \<and> length qs = 1

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>prime_factors (n div p) = set qs; prod_list qs = n div p; length qs = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime_factors (n div p) = set qs
prod_list qs = n div p
length qs = 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime_factors (n div p) = set qs
prod_list qs = n div p
length qs = 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
have "prime_factors (p * (n div p)) = insert p (prime_factors (n div p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
using \<open>3 < n\<close> \<open>2 \<le> p\<close> \<open>p \<le> n\<close> \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
3 < n
2 \<le> p
p \<le> n
prime p

goal (1 subgoal):
 1. prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
by (auto simp: prime_factors_product div_gt_0 prime_factors_of_prime)
[PROOF STATE]
proof (state)
this:
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prime_factors (n div p) = set qs
prod_list qs = n div p
length qs = 1
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
[PROOF STEP]
have "prime_factors n = set (p # qs)" "prod_list (p # qs) = n" "length (p#qs) \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
prime_factors (n div p) = set qs
prod_list qs = n div p
length qs = 1
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))

goal (1 subgoal):
 1. prime_factors n = set (p # qs) &&& prod_list (p # qs) = n &&& 2 \<le> length (p # qs)
[PROOF STEP]
using \<open>p dvd n\<close>
[PROOF STATE]
proof (prove)
using this:
prime_factors (n div p) = set qs
prod_list qs = n div p
length qs = 1
prime_factors (p * (n div p)) = insert p (prime_factors (n div p))
p dvd n

goal (1 subgoal):
 1. prime_factors n = set (p # qs) &&& prod_list (p # qs) = n &&& 2 \<le> length (p # qs)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
prime_factors n = set (p # qs)
prod_list (p # qs) = n
2 \<le> length (p # qs)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
prime_factors n = set (p # qs)
prod_list (p # qs) = n
2 \<le> length (p # qs)

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
note case_prime = this
[PROOF STATE]
proof (state)
this:
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
assume "n div p = 1"
[PROOF STATE]
proof (state)
this:
n div p = 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence "n = p"
[PROOF STATE]
proof (prove)
using this:
n div p = 1

goal (1 subgoal):
 1. n = p
[PROOF STEP]
using \<open>n>3\<close>
[PROOF STATE]
proof (prove)
using this:
n div p = 1
3 < n

goal (1 subgoal):
 1. n = p
[PROOF STEP]
using One_leq_div[OF \<open>p dvd n\<close>] p'(2)
[PROOF STATE]
proof (prove)
using this:
n div p = 1
3 < n
p < n \<Longrightarrow> 1 < n div p
p \<le> n

goal (1 subgoal):
 1. n = p
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
n = p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
n = p

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
using \<open>prime p\<close> \<open>\<not> prime n\<close>
[PROOF STATE]
proof (prove)
using this:
n = p
prime p
\<not> prime n

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
assume "n div p = 2"
[PROOF STATE]
proof (state)
this:
n div p = 2

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
n div p = 2

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
using case_prime
[PROOF STATE]
proof (prove)
using this:
n div p = 2
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
assume "n div p = 3"
[PROOF STATE]
proof (state)
this:
n div p = 3

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
hence ?case
[PROOF STATE]
proof (prove)
using this:
n div p = 3

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
using p' case_prime
[PROOF STATE]
proof (prove)
using this:
n div p = 3
2 \<le> p
p \<le> n
p dvd n
prime p
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
n div p = 3 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 3 < y; \<not> prime y\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors y = set qs \<and> prod_list qs = y \<and> 2 \<le> length qs; 3 < x; \<not> prime x\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors x = set qs \<and> prod_list qs = x \<and> 2 \<le> length qs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 3 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 3 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
using p' div_gt_0[of p n] case_prime
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>3 < n div p; \<not> prime (n div p)\<rbrakk> \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 1 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 2 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
n div p = 3 \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
2 \<le> p
p \<le> n
p dvd n
prime p
\<lbrakk>p \<le> n; 0 < p\<rbrakk> \<Longrightarrow> 0 < n div p
prime (n div p) \<Longrightarrow> \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal (1 subgoal):
 1. \<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>qs. prime_factors n = set qs \<and> prod_list qs = n \<and> 2 \<le> length qs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ltl_ldropn: "ltl (ldropn n xs) = ldropn n (ltl xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltl (ldropn n xs) = ldropn n (ltl xs)
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. ltl (ldropn 0 xs) = ldropn 0 (ltl xs)
 2. \<And>n xs. (\<And>xs. ltl (ldropn n xs) = ldropn n (ltl xs)) \<Longrightarrow> ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>xs. ltl (ldropn 0 xs) = ldropn 0 (ltl xs)
 2. \<And>n xs. (\<And>xs. ltl (ldropn n xs) = ldropn n (ltl xs)) \<Longrightarrow> ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltl (ldropn 0 xs) = ldropn 0 (ltl xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ltl (ldropn 0 xs) = ldropn 0 (ltl xs)

goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltl (ldropn n xs) = ldropn n (ltl xs)) \<Longrightarrow> ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltl (ldropn n xs) = ldropn n (ltl xs)) \<Longrightarrow> ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ltl (ldropn n ?xs) = ldropn n (ltl ?xs)

goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltl (ldropn n xs) = ldropn n (ltl xs)) \<Longrightarrow> ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ltl (ldropn n ?xs) = ldropn n (ltl ?xs)

goal (1 subgoal):
 1. ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)
[PROOF STEP]
by(cases xs)(simp_all add: ldropn_Suc split: llist.split)
[PROOF STATE]
proof (state)
this:
ltl (ldropn (Suc n) xs) = ldropn (Suc n) (ltl xs)

goal:
No subgoals!
[PROOF STEP]
qed