[STATEMENT]
lemma poly_roots_normalize [simp]:
  fixes p :: "'a :: {normalization_semidom, idom_divide} poly"
  shows "poly_roots (normalize p) = poly_roots p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (normalize p) = poly_roots p
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
 2. p \<noteq> 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
 2. p \<noteq> 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
have "poly_roots p = poly_roots (unit_factor p * normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots p = poly_roots (unit_factor p * normalize p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_roots p = poly_roots (unit_factor p * normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
 2. p \<noteq> 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_roots p = poly_roots (unit_factor p * normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
 2. p \<noteq> 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
have "\<dots> = poly_roots (normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (unit_factor p * normalize p) = poly_roots (normalize p)
[PROOF STEP]
unfolding unit_factor_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots ([:unit_factor (Polynomial.lead_coeff p):] * normalize p) = poly_roots (normalize p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_roots (unit_factor p * normalize p) = poly_roots (normalize p)

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
 2. p \<noteq> 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_roots p = poly_roots (normalize p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly_roots p = poly_roots (normalize p)

goal (1 subgoal):
 1. poly_roots (normalize p) = poly_roots p
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
poly_roots (normalize p) = poly_roots p

goal (1 subgoal):
 1. p = 0 \<Longrightarrow> poly_roots (normalize p) = poly_roots p
[PROOF STEP]
qed auto


[STATEMENT]
lemma paths_second_disjoint: "\<lbrakk> xs \<in> paths; ys \<in> paths; xs \<noteq> ys \<rbrakk> \<Longrightarrow> hd (tl xs) \<noteq> hd (tl ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<in> paths; ys \<in> paths; xs \<noteq> ys\<rbrakk> \<Longrightarrow> hd (tl xs) \<noteq> hd (tl ys)
[PROOF STEP]
by (metis paths_disjoint Nil_tl hd_in_set list.set_sel(2)
      paths_second_not_v0 paths_second_not_v1 paths_tl_notnil)


[STATEMENT]
lemma surj_on_insert_left: "surj_on f (insert a A) B = (surj_on f A (B - {f a}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj_on f (insert a A) B = surj_on f A (B - {f a})
[PROOF STEP]
unfolding surj_on_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>b\<in>B. \<exists>a\<in>insert a A. b = f a) = (\<forall>b\<in>B - {f a}. \<exists>a\<in>A. b = f a)
[PROOF STEP]
by blast


[STATEMENT]
lemma Arg2pi_divide:
  assumes "w \<noteq> 0" "z \<noteq> 0" "Arg2pi w \<le> Arg2pi z"
    shows "Arg2pi(z / w) = Arg2pi z - Arg2pi w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg2pi (z / w) = Arg2pi z - Arg2pi w
[PROOF STEP]
apply (rule Arg2pi_unique [of "norm(z / w)"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. complex_of_real (cmod (z / w)) * exp (\<i> * complex_of_real (Arg2pi z - Arg2pi w)) = z / w
 2. 0 < cmod (z / w)
 3. 0 \<le> Arg2pi z - Arg2pi w
 4. Arg2pi z - Arg2pi w < 2 * pi
[PROOF STEP]
using assms Arg2pi_eq Arg2pi_ge_0 [of w] Arg2pi_lt_2pi [of z]
[PROOF STATE]
proof (prove)
using this:
w \<noteq> 0
z \<noteq> 0
Arg2pi w \<le> Arg2pi z
?z = complex_of_real (cmod ?z) * exp (\<i> * complex_of_real (Arg2pi ?z))
0 \<le> Arg2pi w
Arg2pi z < 2 * pi

goal (4 subgoals):
 1. complex_of_real (cmod (z / w)) * exp (\<i> * complex_of_real (Arg2pi z - Arg2pi w)) = z / w
 2. 0 < cmod (z / w)
 3. 0 \<le> Arg2pi z - Arg2pi w
 4. Arg2pi z - Arg2pi w < 2 * pi
[PROOF STEP]
apply (auto simp: exp_diff norm_divide field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_fps_expansion_divide' [fps_expansion_intros]:
  fixes F G :: "'a :: {banach, real_normed_field} fps"
  assumes "f has_fps_expansion F" and "g has_fps_expansion G" and "fps_nth G 0 \<noteq> 0"
  shows   "(\<lambda>x. f x / g x) has_fps_expansion (F / G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
have "(\<lambda>x. if x = 0 then fps_nth F 0 / fps_nth G 0 else f x / g x) has_fps_expansion (F / G)"
    (is "?h has_fps_expansion _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) has_fps_expansion F / G
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
fps_nth G 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) has_fps_expansion F / G
[PROOF STEP]
by (intro has_fps_expansion_divide assms) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) has_fps_expansion F / G

goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) has_fps_expansion F / G

goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f has_fps_expansion F
g has_fps_expansion G
fps_nth G 0 \<noteq> (0::'a)
[PROOF STEP]
have "fps_nth F 0 = f 0" "fps_nth G 0 = g 0"
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
g has_fps_expansion G
fps_nth G 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. fps_nth F 0 = f (0::'a) &&& fps_nth G 0 = g (0::'a)
[PROOF STEP]
by (auto simp: has_fps_expansion_def eval_fps_at_0 dest: eventually_nhds_x_imp_x)
[PROOF STATE]
proof (state)
this:
fps_nth F 0 = f (0::'a)
fps_nth G 0 = g (0::'a)

goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
hence "?h = (\<lambda>x. f x / g x)"
[PROOF STATE]
proof (prove)
using this:
fps_nth F 0 = f (0::'a)
fps_nth G 0 = g (0::'a)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) = (\<lambda>x. f x / g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x = (0::'a) then fps_nth F 0 / fps_nth G 0 else f x / g x) = (\<lambda>x. f x / g x)

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

goal (1 subgoal):
 1. (\<lambda>x. f x / g x) has_fps_expansion F / G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x / g x) has_fps_expansion F / G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_closure_sequentially':
  fixes f::"'a::metric_space \<Rightarrow> 'b::metric_space"
  assumes "continuous_on (closure C) f"
          "\<And>(n::nat). u n \<in> C"
          "u \<longlonglongrightarrow> l"
  shows "(\<lambda>n. f (u n)) \<longlonglongrightarrow> f l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
have "l \<in> closure C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> closure C
[PROOF STEP]
unfolding closure_sequential
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<forall>n. x n \<in> C) \<and> x \<longlonglongrightarrow> l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on (closure C) f
u ?n \<in> C
u \<longlonglongrightarrow> l

goal (1 subgoal):
 1. \<exists>x. (\<forall>n. x n \<in> C) \<and> x \<longlonglongrightarrow> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l \<in> closure C

goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<in> closure C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l \<in> closure C

goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
using \<open>continuous_on (closure C) f\<close>
[PROOF STATE]
proof (prove)
using this:
l \<in> closure C
continuous_on (closure C) f

goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
unfolding comp_def continuous_on_closure_sequentially
[PROOF STATE]
proof (prove)
using this:
l \<in> closure C
\<forall>x a. a \<in> closure C \<and> (\<forall>n. x n \<in> C) \<and> x \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>xa. f (x xa)) \<longlonglongrightarrow> f a

goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<in> closure C
\<forall>x a. a \<in> closure C \<and> (\<forall>n. x n \<in> C) \<and> x \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>xa. f (x xa)) \<longlonglongrightarrow> f a
continuous_on (closure C) f
u ?n \<in> C
u \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. f (u n)) \<longlonglongrightarrow> f l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (u n)) \<longlonglongrightarrow> f l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_nat_imp_eq:
  fixes m :: nat
  assumes "m > 0" "x \<in> {a..<a+m}" "y \<in> {a..<a+m}" "[x = y] (mod m)"
  shows   "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m
x \<in> {a..<a + m}
y \<in> {a..<a + m}
[x = y] (mod m)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof (induction x y rule: linorder_wlog)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>aa b. \<lbrakk>aa \<le> b; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
 2. \<And>aa b. \<lbrakk>\<lbrakk>0 < m; b \<in> {a..<a + m}; aa \<in> {a..<a + m}; [b = aa] (mod m)\<rbrakk> \<Longrightarrow> b = aa; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
[PROOF STEP]
case (le x y)
[PROOF STATE]
proof (state)
this:
x \<le> y
0 < m
x \<in> {a..<a + m}
y \<in> {a..<a + m}
[x = y] (mod m)

goal (2 subgoals):
 1. \<And>aa b. \<lbrakk>aa \<le> b; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
 2. \<And>aa b. \<lbrakk>\<lbrakk>0 < m; b \<in> {a..<a + m}; aa \<in> {a..<a + m}; [b = aa] (mod m)\<rbrakk> \<Longrightarrow> b = aa; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
[PROOF STEP]
have "[y - x = 0] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y - x = 0] (mod m)
[PROOF STEP]
using cong_diff_iff_cong_0_nat cong_sym le
[PROOF STATE]
proof (prove)
using this:
?b \<le> ?a \<Longrightarrow> [?a - ?b = 0] (mod ?m) = [?a = ?b] (mod ?m)
[?b = ?c] (mod ?a) \<Longrightarrow> [?c = ?b] (mod ?a)
x \<le> y
0 < m
x \<in> {a..<a + m}
y \<in> {a..<a + m}
[x = y] (mod m)

goal (1 subgoal):
 1. [y - x = 0] (mod m)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[y - x = 0] (mod m)

goal (2 subgoals):
 1. \<And>aa b. \<lbrakk>aa \<le> b; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
 2. \<And>aa b. \<lbrakk>\<lbrakk>0 < m; b \<in> {a..<a + m}; aa \<in> {a..<a + m}; [b = aa] (mod m)\<rbrakk> \<Longrightarrow> b = aa; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
[PROOF STEP]
thus "x = y"
[PROOF STATE]
proof (prove)
using this:
[y - x = 0] (mod m)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
[y - x = 0] (mod m)
x \<le> y
0 < m
x \<in> {a..<a + m}
y \<in> {a..<a + m}
[x = y] (mod m)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>\<lbrakk>0 < m; b \<in> {a..<a + m}; aa \<in> {a..<a + m}; [b = aa] (mod m)\<rbrakk> \<Longrightarrow> b = aa; 0 < m; aa \<in> {a..<a + m}; b \<in> {a..<a + m}; [aa = b] (mod m)\<rbrakk> \<Longrightarrow> aa = b
[PROOF STEP]
qed (auto simp: cong_sym)


[STATEMENT]
lemma zero_eq_lcm_iff: "0 = lcm a b \<longleftrightarrow> a = 0 \<or> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) = lcm a b) = (a = (0::'a) \<or> b = (0::'a))
[PROOF STEP]
using lcm_eq_0_iff[of a b]
[PROOF STATE]
proof (prove)
using this:
(lcm a b = (0::'a)) = (a = (0::'a) \<or> b = (0::'a))

goal (1 subgoal):
 1. ((0::'a) = lcm a b) = (a = (0::'a) \<or> b = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma rec_sigma_ex:
  assumes "primerec rf (Suc (length xs))"
  shows "(rec_exec (rec_sigma rf) (xs @ [x]) = 0) =
                          (\<forall> t \<le> x. rec_exec rf (xs @ [t]) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0)
[PROOF STEP]
proof(induct x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (rec_exec (rec_sigma rf) (xs @ [0]) = 0) = (\<forall>t\<le>0. rec_exec rf (xs @ [t]) = 0)
 2. \<And>x. (rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0) \<Longrightarrow> (rec_exec (rec_sigma rf) (xs @ [Suc x]) = 0) = (\<forall>t\<le>Suc x. rec_exec rf (xs @ [t]) = 0)
[PROOF STEP]
case (Suc x)
[PROOF STATE]
proof (state)
this:
(rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0)

goal (2 subgoals):
 1. (rec_exec (rec_sigma rf) (xs @ [0]) = 0) = (\<forall>t\<le>0. rec_exec rf (xs @ [t]) = 0)
 2. \<And>x. (rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0) \<Longrightarrow> (rec_exec (rec_sigma rf) (xs @ [Suc x]) = 0) = (\<forall>t\<le>Suc x. rec_exec rf (xs @ [t]) = 0)
[PROOF STEP]
from Suc assms
[PROOF STATE]
proof (chain)
picking this:
(rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0)
primerec rf (Suc (length xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(rec_exec (rec_sigma rf) (xs @ [x]) = 0) = (\<forall>t\<le>x. rec_exec rf (xs @ [t]) = 0)
primerec rf (Suc (length xs))

goal (1 subgoal):
 1. (rec_exec (rec_sigma rf) (xs @ [Suc x]) = 0) = (\<forall>t\<le>Suc x. rec_exec rf (xs @ [t]) = 0)
[PROOF STEP]
by(auto simp add: rec_exec.simps rec_sigma.simps
        get_fstn_args_take elim:le_SucE)
[PROOF STATE]
proof (state)
this:
(rec_exec (rec_sigma rf) (xs @ [Suc x]) = 0) = (\<forall>t\<le>Suc x. rec_exec rf (xs @ [t]) = 0)

goal (1 subgoal):
 1. (rec_exec (rec_sigma rf) (xs @ [0]) = 0) = (\<forall>t\<le>0. rec_exec rf (xs @ [t]) = 0)
[PROOF STEP]
qed (insert assms,auto simp: get_fstn_args_take rec_exec.simps rec_sigma.simps)


[STATEMENT]
lemma fds_scale_minus [simp]:
  fixes f g :: "'a :: {cancel_comm_monoid_add} fds"
  shows "fds_scale c (f - g) = fds_scale c f - fds_scale c g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_scale c (f - g) = fds_scale c f - fds_scale c g
[PROOF STEP]
by (rule fds_eqI) (auto simp: fds_nth_scale)


[STATEMENT]
lemma e_length_append: "e_length (e_append xs ys) = e_length xs + e_length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e_length (e_append xs ys) = e_length xs + e_length ys
[PROOF STEP]
using e_append_def
[PROOF STATE]
proof (prove)
using this:
e_append ?xs ?ys \<equiv> Partial_Recursive.list_encode (Partial_Recursive.list_decode ?xs @ Partial_Recursive.list_decode ?ys)

goal (1 subgoal):
 1. e_length (e_append xs ys) = e_length xs + e_length ys
[PROOF STEP]
by simp


[STATEMENT]
lemma merge_sort_nonneg[simp]: "(\<And>n. t n \<ge> 0) \<Longrightarrow> merge_sort_cost t x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. 0 \<le> t n) \<Longrightarrow> 0 \<le> merge_sort_cost t x
[PROOF STEP]
by (induction t x rule: merge_sort_cost.induct) (simp_all del: One_nat_def)


[STATEMENT]
lemma eq_self_mirror_iff: fixes x::"'a::real_vector" shows "x = mirror_point y x \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = mirror_point y x) = (x = y)
[PROOF STEP]
by (auto simp: mirror_point_def algebra_simps scaleR_2[symmetric])


[STATEMENT]
lemma sym_mod_sym_mod_cancel: "c dvd b \<Longrightarrow> a symmod b symmod c = a symmod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c dvd b \<Longrightarrow> a symmod b symmod c = a symmod c
[PROOF STEP]
using mod_mod_cancel[of c b]
[PROOF STATE]
proof (prove)
using this:
c dvd b \<Longrightarrow> ?a mod b mod c = ?a mod c

goal (1 subgoal):
 1. c dvd b \<Longrightarrow> a symmod b symmod c = a symmod c
[PROOF STEP]
unfolding sym_mod_def
[PROOF STATE]
proof (prove)
using this:
c dvd b \<Longrightarrow> ?a mod b mod c = ?a mod c

goal (1 subgoal):
 1. c dvd b \<Longrightarrow> poly_mod.inv_M c (poly_mod.inv_M b (a mod b) mod c) = poly_mod.inv_M c (a mod c)
[PROOF STEP]
by (metis poly_mod.M_def poly_mod.M_inv_M_id)


[STATEMENT]
lemma UN_upt: "(\<Union>i\<in>{0..<length xs}. f (xs ! i)) = (\<Union>x\<in>set xs. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>{0..<length xs}. f (xs ! i)) = \<Union> (f ` set xs)
[PROOF STEP]
by (metis image_image map_nth set_map set_upt)


[STATEMENT]
lemma Smith_normal_form_upt_k_condition2:
  fixes A::"'a::{bezout_ring}^'cols::mod_type^'rows::mod_type"
  assumes "Smith_normal_form_upt_k A k"
  and "to_nat a \<noteq> to_nat b" and "(to_nat a < k \<or> to_nat b < k)"
  shows "((A $ a) $ b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Smith_normal_form_upt_k A k
mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b
mod_type_class.to_nat a < k \<or> mod_type_class.to_nat b < k

goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
unfolding Smith_normal_form_upt_k_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < k \<and> mod_type_class.to_nat b + 1 < k \<longrightarrow> A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))) \<and> isDiagonal_upt_k A k
mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b
mod_type_class.to_nat a < k \<or> mod_type_class.to_nat b < k

goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
unfolding isDiagonal_upt_k_def isDiagonal_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < k \<and> mod_type_class.to_nat b + 1 < k \<longrightarrow> A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))) \<and> (\<forall>a b. mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b \<and> (mod_type_class.to_nat a < k \<or> mod_type_class.to_nat b < k) \<longrightarrow> A $ a $ b = (0::'a))
mod_type_class.to_nat a \<noteq> mod_type_class.to_nat b
mod_type_class.to_nat a < k \<or> mod_type_class.to_nat b < k

goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma set_times_plus_distrib: "a *o (b +o C) = (a * b) +o (a *o C)"
  for a b :: "'a::semiring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *o (b +o C) = a * b +o a *o C
[PROOF STEP]
by (auto simp add: elt_set_plus_def elt_set_times_def ring_distribs)


[STATEMENT]
lemma Suc_times_binomial: "Suc k * (Suc n choose Suc k) = Suc n * (n choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k * (Suc n choose Suc k) = Suc n * (n choose k)
[PROOF STEP]
using Suc_times_binomial_eq
[PROOF STATE]
proof (prove)
using this:
Suc ?n * (?n choose ?k) = (Suc ?n choose Suc ?k) * Suc ?k

goal (1 subgoal):
 1. Suc k * (Suc n choose Suc k) = Suc n * (n choose k)
[PROOF STEP]
by auto


[STATEMENT]
lemma simple_not_multiplicity: "b \<in># \<B> \<Longrightarrow> multiplicity  b > 1 \<Longrightarrow> \<not> simple_incidence_system \<V> \<B>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<in># \<B>; 1 < multiplicity b\<rbrakk> \<Longrightarrow> \<not> simple_incidence_system \<V> \<B>
[PROOF STEP]
using simple_incidence_system_def simple_incidence_system_axioms_def
[PROOF STATE]
proof (prove)
using this:
simple_incidence_system ?point_set ?block_collection \<equiv> incidence_system ?point_set ?block_collection \<and> simple_incidence_system_axioms ?block_collection
simple_incidence_system_axioms ?block_collection \<equiv> \<forall>bl. bl \<in># ?block_collection \<longrightarrow> count ?block_collection bl = 1

goal (1 subgoal):
 1. \<lbrakk>b \<in># \<B>; 1 < multiplicity b\<rbrakk> \<Longrightarrow> \<not> simple_incidence_system \<V> \<B>
[PROOF STEP]
by (metis nat_neq_iff)


[STATEMENT]
lemma continuous_ge_on_closure:
  fixes a::real
  assumes f: "continuous_on (closure s) f"
      and x: "x \<in> closure(s)"
      and xlo: "\<And>x. x \<in> s ==> f(x) \<ge> a"
    shows "f(x) \<ge> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> f x
[PROOF STEP]
using image_closure_subset [OF f, where T=" {x. a \<le> x}"] assms
    continuous_on_closed_Collect_le[of "UNIV" "\<lambda>x. a" "\<lambda>x. x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closed {x. a \<le> x}; f ` s \<subseteq> {x. a \<le> x}\<rbrakk> \<Longrightarrow> f ` closure s \<subseteq> {x. a \<le> x}
continuous_on (closure s) f
x \<in> closure s
?x \<in> s \<Longrightarrow> a \<le> f ?x
\<lbrakk>continuous_on UNIV (\<lambda>x. a); continuous_on UNIV (\<lambda>x. x); closed UNIV\<rbrakk> \<Longrightarrow> closed {x \<in> UNIV. a \<le> x}

goal (1 subgoal):
 1. a \<le> f x
[PROOF STEP]
by auto


[STATEMENT]
lemma compile_mod2: "length (concat (take n (tms_of ap))) mod 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even (length (concat (take n (tms_of ap))))
[PROOF STEP]
proof(induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_even (length (concat (take 0 (tms_of ap))))
 2. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. is_even (length (concat (take 0 (tms_of ap))))
 2. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_even (length (concat (take 0 (tms_of ap))))
[PROOF STEP]
by (auto simp add: take_Suc_conv_app_nth)
[PROOF STATE]
proof (state)
this:
is_even (length (concat (take 0 (tms_of ap))))

goal (1 subgoal):
 1. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
is_even (length (concat (take n (tms_of ap))))

goal (1 subgoal):
 1. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
hence "n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))"
[PROOF STATE]
proof (prove)
using this:
is_even (length (concat (take n (tms_of ap))))

goal (1 subgoal):
 1. n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
unfolding take_Suc_conv_app_nth
[PROOF STATE]
proof (prove)
using this:
is_even (length (concat (take n (tms_of ap))))

goal (1 subgoal):
 1. n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take n (tms_of ap) @ [tms_of ap ! n])))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))

goal (1 subgoal):
 1. \<And>n. is_even (length (concat (take n (tms_of ap)))) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
is_even (length (concat (take n (tms_of ap))))
n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
is_even (length (concat (take n (tms_of ap))))
n < length (tms_of ap) \<Longrightarrow> is_even (length (concat (take (Suc n) (tms_of ap))))

goal (1 subgoal):
 1. is_even (length (concat (take (Suc n) (tms_of ap))))
[PROOF STEP]
by(cases "n < length (tms_of ap)", auto)
[PROOF STATE]
proof (state)
this:
is_even (length (concat (take (Suc n) (tms_of ap))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_interval_contractible_1:
  fixes S :: "real set"
  shows  "is_interval S \<longleftrightarrow> contractible S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval S = contractible S
[PROOF STEP]
using contractible_imp_simply_connected convex_imp_contractible is_interval_convex_1
      is_interval_simply_connected_1
[PROOF STATE]
proof (prove)
using this:
contractible ?S \<Longrightarrow> simply_connected ?S
convex ?S \<Longrightarrow> contractible ?S
is_interval ?S = convex ?S
is_interval ?S = simply_connected ?S

goal (1 subgoal):
 1. is_interval S = contractible S
[PROOF STEP]
by auto


[STATEMENT]
lemma terminate_halt_lemma:
  "\<lbrakk>rec_exec rec_nonstop ([m, r] @ [t]) = 0;
     \<forall>i<t. 0 < rec_exec rec_nonstop ([m, r] @ [i])\<rbrakk> \<Longrightarrow> terminate rec_halt [m, r]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rec_exec rec_nonstop ([m, r] @ [t]) = 0; \<forall>i<t. 0 < rec_exec rec_nonstop ([m, r] @ [i])\<rbrakk> \<Longrightarrow> terminate rec_halt [m, r]
[PROOF STEP]
apply(simp add: rec_halt_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rec_exec rec_nonstop [m, r, t] = 0; \<forall>i<t. 0 < rec_exec rec_nonstop [m, r, i]\<rbrakk> \<Longrightarrow> terminate (Mn (Suc (Suc 0)) rec_nonstop) [m, r]
[PROOF STEP]
apply(rule termi_mn, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>rec_exec rec_nonstop [m, r, t] = 0; \<forall>i<t. 0 < rec_exec rec_nonstop [m, r, i]\<rbrakk> \<Longrightarrow> terminate rec_nonstop [m, r, t]
 2. \<And>i. \<lbrakk>rec_exec rec_nonstop [m, r, t] = 0; \<forall>i<t. 0 < rec_exec rec_nonstop [m, r, i]; i < t\<rbrakk> \<Longrightarrow> terminate rec_nonstop [m, r, i]
[PROOF STEP]
by(rule primerec_terminate; auto)+


[STATEMENT]
lemma GS_rec_iter_eq_iter_max: "GS_rec_iter v = GS_iter_max (vec_lambda v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GS_rec_iter v = GS_iter_max (vec_lambda v)
[PROOF STEP]
unfolding GS_rec_iter_def GS_iter_max_def GS_iter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. \<Squnion>a\<in>A s. r (s, a) + l * (\<Sum>s'\<in>UNIV. pmf (K (s, a)) s' * v s')) = (\<lambda>s. \<Squnion>a\<in>A s. r (s, a) + l * (\<Sum>s'\<in>UNIV. pmf (K (s, a)) s' * vec_lambda v $ s'))
[PROOF STEP]
by auto


[STATEMENT]
lemma satC_iff_set: "satC \<xi> c \<longleftrightarrow> (\<exists> l \<in> set c. satL \<xi> l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satC \<xi> c = (\<exists>l\<in>set c. satL \<xi> l)
[PROOF STEP]
unfolding satC_def Bex_set[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bex (set c) (satL \<xi>) = (\<exists>l\<in>set c. satL \<xi> l)
[PROOF STEP]
..


[STATEMENT]
lemma sints_num: "sints n = {i. - (2 ^ (n - 1)) \<le> i \<and> i < 2 ^ (n - 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sints n = {i. - (2 ^ (n - 1)) \<le> i \<and> i < 2 ^ (n - 1)}
[PROOF STEP]
by (simp add: sints_def range_sbintrunc)


[STATEMENT]
lemma fcard_funion_fsubset:
  "B |\<subseteq>| A \<Longrightarrow> fcard (A |-| B) = fcard A - fcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B |\<subseteq>| A \<Longrightarrow> fcard (A |-| B) = fcard A - fcard B
[PROOF STEP]
by transfer (rule card_Diff_subset)


[STATEMENT]
lemma set_minimize_check_generate:
  "set (minimize (check_generate a b)) =
    {(x, y)\<in>set (check_generate a b). \<not> (\<exists>(u, v)\<in>set (check_generate a b). u @ v <\<^sub>v x @ y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (minimize (check_generate a b)) = {(x, y). (x, y) \<in> set (check_generate a b) \<and> \<not> (\<exists>(u, v)\<in>set (check_generate a b). u @ v <\<^sub>v x @ y)}
[PROOF STEP]
unfolding minimize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (minimize_wrt (\<lambda>(x, y) (u, v). \<not> x @ y <\<^sub>v u @ v) (check_generate a b)) = {(x, y). (x, y) \<in> set (check_generate a b) \<and> \<not> (\<exists>(u, v)\<in>set (check_generate a b). u @ v <\<^sub>v x @ y)}
[PROOF STEP]
by (subst set_minimize_wrt [OF _ sorted_wrt_check_generate]) (auto dest: rlex_not_sym less_imp_rlex)


[STATEMENT]
lemma length_enum_CARD: "length ENUM('a) = CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length enum_class.enum = CARD('a)
[PROOF STEP]
by (simp add: UNIV_enum distinct_card enum_distinct)


[STATEMENT]
lemma card_partitions_atmost_k_parts:
  "card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
have "card {p. p partitions n \<and> sum p {..n} \<le> k} =
    card (\<Union>((\<lambda>k'. {p. p partitions n \<and> sum p {..n} = k'}) ` {..k}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
have "{p. p partitions n \<and> sum p {..n} \<le> k} =
      (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p partitions n \<and> sum p {..n} \<le> k} = (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{p. p partitions n \<and> sum p {..n} \<le> k} = (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
{p. p partitions n \<and> sum p {..n} \<le> k} = (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{p. p partitions n \<and> sum p {..n} \<le> k} = (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
have "card (\<Union>((\<lambda>k'. {p. p partitions n \<and> sum p {..n} = k'}) ` {..k})) =
    sum (\<lambda>k'. card {p. p partitions n \<and> sum p {..n} = k'}) {..k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'}) = (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
using finite_partitions_k_parts
[PROOF STATE]
proof (prove)
using this:
finite {p. p partitions ?n \<and> sum p {..?n} = ?k}

goal (1 subgoal):
 1. card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'}) = (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'})
[PROOF STEP]
by (subst card_UN_disjoint) auto
[PROOF STATE]
proof (state)
this:
card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'}) = (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union>k'\<le>k. {p. p partitions n \<and> sum p {..n} = k'}) = (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'})

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
have "\<dots> = sum (\<lambda>k'. Partition n k') {..k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'}) = sum (Partition n) {..k}
[PROOF STEP]
using card_partitions_k_parts
[PROOF STATE]
proof (prove)
using this:
card {p. p partitions ?n \<and> sum p {..?n} = ?k} = Partition ?n ?k

goal (1 subgoal):
 1. (\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'}) = sum (Partition n) {..k}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'}) = sum (Partition n) {..k}

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k'\<le>k. card {p. p partitions n \<and> sum p {..n} = k'}) = sum (Partition n) {..k}

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
have "\<dots> = Partition (n + k) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (Partition n) {..k} = Partition (n + k) k
[PROOF STEP]
using Partition_sum_Partition_diff
[PROOF STATE]
proof (prove)
using this:
?k \<le> ?m \<Longrightarrow> Partition ?m ?k = sum (Partition (?m - ?k)) {..?k}

goal (1 subgoal):
 1. sum (Partition n) {..k} = Partition (n + k) k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (Partition n) {..k} = Partition (n + k) k

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k

goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {p. p partitions n \<and> sum p {..n} \<le> k} = Partition (n + k) k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem infsetsum_prod_PiE:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {real_normed_field,banach,second_countable_topology}"
  assumes finite: "finite A" and countable: "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
  assumes summable: "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B x"
  shows   "infsetsum (\<lambda>g. \<Prod>x\<in>A. f x (g x)) (PiE A B) = (\<Prod>x\<in>A. infsetsum (f x) (B x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
define B' where "B' = (\<lambda>x. if x \<in> A then B x else {})"
[PROOF STATE]
proof (state)
this:
B' = (\<lambda>x. if x \<in> A then B x else {})

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
?x \<in> A \<Longrightarrow> countable (B ?x)
?x \<in> A \<Longrightarrow> f ?x abs_summable_on B ?x
[PROOF STEP]
have [simp]: "countable (B' x)" for x
[PROOF STATE]
proof (prove)
using this:
finite A
?x \<in> A \<Longrightarrow> countable (B ?x)
?x \<in> A \<Longrightarrow> f ?x abs_summable_on B ?x

goal (1 subgoal):
 1. countable (B' x)
[PROOF STEP]
by (auto simp: B'_def)
[PROOF STATE]
proof (state)
this:
countable (B' ?x)

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
countable (B' ?x)
[PROOF STEP]
interpret product_sigma_finite "count_space \<circ> B'"
[PROOF STATE]
proof (prove)
using this:
countable (B' ?x)

goal (1 subgoal):
 1. product_sigma_finite (count_space \<circ> B')
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
countable (B' ?x)

goal (1 subgoal):
 1. product_sigma_finite (\<lambda>x. count_space (B' x))
[PROOF STEP]
by (intro product_sigma_finite.intro sigma_finite_measure_count_space_countable)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
have "infsetsum (\<lambda>g. \<Prod>x\<in>A. f x (g x)) (PiE A B) =
          (\<integral>g. (\<Prod>x\<in>A. f x (g x)) \<partial>count_space (PiE A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = LINT g|count_space (Pi\<^sub>E A B). (\<Prod>x\<in>A. f x (g x))
[PROOF STEP]
by (simp add: infsetsum_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = LINT g|count_space (Pi\<^sub>E A B). (\<Prod>x\<in>A. f x (g x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = LINT g|count_space (Pi\<^sub>E A B). (\<Prod>x\<in>A. f x (g x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
have "PiE A B = PiE A B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>E A B = Pi\<^sub>E A B'
[PROOF STEP]
by (intro PiE_cong) (simp_all add: B'_def)
[PROOF STATE]
proof (state)
this:
Pi\<^sub>E A B = Pi\<^sub>E A B'

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
hence "count_space (PiE A B) = count_space (PiE A B')"
[PROOF STATE]
proof (prove)
using this:
Pi\<^sub>E A B = Pi\<^sub>E A B'

goal (1 subgoal):
 1. count_space (Pi\<^sub>E A B) = count_space (Pi\<^sub>E A B')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_space (Pi\<^sub>E A B) = count_space (Pi\<^sub>E A B')

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_space (Pi\<^sub>E A B) = count_space (Pi\<^sub>E A B')

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
have "\<dots> = PiM A (count_space \<circ> B')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_space (Pi\<^sub>E A B') = Pi\<^sub>M A (count_space \<circ> B')
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_space (Pi\<^sub>E A B') = Pi\<^sub>M A (\<lambda>x. count_space (B' x))
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. count_space (Pi\<^sub>E A B') = Pi\<^sub>M A (\<lambda>x. count_space (B' x))
[PROOF STEP]
by (intro count_space_PiM_finite [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
count_space (Pi\<^sub>E A B') = Pi\<^sub>M A (count_space \<circ> B')

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_space (Pi\<^sub>E A B') = Pi\<^sub>M A (count_space \<circ> B')

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
have "(\<integral>g. (\<Prod>x\<in>A. f x (g x)) \<partial>\<dots>) = (\<Prod>x\<in>A. infsetsum (f x) (B' x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT g|Pi\<^sub>M A (count_space \<circ> B'). (\<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B' x))
[PROOF STEP]
by (subst product_integral_prod)
       (insert summable finite, simp_all add: infsetsum_def B'_def abs_summable_on_def)
[PROOF STATE]
proof (state)
this:
LINT g|Pi\<^sub>M A (count_space \<circ> B'). (\<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B' x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT g|Pi\<^sub>M A (count_space \<circ> B'). (\<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B' x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>A. infsetsum (f x) (B x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. infsetsum (f x) (B' x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
by (intro prod.cong refl) (simp_all add: B'_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. infsetsum (f x) (B' x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))

goal (1 subgoal):
 1. (\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ag\<in>Pi\<^sub>E A B. \<Prod>x\<in>A. f x (g x)) = (\<Prod>x\<in>A. infsetsum (f x) (B x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nil_in_permutations_of_set_iff [simp]: "[] \<in> permutations_of_set A \<longleftrightarrow> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([] \<in> permutations_of_set A) = (A = {})
[PROOF STEP]
by (auto simp: permutations_of_set_def)


[STATEMENT]
lemma ind_in_set_bij:
  "bij_betw (ind_in_set vars0) ({0..<length dims} \<inter> vars0) {0..<card ({0..<length dims} \<inter> vars0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (ind_in_set vars0) ({0..<length dims} \<inter> vars0) {0..<card ({0..<length dims} \<inter> vars0)}
[PROOF STEP]
using bij_ind_in_set_bound
[PROOF STATE]
proof (prove)
using this:
(\<And>x. ?f x = card {y \<in> ?v0.0. y < x}) \<Longrightarrow> bij_betw ?f ({0..<?M} \<inter> ?v0.0) {0..<card ({0..<?M} \<inter> ?v0.0)}

goal (1 subgoal):
 1. bij_betw (ind_in_set vars0) ({0..<length dims} \<inter> vars0) {0..<card ({0..<length dims} \<inter> vars0)}
[PROOF STEP]
unfolding ind_in_set_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. ?f x = card {y \<in> ?v0.0. y < x}) \<Longrightarrow> bij_betw ?f ({0..<?M} \<inter> ?v0.0) {0..<card ({0..<?M} \<inter> ?v0.0)}

goal (1 subgoal):
 1. bij_betw (\<lambda>x. card {i \<in> vars0. i < x}) ({0..<length dims} \<inter> vars0) {0..<card ({0..<length dims} \<inter> vars0)}
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_integral0_fps_X_power:
  "fps_integral0 ((fps_X::'a::{semiring_1,inverse} fps) ^ n) =
            fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (fps_X ^ n) = fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n
[PROOF STEP]
proof (intro fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. fps_integral0 (fps_X ^ n) $ na = (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ na
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. fps_integral0 (fps_X ^ n) $ na = (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ na
[PROOF STEP]
show
    "fps_integral0 ((fps_X::'a fps) ^ n) $ k =
      (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_integral0 (fps_X ^ n) $ k = (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ k
[PROOF STEP]
by (cases k) simp_all
[PROOF STATE]
proof (state)
this:
fps_integral0 (fps_X ^ n) $ k = (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Suc_times_binomial: "Suc k * (Suc n choose Suc k) = Suc n * (n choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k * (Suc n choose Suc k) = Suc n * (n choose k)
[PROOF STEP]
using Suc_times_binomial_eq
[PROOF STATE]
proof (prove)
using this:
Suc ?n * (?n choose ?k) = (Suc ?n choose Suc ?k) * Suc ?k

goal (1 subgoal):
 1. Suc k * (Suc n choose Suc k) = Suc n * (n choose k)
[PROOF STEP]
by auto


[STATEMENT]
lemma not_true_eq_false: "(\<not> true) = false"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> true) = false
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma pfixLe_antisym: "[| x pfixLe y; y pfixLe x |] ==> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x pfixLe y; y pfixLe x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (blast intro: genPrefix_antisym)


[STATEMENT]
lemma inversion_number_between_Cons_Cons:
  assumes "sorted_wrt less_eq (x # xs)" and "sorted_wrt less_eq (y # ys)"
  shows   "inversion_number_between (x # xs) (y # ys) =
             (if \<not>less y x then
                inversion_number_between xs (y # ys)
              else
                inversion_number_between (x # xs) ys + length (x # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
proof (cases "less y x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
 2. \<not> y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> y < x

goal (2 subgoals):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
 2. \<not> y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
hence "inversion_number_between (x # xs) (y # ys) =
           card (map_prod Suc id ` inversions_between xs (y # ys))"
[PROOF STATE]
proof (prove)
using this:
\<not> y < x

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = card (map_prod Suc id ` inversions_between xs (y # ys))
[PROOF STEP]
by (simp add: inversion_number_between_def inversions_between_Cons_Cons[OF assms])
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = card (map_prod Suc id ` inversions_between xs (y # ys))

goal (2 subgoals):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
 2. \<not> y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = card (map_prod Suc id ` inversions_between xs (y # ys))

goal (2 subgoals):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
 2. \<not> y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
have "\<dots> = inversion_number_between xs (y # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (map_prod Suc id ` inversions_between xs (y # ys)) = inversion_number_between xs (y # ys)
[PROOF STEP]
unfolding inversion_number_between_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (map_prod Suc id ` inversions_between xs (y # ys)) = card (inversions_between xs (y # ys))
[PROOF STEP]
by (intro card_image inj_onI) (auto simp: map_prod_def)
[PROOF STATE]
proof (state)
this:
card (map_prod Suc id ` inversions_between xs (y # ys)) = inversion_number_between xs (y # ys)

goal (2 subgoals):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
 2. \<not> y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
inversion_number_between (x # xs) (y # ys) = inversion_number_between xs (y # ys)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inversion_number_between (x # xs) (y # ys) = inversion_number_between xs (y # ys)

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
inversion_number_between (x # xs) (y # ys) = inversion_number_between xs (y # ys)
\<not> y < x

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y < x

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
hence "inversion_number_between (x # xs) (y # ys) =
           card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys)"
[PROOF STATE]
proof (prove)
using this:
y < x

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys)
[PROOF STEP]
by (simp add: inversion_number_between_def inversions_between_Cons_Cons[OF assms])
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys)

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys)

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
have "\<dots> = length (x # xs) + card (map_prod id Suc ` inversions_between (x # xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys) = length (x # xs) + card (map_prod id Suc ` inversions_between (x # xs) ys)
[PROOF STEP]
by (subst card_Un_disjoint) auto
[PROOF STATE]
proof (state)
this:
card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys) = length (x # xs) + card (map_prod id Suc ` inversions_between (x # xs) ys)

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({..<length (x # xs)} \<times> {0} \<union> map_prod id Suc ` inversions_between (x # xs) ys) = length (x # xs) + card (map_prod id Suc ` inversions_between (x # xs) ys)

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
have "card (map_prod id Suc ` inversions_between (x # xs) ys) =
               inversion_number_between (x # xs) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (map_prod id Suc ` inversions_between (x # xs) ys) = inversion_number_between (x # xs) ys
[PROOF STEP]
unfolding inversion_number_between_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (map_prod id Suc ` inversions_between (x # xs) ys) = card (inversions_between (x # xs) ys)
[PROOF STEP]
by (intro card_image inj_onI) (auto simp: map_prod_def)
[PROOF STATE]
proof (state)
this:
card (map_prod id Suc ` inversions_between (x # xs) ys) = inversion_number_between (x # xs) ys

goal (1 subgoal):
 1. y < x \<Longrightarrow> inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
inversion_number_between (x # xs) (y # ys) = length (x # xs) + inversion_number_between (x # xs) ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inversion_number_between (x # xs) (y # ys) = length (x # xs) + inversion_number_between (x # xs) ys

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
inversion_number_between (x # xs) (y # ys) = length (x # xs) + inversion_number_between (x # xs) ys
y < x

goal (1 subgoal):
 1. inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inversion_number_between (x # xs) (y # ys) = (if \<not> y < x then inversion_number_between xs (y # ys) else inversion_number_between (x # xs) ys + length (x # xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma moebius_pt_comp_inv_right [simp]:
  shows "moebius_pt M (moebius_pt (moebius_inv M) z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt M (moebius_pt (moebius_inv M) z) = z
[PROOF STEP]
by (subst moebius_pt_comp[symmetric], simp)


[STATEMENT]
lemma ball_eq_cball_iff:
  fixes x :: "'a :: euclidean_space"
  shows "ball x d = cball y e \<longleftrightarrow> d \<le> 0 \<and> e < 0" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ball x d = cball y e) = (d \<le> 0 \<and> e < 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ball x d = cball y e \<Longrightarrow> d \<le> 0 \<and> e < 0
 2. d \<le> 0 \<and> e < 0 \<Longrightarrow> ball x d = cball y e
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
ball x d = cball y e

goal (2 subgoals):
 1. ball x d = cball y e \<Longrightarrow> d \<le> 0 \<and> e < 0
 2. d \<le> 0 \<and> e < 0 \<Longrightarrow> ball x d = cball y e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ball x d = cball y e
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
ball x d = cball y e

goal (1 subgoal):
 1. d \<le> 0 \<and> e < 0
[PROOF STEP]
apply (auto simp: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff algebra_simps)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>d + dist x y \<le> e; e + dist y x < d\<rbrakk> \<Longrightarrow> d \<le> 0
 2. \<lbrakk>d + dist x y \<le> e; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
 3. \<lbrakk>d + dist x y \<le> e; e < 0\<rbrakk> \<Longrightarrow> d \<le> 0
 4. \<lbrakk>d \<le> 0; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
[PROOF STEP]
apply (metis add_increasing2 add_le_cancel_right add_less_same_cancel1 dist_not_less_zero less_le_trans zero_le_dist)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>d + dist x y \<le> e; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
 2. \<lbrakk>d + dist x y \<le> e; e < 0\<rbrakk> \<Longrightarrow> d \<le> 0
 3. \<lbrakk>d \<le> 0; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
[PROOF STEP]
apply (metis add_less_same_cancel1 dist_not_less_zero less_le_trans not_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>d + dist x y \<le> e; e < 0\<rbrakk> \<Longrightarrow> d \<le> 0
 2. \<lbrakk>d \<le> 0; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
[PROOF STEP]
using \<open>?lhs\<close> ball_eq_empty cball_eq_empty
[PROOF STATE]
proof (prove)
using this:
ball x d = cball y e
(ball ?x ?e = {}) = (?e \<le> 0)
(cball ?x ?e = {}) = (?e < 0)

goal (2 subgoals):
 1. \<lbrakk>d + dist x y \<le> e; e < 0\<rbrakk> \<Longrightarrow> d \<le> 0
 2. \<lbrakk>d \<le> 0; e + dist y x < d\<rbrakk> \<Longrightarrow> e < 0
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
d \<le> 0 \<and> e < 0

goal (1 subgoal):
 1. d \<le> 0 \<and> e < 0 \<Longrightarrow> ball x d = cball y e
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d \<le> 0 \<and> e < 0 \<Longrightarrow> ball x d = cball y e
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
d \<le> 0 \<and> e < 0

goal (1 subgoal):
 1. d \<le> 0 \<and> e < 0 \<Longrightarrow> ball x d = cball y e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d \<le> 0 \<and> e < 0
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
d \<le> 0 \<and> e < 0

goal (1 subgoal):
 1. ball x d = cball y e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ball x d = cball y e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ty_exhaust: "ty = TBase \<or> (\<exists> \<sigma> \<tau> . ty = \<sigma> \<rightarrow> \<tau>) \<or> (\<exists> \<sigma> . ty = T \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ty = TBase \<or> (\<exists>\<sigma> \<tau>. ty = \<sigma> \<rightarrow> \<tau>) \<or> (\<exists>\<sigma>. ty = T \<sigma>)
[PROOF STEP]
by(induct ty rule:ty.induct) (auto)


[STATEMENT]
lemma ofsm_table_refinement_card_fix :
  assumes "equivalence_relation_on_states M f"
  and     "card (ofsm_table M f j ` states M) = card (ofsm_table M f i ` states M)"
  and     "q \<in> states M"
  and     "i \<le> j"
shows "ofsm_table M f j q = ofsm_table M f i q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
using assms (2,4)
[PROOF STATE]
proof (prove)
using this:
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j

goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
proof (induction "j-i" arbitrary: i j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>0 = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
 2. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>0 = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
 2. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j
[PROOF STEP]
have "i = j"
[PROOF STATE]
proof (prove)
using this:
0 = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j

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

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>0 = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
 2. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i = j

goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ofsm_table M f j q = ofsm_table M f i q

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>k = ?j - ?i; card (ofsm_table M f ?j ` FSM.states M) = card (ofsm_table M f ?i ` FSM.states M); ?i \<le> ?j\<rbrakk> \<Longrightarrow> ofsm_table M f ?j q = ofsm_table M f ?i q
Suc k = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k = ?j - ?i; card (ofsm_table M f ?j ` FSM.states M) = card (ofsm_table M f ?i ` FSM.states M); ?i \<le> ?j\<rbrakk> \<Longrightarrow> ofsm_table M f ?j q = ofsm_table M f ?i q
Suc k = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j
[PROOF STEP]
have "j \<ge> Suc i" and "k = j - Suc i"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k = ?j - ?i; card (ofsm_table M f ?j ` FSM.states M) = card (ofsm_table M f ?i ` FSM.states M); ?i \<le> ?j\<rbrakk> \<Longrightarrow> ofsm_table M f ?j q = ofsm_table M f ?i q
Suc k = j - i
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
i \<le> j

goal (1 subgoal):
 1. Suc i \<le> j &&& k = j - Suc i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc i \<le> j
k = j - Suc i

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
have *:"card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f (Suc i) ` FSM.states M)"
  and  **:"card (ofsm_table M f (Suc i) ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f (Suc i) ` FSM.states M) &&& card (ofsm_table M f (Suc i) ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
[PROOF STEP]
using ofsm_table_refinement_card[OF assms(1), where A="states M"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>FSM.states M \<subseteq> FSM.states M; ?i \<le> ?j\<rbrakk> \<Longrightarrow> card (ofsm_table M f ?i ` FSM.states M) \<le> card (ofsm_table M f ?j ` FSM.states M)

goal (1 subgoal):
 1. card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f (Suc i) ` FSM.states M) &&& card (ofsm_table M f (Suc i) ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)
[PROOF STEP]
by (metis Suc.prems(1) \<open>Suc i \<le> j\<close> eq_iff le_SucI)+
[PROOF STATE]
proof (state)
this:
card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f (Suc i) ` FSM.states M)
card (ofsm_table M f (Suc i) ` FSM.states M) = card (ofsm_table M f i ` FSM.states M)

goal (1 subgoal):
 1. \<And>x i j. \<lbrakk>\<And>i j. \<lbrakk>x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q; Suc x = j - i; card (ofsm_table M f j ` FSM.states M) = card (ofsm_table M f i ` FSM.states M); i \<le> j\<rbrakk> \<Longrightarrow> ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
using Suc.hyps(1)[OF \<open>k = j - Suc i\<close> * \<open>Suc i \<le> j\<close>]
[PROOF STATE]
proof (prove)
using this:
ofsm_table M f j q = ofsm_table M f (Suc i) q

goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
using ofsm_table_refinement_card_fix_Suc[OF assms(1) ** assms(3)]
[PROOF STATE]
proof (prove)
using this:
ofsm_table M f j q = ofsm_table M f (Suc i) q
ofsm_table M f (Suc i) q = ofsm_table M f i q

goal (1 subgoal):
 1. ofsm_table M f j q = ofsm_table M f i q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ofsm_table M f j q = ofsm_table M f i q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in wf_digraph) strongly_con_imp_reachable_eq_verts:
  "\<lbrakk> r \<in> verts G; strongly_connected G \<rbrakk> \<Longrightarrow> {x. r \<rightarrow>\<^sup>* x} = verts G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; strongly_connected G\<rbrakk> \<Longrightarrow> {x. r \<rightarrow>\<^sup>* x} = verts G
[PROOF STEP]
unfolding strongly_connected_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; verts G \<noteq> {} \<and> (\<forall>u\<in>verts G. \<forall>v\<in>verts G. u \<rightarrow>\<^sup>* v)\<rbrakk> \<Longrightarrow> {x. r \<rightarrow>\<^sup>* x} = verts G
[PROOF STEP]
using reachable_in_verts(2)
[PROOF STATE]
proof (prove)
using this:
?u \<rightarrow>\<^sup>* ?v \<Longrightarrow> ?v \<in> verts G

goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; verts G \<noteq> {} \<and> (\<forall>u\<in>verts G. \<forall>v\<in>verts G. u \<rightarrow>\<^sup>* v)\<rbrakk> \<Longrightarrow> {x. r \<rightarrow>\<^sup>* x} = verts G
[PROOF STEP]
by blast


[STATEMENT]
lemma bounded_plus_comp:
  fixes f g::"'a \<Rightarrow> 'b::real_normed_vector"
  assumes "bounded (f ` S)"
  assumes "bounded (g ` S)"
  shows "bounded ((\<lambda>x. f x + g x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
fix B C
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
assume "\<And>x. x\<in>S \<Longrightarrow> norm (f x) \<le> B" "\<And>x. x\<in>S \<Longrightarrow> norm (g x) \<le> C"
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B
?x \<in> S \<Longrightarrow> norm (g ?x) \<le> C

goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B
?x \<in> S \<Longrightarrow> norm (g ?x) \<le> C
[PROOF STEP]
have "\<And>x. x \<in> S \<Longrightarrow> norm (f x + g x) \<le> B + C"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B
?x \<in> S \<Longrightarrow> norm (g ?x) \<le> C

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> norm (f x + g x) \<le> B + C
[PROOF STEP]
by (auto intro!: norm_triangle_le add_mono)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> norm (f ?x + g ?x) \<le> B + C

goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> ?B3; \<And>x. x \<in> S \<Longrightarrow> norm (g x) \<le> ?C3; ?x \<in> S\<rbrakk> \<Longrightarrow> norm (f ?x + g ?x) \<le> ?B3 + ?C3

goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> ?B3; \<And>x. x \<in> S \<Longrightarrow> norm (g x) \<le> ?C3; ?x \<in> S\<rbrakk> \<Longrightarrow> norm (f ?x + g ?x) \<le> ?B3 + ?C3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> ?B3; \<And>x. x \<in> S \<Longrightarrow> norm (g x) \<le> ?C3; ?x \<in> S\<rbrakk> \<Longrightarrow> norm (f ?x + g ?x) \<le> ?B3 + ?C3

goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> ?B3; \<And>x. x \<in> S \<Longrightarrow> norm (g x) \<le> ?C3; ?x \<in> S\<rbrakk> \<Longrightarrow> norm (f ?x + g ?x) \<le> ?B3 + ?C3
bounded (f ` S)
bounded (g ` S)

goal (1 subgoal):
 1. bounded ((\<lambda>x. f x + g x) ` S)
[PROOF STEP]
by (fastforce simp: bounded_iff)
[PROOF STATE]
proof (state)
this:
bounded ((\<lambda>x. f x + g x) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem contraposition_not_valid: "\<not> valid (Contraposition (Pro ''p'') (Pro ''q''))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> valid (Eql' (Imp' (Pro ''p'') (Pro ''q'')) (Imp' (Neg' (Pro ''q'')) (Neg' (Pro ''p''))))
[PROOF STEP]
using contraposition_counterexample transfer
[PROOF STATE]
proof (prove)
using this:
\<not> valid_in {1, 2} (Eql' (Imp' (Pro ''p'') (Pro ''q'')) (Imp' (Neg' (Pro ''q'')) (Neg' (Pro ''p''))))
\<not> valid_in ?U ?p \<Longrightarrow> \<not> valid ?p

goal (1 subgoal):
 1. \<not> valid (Eql' (Imp' (Pro ''p'') (Pro ''q'')) (Imp' (Neg' (Pro ''q'')) (Neg' (Pro ''p''))))
[PROOF STEP]
by simp


[STATEMENT]
lemma numeral_le_floor [simp]: "numeral v \<le> \<lfloor>x\<rfloor> \<longleftrightarrow> numeral v \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral v \<le> \<lfloor>x\<rfloor>) = (numeral v \<le> x)
[PROOF STEP]
by (simp add: le_floor_iff)


[STATEMENT]
lemma incr_bv_combine: "incr_bv m k (incr_bv n k s) = incr_bv (m+n) k s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incr_bv m k (incr_bv n k s) = incr_bv (m + n) k s
[PROOF STEP]
by (induction s arbitrary: k) auto


[STATEMENT]
lemma nat_to_set_lub: "x \<in> nat_to_set u \<Longrightarrow> x \<le> log2 u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nat_to_set u \<Longrightarrow> x \<le> log2 u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> nat_to_set u \<Longrightarrow> x \<le> log2 u
[PROOF STEP]
assume "x \<in> nat_to_set u"
[PROOF STATE]
proof (state)
this:
x \<in> nat_to_set u

goal (1 subgoal):
 1. x \<in> nat_to_set u \<Longrightarrow> x \<le> log2 u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> nat_to_set u
[PROOF STEP]
have S1: "c_in x u = 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> nat_to_set u

goal (1 subgoal):
 1. c_in x u = 1
[PROOF STEP]
by (simp add: x_in_u_eq)
[PROOF STATE]
proof (state)
this:
c_in x u = 1

goal (1 subgoal):
 1. x \<in> nat_to_set u \<Longrightarrow> x \<le> log2 u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_in x u = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_in x u = 1

goal (1 subgoal):
 1. x \<le> log2 u
[PROOF STEP]
by (rule log2_lm4)
[PROOF STATE]
proof (state)
this:
x \<le> log2 u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_IccI:
  "\<lbrakk>(f \<longlongrightarrow> f a) (at_right a);
    (f \<longlongrightarrow> f b) (at_left b);
    (\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> f \<midarrow>x\<rightarrow> f x); a < b\<rbrakk> \<Longrightarrow>
    continuous_on {a .. b} f"
  for a::"'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f a) (at_right a); (f \<longlongrightarrow> f b) (at_left b); \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> f \<midarrow>x\<rightarrow> f x; a < b\<rbrakk> \<Longrightarrow> continuous_on {a..b} f
[PROOF STEP]
using at_within_open[of _ "{a<..<b}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> {a<..<b}; open {a<..<b}\<rbrakk> \<Longrightarrow> at ?a within {a<..<b} = at ?a

goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f a) (at_right a); (f \<longlongrightarrow> f b) (at_left b); \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> f \<midarrow>x\<rightarrow> f x; a < b\<rbrakk> \<Longrightarrow> continuous_on {a..b} f
[PROOF STEP]
by (auto simp: continuous_on_def at_within_Icc_at_right at_within_Icc_at_left le_less
      at_within_Icc_at)


[STATEMENT]
lemma MinPredicate2:
fixes
  P::"nat \<Rightarrow> bool"
assumes
 "\<exists> n . P n"
shows
  "\<exists> n0 . (P n0) \<and> (n0 = 0 \<or> \<not> P (n0 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n0. P n0 \<and> (n0 = 0 \<or> \<not> P (n0 - 1))
[PROOF STEP]
using assms MinPredicate
[PROOF STATE]
proof (prove)
using this:
\<exists>n. P n
\<exists>n. ?P n \<Longrightarrow> \<exists>n0. ?P n0 \<and> (\<forall>n'. ?P n' \<longrightarrow> n0 \<le> n')

goal (1 subgoal):
 1. \<exists>n0. P n0 \<and> (n0 = 0 \<or> \<not> P (n0 - 1))
[PROOF STEP]
by (metis add_diff_cancel_right' diff_is_0_eq diff_mult_distrib mult_eq_if)


[STATEMENT]
lemma col_elems_subset_mat: "i < dim_col N \<Longrightarrow> vec_set (col N i) \<subseteq> elements_mat N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_col N \<Longrightarrow> set\<^sub>v (col N i) \<subseteq> elements_mat N
[PROOF STEP]
by (auto simp add: vec_set_def elements_matI)


[STATEMENT]
lemma measure_hC[simp]:
  assumes A[measurable]: "A \<in> sets S"
  shows "measure hC A = \<P>(\<omega> in \<PP>. \<omega> \<in> A \<bar> hit_C \<omega> )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hC.prob A = cond_prob \<PP> (\<lambda>\<omega>. \<omega> \<in> A) hit_C
[PROOF STEP]
unfolding hC_def cond_prob_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure (uniform_measure \<PP> {\<omega> \<in> space \<PP>. hit_C \<omega>}) A = T.prob Start {\<omega> \<in> space \<PP>. \<omega> \<in> A \<and> hit_C \<omega>} / T.prob Start {\<omega> \<in> space \<PP>. hit_C \<omega>}
[PROOF STEP]
using emeasure_hit_C_not_0 A
[PROOF STATE]
proof (prove)
using this:
emeasure \<PP> {\<omega> \<in> space \<PP>. hit_C \<omega>} \<noteq> 0
A \<in> sets (stream_space (count_space UNIV))

goal (1 subgoal):
 1. Sigma_Algebra.measure (uniform_measure \<PP> {\<omega> \<in> space \<PP>. hit_C \<omega>}) A = T.prob Start {\<omega> \<in> space \<PP>. \<omega> \<in> A \<and> hit_C \<omega>} / T.prob Start {\<omega> \<in> space \<PP>. hit_C \<omega>}
[PROOF STEP]
by (subst measure_uniform_measure) (simp_all add: T.emeasure_eq_measure Int_def conj_ac)


[STATEMENT]
theorem for_rec3_eq:
  "for_rec3 f a n n n n =
    nfoldli [0..<n + 1] (\<lambda>x. True)
     (\<lambda>k. nfoldli [0..<n + 1] (\<lambda>x. True)
           (\<lambda>i. nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>j a. f a k i j)))
     a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. for_rec3 f a n n n n = nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>k. nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>i. nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>j a. f a k i j))) a
[PROOF STEP]
using
  for_rec3'_for_rec[
    unfolded for_rec3_for_rec3'[symmetric], unfolded for_comb_for_rec[symmetric] for_comb_def
  ]
[PROOF STATE]
proof (prove)
using this:
for_rec3 ?f ?a ?n ?n ?n ?n = nfoldli [0..<?n + 1] (\<lambda>x. True) (\<lambda>k. nfoldli [0..<?n + 1] (\<lambda>x. True) (\<lambda>ka. nfoldli [0..<?n + 1] (\<lambda>x. True) (\<lambda>kb a. ?f a k ka kb))) ?a

goal (1 subgoal):
 1. for_rec3 f a n n n n = nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>k. nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>i. nfoldli [0..<n + 1] (\<lambda>x. True) (\<lambda>j a. f a k i j))) a
[PROOF STEP]
.


[STATEMENT]
lemma fps_of_poly_prod_list: "fps_of_poly (prod_list xs) = prod_list (map fps_of_poly xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (prod_list xs) = prod_list (map fps_of_poly xs)
[PROOF STEP]
by (induction xs) (simp_all add: fps_of_poly_mult)


[STATEMENT]
lemma powreal_le_mono:
   "\<lbrakk> r \<le> s; a \<ge> 1 \<rbrakk> \<Longrightarrow> a pow\<^sub>\<real> r \<le> a pow\<^sub>\<real> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<le> s; 1 \<le> a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<real> r \<le> a pow\<^sub>\<real> s
[PROOF STEP]
by (metis powa_le_mono powreal_eq_powa)


[STATEMENT]
lemma path_connected_translation:
  fixes a :: "'a :: topological_group_add"
  shows "path_connected ((\<lambda>x. a + x) ` S) = path_connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected ((+) a ` S) = path_connected S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_connected ((+) a ` S) = path_connected S
[PROOF STEP]
have "\<forall>x y. (+) (x::'a) ` (+) (0 - x) ` y = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (+) x ` (+) ((0::'a) - x) ` y = y
[PROOF STEP]
by (simp add: image_image)
[PROOF STATE]
proof (state)
this:
\<forall>x y. (+) x ` (+) ((0::'a) - x) ` y = y

goal (1 subgoal):
 1. path_connected ((+) a ` S) = path_connected S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x y. (+) x ` (+) ((0::'a) - x) ` y = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. (+) x ` (+) ((0::'a) - x) ` y = y

goal (1 subgoal):
 1. path_connected ((+) a ` S) = path_connected S
[PROOF STEP]
by (metis (no_types) path_connected_translationI)
[PROOF STATE]
proof (state)
this:
path_connected ((+) a ` S) = path_connected S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  cross_zero_left [simp]: "0 \<times> x = 0" and cross_zero_right [simp]: "x \<times> 0 = 0" for x::"real^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<times> x = 0 &&& x \<times> 0 = 0
[PROOF STEP]
by (simp_all add: cross3_simps)


[STATEMENT]
lemma LIM_eq: "f \<midarrow>a\<rightarrow> L = (\<forall>r>0. \<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - L) < r)"
  for a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> L = (\<forall>r>0. \<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - L) < r)
[PROOF STEP]
by (simp add: LIM_def dist_norm)


[STATEMENT]
lemma size_cnf_concat: "size_cnf (concat xs) = sum_list (map size_cnf xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_cnf (concat xs) = sum_list (map size_cnf xs)
[PROOF STEP]
unfolding size_cnf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map length (concat xs)) + length (concat xs) = (\<Sum>cnf\<leftarrow>xs. sum_list (map length cnf) + length cnf)
[PROOF STEP]
by (induct xs, auto)


[STATEMENT]
lemma (in aGroup) nsumElmAdd:
  "\<lbrakk> \<forall> i. f i \<in> carrier A; \<forall> i. g i \<in> carrier A\<rbrakk>
        \<Longrightarrow> nsum A (\<lambda> i. (f i) \<plusminus> (g i)) n = (nsum A f n) \<plusminus> (nsum A g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n
[PROOF STEP]
apply (cut_tac nsum_add[of n f g])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A; \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A (\<lambda>i. f i \<plusminus> g i) n = \<Sigma>\<^sub>e A f n \<plusminus> \<Sigma>\<^sub>e A g n
 2. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. f j \<in> carrier A
 3. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. g j \<in> carrier A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. f j \<in> carrier A
 2. \<lbrakk>\<forall>i. f i \<in> carrier A; \<forall>i. g i \<in> carrier A\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. g j \<in> carrier A
[PROOF STEP]
apply (rule allI, simp)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Sup_ereal_mult_left':
  "\<lbrakk> Y \<noteq> {}; x \<ge> 0 \<rbrakk> \<Longrightarrow> ereal x * (SUP i\<in>Y. f i) = (SUP i\<in>Y. ereal x * f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Y \<noteq> {}; 0 \<le> x\<rbrakk> \<Longrightarrow> ereal x * Sup (f ` Y) = (SUP i\<in>Y. ereal x * f i)
[PROOF STEP]
by(subst (1 2) mult.commute)(rule Sup_ereal_mult_right')


[STATEMENT]
lemma coin_set_eq: "(g \<circ> fst)`(\<CC> g h) = (h \<circ> snd)`(\<CC> g h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<circ> fst) ` \<CC> g h = (h \<circ> snd) ` \<CC> g h
[PROOF STEP]
unfolding coincidence_set_def comp_apply
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (fst x)) ` {(r, s). g r = h s} = (\<lambda>x. h (snd x)) ` {(r, s). g r = h s}
[PROOF STEP]
using Product_Type.Collect_case_prodD[of _ "\<lambda> x y. g x = h y"] image_cong
[PROOF STATE]
proof (prove)
using this:
?x \<in> {(x, y). g x = h y} \<Longrightarrow> g (fst ?x) = h (snd ?x)
\<lbrakk>?M = ?N; \<And>x. x \<in> ?N \<Longrightarrow> ?f x = ?g x\<rbrakk> \<Longrightarrow> ?f ` ?M = ?g ` ?N

goal (1 subgoal):
 1. (\<lambda>x. g (fst x)) ` {(r, s). g r = h s} = (\<lambda>x. h (snd x)) ` {(r, s). g r = h s}
[PROOF STEP]
by auto


[STATEMENT]
lemma bij_extend_act_eq_project_act: "bij h
      ==> extend_act (%(x,u::'c). h x) = project_act (%(x,u::'c). inv h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> extend_act (\<lambda>(x, u). h x) = project_act (\<lambda>(x, u). inv h x)
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. bij h \<Longrightarrow> extend_act (\<lambda>(x, u). h x) x = project_act (\<lambda>(x, u). inv h x) x
[PROOF STEP]
apply (force simp add: extend_act_def project_act_def bij_def surj_f_inv_f)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done