[STATEMENT]
lemma (in prob_space) uniform_distributed_expectation:
  fixes a b :: real
  assumes D: "distributed M lborel X (\<lambda>x. indicator {a .. b} x / measure lborel {a .. b})"
  shows "expectation X = (a + b) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation X = (a + b) / 2
[PROOF STEP]
proof (subst distributed_integral[OF D, of "\<lambda>x. x", symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
 3. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
have "a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b
[PROOF STEP]
using uniform_distributed_bounds[OF D]
[PROOF STATE]
proof (prove)
using this:
a < b

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

goal (3 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
 3. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
have "(\<integral> x. indicator {a .. b} x / measure lborel {a .. b} * x \<partial>lborel) =
    (\<integral> x. (x / measure lborel {a .. b}) * indicator {a .. b} x \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x. indicat_real {a..b} x / content {a..b} * x = LBINT x. x / content {a..b} * indicat_real {a..b} x
[PROOF STEP]
by (intro Bochner_Integration.integral_cong) auto
[PROOF STATE]
proof (state)
this:
LBINT x. indicat_real {a..b} x / content {a..b} * x = LBINT x. x / content {a..b} * indicat_real {a..b} x

goal (3 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
 3. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LBINT x. indicat_real {a..b} x / content {a..b} * x = LBINT x. x / content {a..b} * indicat_real {a..b} x

goal (3 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
 3. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
have "(\<integral> x. (x / measure lborel {a .. b}) * indicator {a .. b} x \<partial>lborel) = (a + b) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x. x / content {a..b} * indicat_real {a..b} x = (a + b) / 2
[PROOF STEP]
proof (subst integral_FTC_Icc_real)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. a \<le> b
 2. \<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> (?F has_real_derivative x / content {a..b}) (at x)
 3. \<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. x / content {a..b}) x
 4. ?F b - ?F a = (a + b) / 2
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. a \<le> b
 2. \<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> (?F has_real_derivative x / content {a..b}) (at x)
 3. \<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. x / content {a..b}) x
 4. ?F b - ?F a = (a + b) / 2
[PROOF STEP]
show "DERIV (\<lambda>x. x\<^sup>2 / (2 * measure lborel {a..b})) x :> x / measure lborel {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x\<^sup>2 / (2 * content {a..b})) has_real_derivative x / content {a..b}) (at x)
[PROOF STEP]
using uniform_distributed_params[OF D]
[PROOF STATE]
proof (prove)
using this:
{a..b} \<in> sets lborel
content {a..b} \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. x\<^sup>2 / (2 * content {a..b})) has_real_derivative x / content {a..b}) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp del: content_real_if)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x\<^sup>2 / (2 * content {a..b})) has_real_derivative x / content {a..b}) (at x)

goal (3 subgoals):
 1. a \<le> b
 2. \<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. x / content {a..b}) x
 3. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2
[PROOF STEP]
show "isCont (\<lambda>x. x / Sigma_Algebra.measure lborel {a..b}) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. x / content {a..b}) x
[PROOF STEP]
using uniform_distributed_params[OF D]
[PROOF STATE]
proof (prove)
using this:
{a..b} \<in> sets lborel
content {a..b} \<noteq> 0

goal (1 subgoal):
 1. isCont (\<lambda>x. x / content {a..b}) x
[PROOF STEP]
by (auto intro!: isCont_divide)
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. x / content {a..b}) x

goal (2 subgoals):
 1. a \<le> b
 2. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2
[PROOF STEP]
have *: "b\<^sup>2 / (2 * measure lborel {a..b}) - a\<^sup>2 / (2 * measure lborel {a..b}) =
      (b*b - a * a) / (2 * (b - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (b * b - a * a) / (2 * (b - a))
[PROOF STEP]
using \<open>a < b\<close>
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (b * b - a * a) / (2 * (b - a))
[PROOF STEP]
by (auto simp: measure_def power2_eq_square diff_divide_distrib[symmetric])
[PROOF STATE]
proof (state)
this:
b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (b * b - a * a) / (2 * (b - a))

goal (2 subgoals):
 1. a \<le> b
 2. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2
[PROOF STEP]
show "b\<^sup>2 / (2 * measure lborel {a..b}) - a\<^sup>2 / (2 * measure lborel {a..b}) = (a + b) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2
[PROOF STEP]
using \<open>a < b\<close>
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2
[PROOF STEP]
unfolding * square_diff_square_factored
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. (b + a) * (b - a) / (2 * (b - a)) = (a + b) / 2
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
b\<^sup>2 / (2 * content {a..b}) - a\<^sup>2 / (2 * content {a..b}) = (a + b) / 2

goal (1 subgoal):
 1. a \<le> b
[PROOF STEP]
qed (insert \<open>a < b\<close>, simp)
[PROOF STATE]
proof (state)
this:
LBINT x. x / content {a..b} * indicat_real {a..b} x = (a + b) / 2

goal (3 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
 3. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
show "(\<integral> x. indicator {a .. b} x / measure lborel {a .. b} * x \<partial>lborel) = (a + b) / 2"
[PROOF STATE]
proof (prove)
using this:
LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2

goal (1 subgoal):
 1. LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LBINT x. indicat_real {a..b} x / content {a..b} * x = (a + b) / 2

goal (2 subgoals):
 1. (\<lambda>x. x) \<in> borel_measurable lborel
 2. \<And>x. x \<in> space lborel \<Longrightarrow> 0 \<le> indicat_real {a..b} x / content {a..b}
[PROOF STEP]
qed (auto simp: measure_nonneg)


[STATEMENT]
lemma Bex_cartesian_product: "(\<exists>xy \<in> A \<times> B. P xy) \<equiv> (\<exists>x \<in> A. \<exists>y \<in> B. P (x, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xy\<in>A \<times> B. P xy \<equiv> \<exists>x\<in>A. \<exists>y\<in>B. P (x, y)
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_at_fst:
  assumes "eventually P (at (fst x))"
  assumes "P (fst x)"
  shows "eventually (\<lambda>h. P (fst h)) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F h in at x. P (fst h)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eventually P (at (fst x))
P (fst x)

goal (1 subgoal):
 1. \<forall>\<^sub>F h in at x. P (fst h)
[PROOF STEP]
unfolding eventually_at_topological
[PROOF STATE]
proof (prove)
using this:
\<exists>S. open S \<and> fst x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> fst x \<longrightarrow> xa \<in> UNIV \<longrightarrow> P xa)
P (fst x)

goal (1 subgoal):
 1. \<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<noteq> x \<longrightarrow> xa \<in> UNIV \<longrightarrow> P (fst xa))
[PROOF STEP]
by (metis open_vimage_fst rangeI range_fst vimageE vimageI)


[STATEMENT]
lemma "((\<lambda>x::real. exp x * (exp (1/x + exp (-x) + exp (-(x^2))) -
                     exp (1/x - exp (-exp x)))) \<longlongrightarrow> 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp x * (exp (1 / x + exp (- x) + exp (- x\<^sup>2)) - exp (1 / x - exp (- exp x)))) \<longlongrightarrow> 1) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma real_sqrt_mult: "sqrt (x * y) = sqrt x * sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x * y) = sqrt x * sqrt y
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 (x * y) = root 2 x * root 2 y
[PROOF STEP]
by (rule real_root_mult)


[STATEMENT]
lemma karatsuba_main_step: fixes f :: "'a :: comm_ring_1 poly"
  assumes f: "f = monom_mult n f1 + f0" and g: "g = monom_mult n g1 + g0"
  shows
    "monom_mult (n + n) (f1 * g1) + (monom_mult n (f1 * g1 - (f1 - f0) * (g1 - g0) + f0 * g0) + f0 * g0) = f * g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult (n + n) (f1 * g1) + (monom_mult n (f1 * g1 - (f1 - f0) * (g1 - g0) + f0 * g0) + f0 * g0) = f * g
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult (n + n) (f1 * g1) + (monom_mult n (f1 * g1 - (f1 - f0) * (g1 - g0) + f0 * g0) + f0 * g0) = (monom_mult n f1 + f0) * (monom_mult n g1 + g0)
[PROOF STEP]
by (auto simp: field_simps mult_monom monom_mult_def)


[STATEMENT]
lemma half_sqrt_two_squared: "2 * (sqrt 2 / 2)\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (sqrt 2 / 2)\<^sup>2 = 1
[PROOF STEP]
by (auto simp add: power2_eq_square)


[STATEMENT]
lemma inv_mtx_chB_hOsc:
  "a \<noteq> b \<Longrightarrow> (P a b)\<^sup>-\<^sup>1 = (1/(a - b)) *\<^sub>R mtx
   ([ 1, -b] #
    [-1,  a] # [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> P a b\<^sup>-\<^sup>1 = (1 / (a - b)) *\<^sub>R mtx [[1, - b], [- 1, a]]
[PROOF STEP]
apply(rule sq_mtx_inv_unique, unfold scaleR_mtx2 times_mtx2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<noteq> b \<Longrightarrow> mtx [[a * (1 / (a - b) * 1) + b * (1 / (a - b) * - 1), a * (1 / (a - b) * - b) + b * (1 / (a - b) * a)], [1 * (1 / (a - b) * 1) + 1 * (1 / (a - b) * - 1), 1 * (1 / (a - b) * - b) + 1 * (1 / (a - b) * a)]] = 1
 2. a \<noteq> b \<Longrightarrow> mtx [[1 / (a - b) * 1 * a + 1 / (a - b) * - b * 1, 1 / (a - b) * 1 * b + 1 / (a - b) * - b * 1], [1 / (a - b) * - 1 * a + 1 / (a - b) * a * 1, 1 / (a - b) * - 1 * b + 1 / (a - b) * a * 1]] = 1
[PROOF STEP]
by (simp add: diff_divide_distrib[symmetric] one_mtx2)+


[STATEMENT]
lemma det_def': "A \<in> carrier_mat n n \<Longrightarrow>
  det A = (\<Sum> p \<in> {p. p permutes {0 ..< n}}.
     signof p * (\<Prod> i = 0 ..< n. A $$ (i, p i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n \<Longrightarrow> det A = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. A $$ (i, p i)))
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n \<Longrightarrow> (if dim_row A = dim_col A then \<Sum>p | p permutes {0..<dim_row A}. of_int (sign p) * (\<Prod>i = 0..<dim_row A. A $$ (i, p i)) else (0::'a)) = (\<Sum>p | p permutes {0..<n}. of_int (sign p) * (\<Prod>i = 0..<n. A $$ (i, p i)))
[PROOF STEP]
by auto


[STATEMENT]
lemma  rfn_tool12_2:"\<lbrakk>0 < (s::nat); (i::nat) mod s = s - Suc 0\<rbrakk> \<Longrightarrow>
                                               (Suc i) mod s = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - Suc 0\<rbrakk> \<Longrightarrow> Suc i mod s = 0
[PROOF STEP]
apply (insert div_mult_mod_eq [THEN sym, of "i" "s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - Suc 0; i = i div s * s + i mod s\<rbrakk> \<Longrightarrow> Suc i mod s = 0
[PROOF STEP]
apply (insert add_Suc_right [THEN sym, of "i div s * s" "i mod s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - Suc 0; i = i div s * s + i mod s; Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)\<rbrakk> \<Longrightarrow> Suc i mod s = 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ord_gt_0_iff [simp]: "ord (n::nat) x > 0 \<longleftrightarrow> coprime n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < ord n x) = coprime n x
[PROOF STEP]
using ord_eq_0[of n x]
[PROOF STATE]
proof (prove)
using this:
(ord n x = 0) = (\<not> coprime n x)

goal (1 subgoal):
 1. (0 < ord n x) = coprime n x
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_disc_lim_l: "(\<Sum>x. l^x * B) = B /(1-l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x. l ^ x * B) = B / (1 - l)
[PROOF STEP]
by (simp add: suminf_mult2[symmetric] summable_geometric suminf_geometric[of l])


[STATEMENT]
lemma sets_pair_in_sets:
  assumes "\<And>a b. a \<in> sets A \<Longrightarrow> b \<in> sets B \<Longrightarrow> a \<times> b \<in> sets N"
  shows "sets (A \<Otimes>\<^sub>M B) \<subseteq> sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (A \<Otimes>\<^sub>M B) \<subseteq> sets N
[PROOF STEP]
unfolding sets_pair_measure
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets (space A \<times> space B) {a \<times> b |a b. a \<in> sets A \<and> b \<in> sets B} \<subseteq> sets N
[PROOF STEP]
by (intro sets.sigma_sets_subset') (auto intro!: assms)


[STATEMENT]
lemma trigonometric_set_integrable [simp]: "integrable (lebesgue_on {-pi..pi}) (trigonometric_set n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (trigonometric_set n)
[PROOF STEP]
using trigonometric_set_mul_integrable [where f = id]
[PROOF STATE]
proof (prove)
using this:
id absolutely_integrable_on {- pi..pi} \<Longrightarrow> integrable (lebesgue_on {- pi..pi}) (\<lambda>x. trigonometric_set ?n x * id x)

goal (1 subgoal):
 1. integrable (lebesgue_on {- pi..pi}) (trigonometric_set n)
[PROOF STEP]
by simp (metis absolutely_integrable_imp_integrable fmeasurableD interval_cbox lmeasurable_cbox square_integrable_imp_absolutely_integrable square_integrable_trigonometric_set)


[STATEMENT]
lemma DERIV_compose_FDERIV:
  fixes f::"real\<Rightarrow>real"
  assumes "DERIV f (g x) :> f'"
  assumes "(g has_derivative g') (at x within s)"
  shows "((\<lambda>x. f (g x)) has_derivative (\<lambda>x. g' x * f')) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) has_derivative (\<lambda>x. g' x * f')) (at x within s)
[PROOF STEP]
using assms has_derivative_compose[of g g' x s f "(*) f'"]
[PROOF STATE]
proof (prove)
using this:
(f has_real_derivative f') (at (g x))
(g has_derivative g') (at x within s)
\<lbrakk>(g has_derivative g') (at x within s); (f has_derivative (*) f') (at (g x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x)) has_derivative (\<lambda>x. f' * g' x)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) has_derivative (\<lambda>x. g' x * f')) (at x within s)
[PROOF STEP]
by (auto simp: has_field_derivative_def ac_simps)


[STATEMENT]
lemma norm1_0_iff[simp]: "(norm1 v = 0) = (v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm1 v = 0) = (v = 0)
[PROOF STEP]
using norm1_0 norm1_nonzero
[PROOF STATE]
proof (prove)
using this:
norm1 0 = 0
?v \<noteq> 0 \<Longrightarrow> 0 < norm1 ?v

goal (1 subgoal):
 1. (norm1 v = 0) = (v = 0)
[PROOF STEP]
by (cases "v = 0", force+)


[STATEMENT]
lemma height_bal_subtrees_merge: "\<lbrakk>height (Node as a) = height (Node bs b); bal (Node as a); bal (Node bs b)\<rbrakk>
 \<Longrightarrow> \<forall>x \<in> set (subtrees as) \<union> {a}. height x = height b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>height (Node as a) = height (Node bs b); bal (Node as a); bal (Node bs b)\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (subtrees as) \<union> {a}. height x = height b
[PROOF STEP]
by (metis Suc_inject Un_iff bal.simps(2) height_bal_tree singletonD)


[STATEMENT]
lemma mat_rep_num_sum_alt:
  fixes M :: "'a :: {ring_1} mat"
  shows "elements_mat M \<subseteq> {0, 1} \<Longrightarrow> i < dim_row M \<Longrightarrow> of_nat (mat_rep_num M i) = sum_vec (row M i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>elements_mat M \<subseteq> {0::'a, 1::'a}; i < dim_row M\<rbrakk> \<Longrightarrow> of_nat (mat_rep_num M i) = sum_vec (row M i)
[PROOF STEP]
using count_vec_sum_ones_alt
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v ?v \<subseteq> {0::?'a, 1::?'a} \<Longrightarrow> of_nat (count_vec ?v (1::?'a)) = sum_vec ?v

goal (1 subgoal):
 1. \<lbrakk>elements_mat M \<subseteq> {0::'a, 1::'a}; i < dim_row M\<rbrakk> \<Longrightarrow> of_nat (mat_rep_num M i) = sum_vec (row M i)
[PROOF STEP]
by (metis mat_rep_num_def row_elems_subset_mat subset_trans)


[STATEMENT]
lemma hnorm_mult_less:
  "\<And>(x::'a::real_normed_algebra star) y r s. hnorm x < r \<Longrightarrow> hnorm y < s \<Longrightarrow> hnorm (x * y) < r * s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y r s. \<lbrakk>hnorm x < r; hnorm y < s\<rbrakk> \<Longrightarrow> hnorm (x * y) < r * s
[PROOF STEP]
by transfer (rule norm_mult_less)


[STATEMENT]
lemma fls_left_inverse_eq_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   "fls_left_inverse f x = fls_right_inverse f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_left_inverse f x = fls_right_inverse f y
[PROOF STEP]
using   assms
[PROOF STATE]
proof (prove)
using this:
x * f $$ fls_subdegree f = (1::'a)
f $$ fls_subdegree f * y = (1::'a)

goal (1 subgoal):
 1. fls_left_inverse f x = fls_right_inverse f y
[PROOF STEP]
by      (simp add: fps_left_inverse_eq_fps_right_inverse)


[STATEMENT]
lemma F_gr_0:
  assumes "as \<noteq> []"
  shows "F k as > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
have "rat_of_nat 1 \<le> rat_of_nat (card (set as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_nat 1 \<le> rat_of_nat (card (set as))
[PROOF STEP]
using assms card_0_eq[where A="set as"]
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []
finite (set as) \<Longrightarrow> (card (set as) = 0) = (set as = {})

goal (1 subgoal):
 1. rat_of_nat 1 \<le> rat_of_nat (card (set as))
[PROOF STEP]
by (intro of_nat_mono)
     (metis List.finite_set One_nat_def Suc_leI neq0_conv set_empty)
[PROOF STATE]
proof (state)
this:
rat_of_nat 1 \<le> rat_of_nat (card (set as))

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rat_of_nat 1 \<le> rat_of_nat (card (set as))

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
have "... = (\<Sum>x\<in>set as. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_nat (card (set as)) = (\<Sum>x\<in>set as. 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rat_of_nat (card (set as)) = (\<Sum>x\<in>set as. 1)

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rat_of_nat (card (set as)) = (\<Sum>x\<in>set as. 1)

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
have "... \<le> (\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set as. 1) \<le> (\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k)
[PROOF STEP]
by (intro sum_mono one_le_power)
     (metis  count_list_gr_1  of_nat_1 of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. 1) \<le> (\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k)

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. 1) \<le> (\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k)

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
have "... \<le> F k as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k) \<le> F k as
[PROOF STEP]
by (simp add:F_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. rat_of_nat (count_list as x) ^ k) \<le> F k as

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rat_of_nat 1 \<le> F k as
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rat_of_nat 1 \<le> F k as

goal (1 subgoal):
 1. 0 < F k as
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < F k as

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaleR_mtx2: "k *\<^sub>R mtx
  ([a, b] #
   [c, d] # []) = mtx
  ([k*a, k*b] #
   [k*c, k*d] # [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k *\<^sub>R mtx [[a, b], [c, d]] = mtx [[k * a, k * b], [k * c, k * d]]
[PROOF STEP]
by (simp add: sq_mtx_eq_iff)


[STATEMENT]
lemma card_of_Func_UNIV_UNIV:
"|Func (UNIV::'a set) (UNIV::'b set)| =o |UNIV::('a \<Rightarrow> 'b) set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Func UNIV UNIV| =o |UNIV|
[PROOF STEP]
using card_of_Func_UNIV[of "UNIV::'b set"]
[PROOF STATE]
proof (prove)
using this:
|Func UNIV UNIV| =o |{f. range f \<subseteq> UNIV}|

goal (1 subgoal):
 1. |Func UNIV UNIV| =o |UNIV|
[PROOF STEP]
by auto


[STATEMENT]
lemma card_map_elide:
  "card ((of_nat :: nat \<Rightarrow> 'a::len word) ` {0..<n}) = card {0..<n}"
  if "n \<le> CARD('a::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
let ?of_nat = "of_nat :: nat \<Rightarrow> 'a word"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
have "inj_on ?of_nat {i. i < CARD('a word)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on word_of_nat {i. i < CARD('a word)}
[PROOF STEP]
by (rule inj_onI) (simp add: card_word of_nat_inj)
[PROOF STATE]
proof (state)
this:
inj_on word_of_nat {i. i < CARD('a word)}

goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on word_of_nat {i. i < CARD('a word)}

goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
have "{0..<n} \<subseteq> {i. i < CARD('a word)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<n} \<subseteq> {i. i < CARD('a word)}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
n \<le> CARD('a word)

goal (1 subgoal):
 1. {0..<n} \<subseteq> {i. i < CARD('a word)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} \<subseteq> {i. i < CARD('a word)}

goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on word_of_nat {i. i < CARD('a word)}
{0..<n} \<subseteq> {i. i < CARD('a word)}
[PROOF STEP]
have "inj_on ?of_nat {0..<n}"
[PROOF STATE]
proof (prove)
using this:
inj_on word_of_nat {i. i < CARD('a word)}
{0..<n} \<subseteq> {i. i < CARD('a word)}

goal (1 subgoal):
 1. inj_on word_of_nat {0..<n}
[PROOF STEP]
by (rule inj_on_subset)
[PROOF STATE]
proof (state)
this:
inj_on word_of_nat {0..<n}

goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on word_of_nat {0..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on word_of_nat {0..<n}

goal (1 subgoal):
 1. card (word_of_nat ` {0..<n}) = card {0..<n}
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card (word_of_nat ` {0..<n}) = card {0..<n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_multi_arith_prog_onD:
  assumes "is_multi_arith_prog_on l m start steps a b"
  assumes "c \<in> {0..<m} \<rightarrow> {0..<l}"
  shows   "multi_arith_prog m start steps c \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
have "multi_arith_prog m start steps (\<lambda>_. 0) \<le>
          multi_arith_prog m start steps c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multi_arith_prog m start steps (\<lambda>_. 0) \<le> multi_arith_prog m start steps c
[PROOF STEP]
by (rule multi_arith_prog_mono) auto
[PROOF STATE]
proof (state)
this:
multi_arith_prog m start steps (\<lambda>_. 0) \<le> multi_arith_prog m start steps c

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
hence "multi_arith_prog m start steps c \<ge> a"
[PROOF STATE]
proof (prove)
using this:
multi_arith_prog m start steps (\<lambda>_. 0) \<le> multi_arith_prog m start steps c

goal (1 subgoal):
 1. a \<le> multi_arith_prog m start steps c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
multi_arith_prog m start steps (\<lambda>_. 0) \<le> multi_arith_prog m start steps c
is_multi_arith_prog_on l m start steps a b
c \<in> {0..<m} \<rightarrow> {0..<l}

goal (1 subgoal):
 1. a \<le> multi_arith_prog m start steps c
[PROOF STEP]
by (simp add: multi_arith_prog_def
       is_multi_arith_prog_on_def)
[PROOF STATE]
proof (state)
this:
a \<le> multi_arith_prog m start steps c

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<le> multi_arith_prog m start steps c

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
have "multi_arith_prog m start steps (\<lambda>_. l-1) \<ge>
                   multi_arith_prog m start steps c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multi_arith_prog m start steps c \<le> multi_arith_prog m start steps (\<lambda>_. l - 1)
[PROOF STEP]
by (rule multi_arith_prog_mono) (use assms in force)
[PROOF STATE]
proof (state)
this:
multi_arith_prog m start steps c \<le> multi_arith_prog m start steps (\<lambda>_. l - 1)

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
hence "multi_arith_prog m start steps c \<le> b"
[PROOF STATE]
proof (prove)
using this:
multi_arith_prog m start steps c \<le> multi_arith_prog m start steps (\<lambda>_. l - 1)

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<le> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
multi_arith_prog m start steps c \<le> multi_arith_prog m start steps (\<lambda>_. l - 1)
is_multi_arith_prog_on l m start steps a b
c \<in> {0..<m} \<rightarrow> {0..<l}

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<le> b
[PROOF STEP]
by (simp add: multi_arith_prog_def
        is_multi_arith_prog_on_def)
[PROOF STATE]
proof (state)
this:
multi_arith_prog m start steps c \<le> b

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<le> multi_arith_prog m start steps c
multi_arith_prog m start steps c \<le> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> multi_arith_prog m start steps c
multi_arith_prog m start steps c \<le> b

goal (1 subgoal):
 1. multi_arith_prog m start steps c \<in> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
multi_arith_prog m start steps c \<in> {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_natD:
  assumes "prime (p :: nat)" "a dvd p"
  shows   "a = 1 \<or> a = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = 1 \<or> a = p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
a dvd p

goal (1 subgoal):
 1. a = 1 \<or> a = p
[PROOF STEP]
by (auto simp: prime_nat_iff)


[STATEMENT]
lemma eccentricity_empty_vertices: "V = {} \<Longrightarrow> eccentricity v = 0"
  "V = {v} \<Longrightarrow> eccentricity v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V = {} \<Longrightarrow> eccentricity v = 0) &&& (V = {v} \<Longrightarrow> eccentricity v = 0)
[PROOF STEP]
unfolding eccentricity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V = {} \<Longrightarrow> Sup (shortest_path v ` (V - {v})) = 0) &&& (V = {v} \<Longrightarrow> Sup (shortest_path v ` (V - {v})) = 0)
[PROOF STEP]
using bot_enat_def
[PROOF STATE]
proof (prove)
using this:
bot = 0

goal (1 subgoal):
 1. (V = {} \<Longrightarrow> Sup (shortest_path v ` (V - {v})) = 0) &&& (V = {v} \<Longrightarrow> Sup (shortest_path v ` (V - {v})) = 0)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma seq_offset_neg:
  "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> ((\<lambda>i. f(i - k)) \<longlongrightarrow> l) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>i. f (i - k)) \<longlonglongrightarrow> l
[PROOF STEP]
apply (erule filterlim_compose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x sequentially. x - k :> sequentially
[PROOF STEP]
apply (simp add: filterlim_def le_sequentially eventually_filtermap eventually_sequentially, arith)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_ccInf_iff: "countable A \<Longrightarrow> b \<le> Inf A \<longleftrightarrow> (\<forall>a\<in>A. b \<le> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> (b \<le> Inf A) = (\<forall>a\<in>A. b \<le> a)
[PROOF STEP]
by (auto intro: ccInf_greatest dest: ccInf_lower)


[STATEMENT]
lemma neighbourhood_base_of:
   "neighbourhood_base_of P X \<longleftrightarrow>
        (\<forall>W x. openin X W \<and> x \<in> W
          \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. neighbourhood_base_of P X = (\<forall>W x. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))
[PROOF STEP]
unfolding neighbourhood_base_at_def neighbourhood_base_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. \<forall>W. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)) = (\<forall>W x. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))
[PROOF STEP]
using openin_subset
[PROOF STATE]
proof (prove)
using this:
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. (\<forall>x\<in>topspace X. \<forall>W. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W)) = (\<forall>W x. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U V. openin X U \<and> P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))
[PROOF STEP]
by blast


[STATEMENT]
lemma diff_frac_eq_1:
assumes "b \<noteq> (0::real)"
shows "1 - a / b = (b - a) / b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - a / b = (b - a) / b
[PROOF STEP]
by (metis assms diff_divide_distrib divide_self_if)


[STATEMENT]
lemma senior_states_card:
  "card (senior_states p n) = card (senior_states q n) \<longleftrightarrow> senior_states p n = senior_states q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (senior_states p n) = card (senior_states q n)) = (senior_states p n = senior_states q n)
[PROOF STEP]
by (metis less_not_refl senior_states_cases_subset senior_states_psubset_card_mono)


[STATEMENT]
lemma connected_space_eq_not_separated_subset:
  "connected_space X \<longleftrightarrow>
    (\<nexists>C1 C2. topspace X \<subseteq> C1 \<union> C2 \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> separatedin X C1 C2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_space X = (\<nexists>C1 C2. topspace X \<subseteq> C1 \<union> C2 \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> separatedin X C1 C2)
[PROOF STEP]
by (metis connected_space_eq_not_separated le_sup_iff separatedin_def subset_antisym)


[STATEMENT]
lemma ran_map_of_zip:
  assumes "length xs = length ys" "distinct xs"
  shows "ran (map_of (zip xs ys)) = set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ran (map_of (zip xs ys)) = set ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
distinct xs

goal (1 subgoal):
 1. ran (map_of (zip xs ys)) = set ys
[PROOF STEP]
by (simp add: ran_distinct set_map[symmetric])


[STATEMENT]
lemma prod_list_partition: assumes "partition f xs = (ys, zs)"
  shows "prod_list xs = prod_list ys * prod_list zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list xs = prod_list ys * prod_list zs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
partition f xs = (ys, zs)

goal (1 subgoal):
 1. prod_list xs = prod_list ys * prod_list zs
[PROOF STEP]
by (subst prod_list_filter[symmetric, of f], auto simp: o_def)


[STATEMENT]
lemma linorder_rank_mono:
  assumes "linorder_on B R" "finite A" "A \<subseteq> B" "(x, y) \<in> R"
  shows   "linorder_rank R A x \<le> linorder_rank R A y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R A x \<le> linorder_rank R A y
[PROOF STEP]
unfolding linorder_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {y \<in> A - {x}. (y, x) \<in> R} \<le> card {ya \<in> A - {y}. (ya, y) \<in> R}
[PROOF STEP]
proof (rule card_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {ya \<in> A - {y}. (ya, y) \<in> R}
 2. {y \<in> A - {x}. (y, x) \<in> R} \<subseteq> {ya \<in> A - {y}. (ya, y) \<in> R}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
linorder_on B R
finite A
A \<subseteq> B
(x, y) \<in> R
[PROOF STEP]
have trans: "trans R" and antisym: "antisym R"
[PROOF STATE]
proof (prove)
using this:
linorder_on B R
finite A
A \<subseteq> B
(x, y) \<in> R

goal (1 subgoal):
 1. trans R &&& antisym R
[PROOF STEP]
by (simp_all add: linorder_on_def)
[PROOF STATE]
proof (state)
this:
trans R
antisym R

goal (2 subgoals):
 1. finite {ya \<in> A - {y}. (ya, y) \<in> R}
 2. {y \<in> A - {x}. (y, x) \<in> R} \<subseteq> {ya \<in> A - {y}. (ya, y) \<in> R}
[PROOF STEP]
from assms antisym
[PROOF STATE]
proof (chain)
picking this:
linorder_on B R
finite A
A \<subseteq> B
(x, y) \<in> R
antisym R
[PROOF STEP]
show "{y \<in> A - {x}. (y, x) \<in> R} \<subseteq> {ya \<in> A - {y}. (ya, y) \<in> R}"
[PROOF STATE]
proof (prove)
using this:
linorder_on B R
finite A
A \<subseteq> B
(x, y) \<in> R
antisym R

goal (1 subgoal):
 1. {y \<in> A - {x}. (y, x) \<in> R} \<subseteq> {ya \<in> A - {y}. (ya, y) \<in> R}
[PROOF STEP]
by (auto intro: transD[OF trans] simp: antisym_def)
[PROOF STATE]
proof (state)
this:
{y \<in> A - {x}. (y, x) \<in> R} \<subseteq> {ya \<in> A - {y}. (ya, y) \<in> R}

goal (1 subgoal):
 1. finite {ya \<in> A - {y}. (ya, y) \<in> R}
[PROOF STEP]
qed (insert assms, simp_all)


[STATEMENT]
lemma filter_states_simps[simp] :
  assumes "P (initial M)"
shows "initial (filter_states M P) = initial M"
      "states (filter_states M P) = Set.filter P (states M)"
      "inputs (filter_states M P) = inputs M"
      "outputs (filter_states M P) = outputs M"
      "transitions (filter_states M P) = {t \<in> transitions M . P (t_source t) \<and> P (t_target t)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (FSM.initial (FSM.filter_states M P) = FSM.initial M &&& FSM.states (FSM.filter_states M P) = Set.filter P (FSM.states M)) &&& FSM.inputs (FSM.filter_states M P) = FSM.inputs M &&& FSM.outputs (FSM.filter_states M P) = FSM.outputs M &&& FSM.transitions (FSM.filter_states M P) = {t \<in> FSM.transitions M. P (t_source t) \<and> P (t_target t)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P (FSM.initial M)

goal (1 subgoal):
 1. (FSM.initial (FSM.filter_states M P) = FSM.initial M &&& FSM.states (FSM.filter_states M P) = Set.filter P (FSM.states M)) &&& FSM.inputs (FSM.filter_states M P) = FSM.inputs M &&& FSM.outputs (FSM.filter_states M P) = FSM.outputs M &&& FSM.transitions (FSM.filter_states M P) = {t \<in> FSM.transitions M. P (t_source t) \<and> P (t_target t)}
[PROOF STEP]
by (transfer;auto)+


[STATEMENT]
lemma ring_hom_nat_pow:
  assumes "ring R"
  assumes "ring S"
  assumes "h \<in> ring_hom R S"
  assumes "a \<in> carrier R"
  shows "h (a[^]\<^bsub>R\<^esub>(n::nat)) = (h a)[^]\<^bsub>S\<^esub>(n::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (a [^]\<^bsub>R\<^esub> n) = h a [^]\<^bsub>S\<^esub> n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ring R
ring S
h \<in> ring_hom R S
a \<in> carrier R

goal (1 subgoal):
 1. h (a [^]\<^bsub>R\<^esub> n) = h a [^]\<^bsub>S\<^esub> n
[PROOF STEP]
by (simp add: ring_hom_ring.hom_nat_pow ring_hom_ringI2)


[STATEMENT]
lemma (in complete_lattice) is_dual_ccpo: "class.ccpo Inf (\<ge>) (>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.ccpo Inf (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>x y. (y < x) = (y \<le> x \<and> \<not> x \<le> y)
 2. \<And>x. x \<le> x
 3. \<And>x y z. \<lbrakk>y \<le> x; z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x
 4. \<And>x y. \<lbrakk>y \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x = y
 5. \<And>A x. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; x \<in> A\<rbrakk> \<Longrightarrow> Inf A \<le> x
 6. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (rule less_le_not_le)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x. x \<le> x
 2. \<And>x y z. \<lbrakk>y \<le> x; z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x
 3. \<And>x y. \<lbrakk>y \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x = y
 4. \<And>A x. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; x \<in> A\<rbrakk> \<Longrightarrow> Inf A \<le> x
 5. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (rule order_refl)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x y z. \<lbrakk>y \<le> x; z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x
 2. \<And>x y. \<lbrakk>y \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x = y
 3. \<And>A x. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; x \<in> A\<rbrakk> \<Longrightarrow> Inf A \<le> x
 4. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (erule (1) order_trans)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>y \<le> x; x \<le> y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>A x. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; x \<in> A\<rbrakk> \<Longrightarrow> Inf A \<le> x
 3. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (erule (1) order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A x. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; x \<in> A\<rbrakk> \<Longrightarrow> Inf A \<le> x
 2. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (erule Inf_lower)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A z. \<lbrakk>Complete_Partial_Order.chain (\<lambda>x y. y \<le> x) A; \<And>x. x \<in> A \<Longrightarrow> z \<le> x\<rbrakk> \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
apply (erule Inf_greatest)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma apply_matrix_add: "\<forall>x y. f (x+y) = (f x) + (f y) \<Longrightarrow> f 0 = (0::'a)
  \<Longrightarrow> apply_matrix f ((a::('a::monoid_add) matrix) + b) = (apply_matrix f a) + (apply_matrix f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. f (x + y) = f x + f y; f (0::'a) = (0::'a)\<rbrakk> \<Longrightarrow> apply_matrix f (a + b) = apply_matrix f a + apply_matrix f b
[PROOF STEP]
apply (subst Rep_matrix_inject[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. f (x + y) = f x + f y; f (0::'a) = (0::'a)\<rbrakk> \<Longrightarrow> Rep_matrix (apply_matrix f (a + b)) = Rep_matrix (apply_matrix f a + apply_matrix f b)
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>\<forall>x y. f (x + y) = f x + f y; f (0::'a) = (0::'a)\<rbrakk> \<Longrightarrow> Rep_matrix (apply_matrix f (a + b)) x xa = Rep_matrix (apply_matrix f a + apply_matrix f b) x xa
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mod_repr:
  fixes a b c :: nat
  shows "a mod b = c mod b \<longleftrightarrow> (\<exists>x y. c + x*b = a + y*b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a mod b = c mod b) = (\<exists>x y. c + x * b = a + y * b)
[PROOF STEP]
by (metis mult.commute nat_mod_eq_iff)


[STATEMENT]
lemma of_nat_qr_eq_of_nat_iff:
  "of_nat n = (of_nat m :: 'a :: qr_spec qr) \<longleftrightarrow>
    [n = m] (mod CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat n = of_nat m) = [n = m] (mod CARD('a))
[PROOF STEP]
using of_int_qr_eq_of_int_iff[of "int n" "int m"]
[PROOF STATE]
proof (prove)
using this:
(of_int (int n) = of_int (int m)) = [int n = int m] (mod int CARD(?'a))

goal (1 subgoal):
 1. (of_nat n = of_nat m) = [n = m] (mod CARD('a))
[PROOF STEP]
by (simp add: cong_int_iff)


[STATEMENT]
lemma enn2real_plus:"a < top \<Longrightarrow> b < top \<Longrightarrow> enn2real (a + b) = enn2real a + enn2real b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < top; b < top\<rbrakk> \<Longrightarrow> enn2real (a + b) = enn2real a + enn2real b
[PROOF STEP]
by (simp add: enn2real_def plus_ennreal.rep_eq real_of_ereal_add less_top
           del: real_of_ereal_enn2ereal)


[STATEMENT]
theorem fusion_lfp_eq:
  assumes monoH: "mono H" and monoG: "mono G"
  and distF: "dist_over_sup F"
  and fgh_comp: "\<And>x. ((F \<circ> G) x = (H \<circ> F) x)"
  shows "F (lfp G) = (lfp H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (lfp G) = lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F (lfp G) \<sqsubseteq> lfp H
 2. lfp H \<sqsubseteq> F (lfp G)
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
show "lfp H \<sqsubseteq> F (lfp G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfp H \<sqsubseteq> F (lfp G)
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (metis monoG fgh_comp eq_iff upper_galois_connections.u_simple_fusion)
[PROOF STATE]
proof (state)
this:
lfp (H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<sqsubseteq> (F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) (lfp (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice))

goal (1 subgoal):
 1. F (lfp G) \<sqsubseteq> lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F (lfp G) \<sqsubseteq> lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "\<And>x. (F \<circ> G) x \<sqsubseteq> (H \<circ> F) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x::'a. (F \<circ> G) x \<sqsubseteq> (H \<circ> F) x
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using fgh_comp
[PROOF STATE]
proof (prove)
using this:
((F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) (?x::'a::refinement_lattice) = ((H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> F) ?x

goal (1 subgoal):
 1. \<And>x::'a. (F \<circ> G) x \<sqsubseteq> (H \<circ> F) x
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) (?x::'a::refinement_lattice) \<sqsubseteq> ((H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> F) ?x

goal (1 subgoal):
 1. F (lfp G) \<sqsubseteq> lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) (?x::'a::refinement_lattice) \<sqsubseteq> ((H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> F) ?x
[PROOF STEP]
show "F (lfp G) \<sqsubseteq> (lfp H)"
[PROOF STATE]
proof (prove)
using this:
((F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) (?x::'a::refinement_lattice) \<sqsubseteq> ((H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> F) ?x

goal (1 subgoal):
 1. F (lfp G) \<sqsubseteq> lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using monoH distF fusion_lfp_leq
[PROOF STATE]
proof (prove)
using this:
((F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) (?x::'a::refinement_lattice) \<sqsubseteq> ((H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) \<circ> F) ?x
mono (H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)
dist_over_sup (F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)
\<lbrakk>mono (?H::?'a::refinement_lattice \<Rightarrow> ?'a::refinement_lattice); dist_over_sup (?F::?'a::refinement_lattice \<Rightarrow> ?'a::refinement_lattice); \<And>x::?'a::refinement_lattice. (?F \<circ> (?G::?'a::refinement_lattice \<Rightarrow> ?'a::refinement_lattice)) x \<sqsubseteq> (?H \<circ> ?F) x\<rbrakk> \<Longrightarrow> ?F (lfp ?G) \<sqsubseteq> lfp ?H

goal (1 subgoal):
 1. F (lfp G) \<sqsubseteq> lfp H
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(F::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice) (lfp (G::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)) \<sqsubseteq> lfp (H::'a::refinement_lattice \<Rightarrow> 'a::refinement_lattice)

goal:
No subgoals!
variables:
F, G, H :: 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
theorem induced_Left_Coset_commutes_with_composition [simp]:
  "\<lbrakk> a \<in> G; b \<in> G \<rbrakk> \<Longrightarrow> induced ((a \<cdot>| L) [\<cdot>] (b \<cdot>| L)) = induced (a \<cdot>| L) \<cdot>' induced (b \<cdot>| L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> G; b \<in> G\<rbrakk> \<Longrightarrow> induced (a \<cdot>| L [\<cdot>] (b \<cdot>| L)) = induced (a \<cdot>| L) \<cdot>' induced (b \<cdot>| L)
[PROOF STEP]
by (simp add: commutes_with_composition)


[STATEMENT]
lemma nonneg_mat_iff:
  "(X \<ge> (0 :: real ^ _ ^_)) \<longleftrightarrow> (\<forall>v. v \<ge> 0 \<longrightarrow> X *v v \<ge> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> X) = (\<forall>v\<ge>0. 0 \<le> X *v v)
[PROOF STEP]
using nonneg_mat_ge_zero nonneg_mult_imp_nonneg_mat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?Q; 0 \<le> ?v\<rbrakk> \<Longrightarrow> 0 \<le> ?Q *v ?v
(\<And>v. 0 \<le> v \<Longrightarrow> 0 \<le> ?X *v v) \<Longrightarrow> 0 \<le> ?X

goal (1 subgoal):
 1. (0 \<le> X) = (\<forall>v\<ge>0. 0 \<le> X *v v)
[PROOF STEP]
by auto


[STATEMENT]
theorem power_is_pr: "(\<lambda> (x::nat) (n::nat). x ^ n) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
define g :: "nat \<Rightarrow> nat" where "g x = 1" for x
[PROOF STATE]
proof (state)
this:
g ?x = 1

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
define h where "h a b c = a * b" for a b c :: nat
[PROOF STATE]
proof (state)
this:
h ?a ?b ?c = ?a * ?b

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
have g_is_pr: "g \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> PrimRec1
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 1) \<in> PrimRec1
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec1

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
have h_is_pr: "h \<in> PrimRec3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<in> PrimRec3
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a b c. a * b) \<in> PrimRec3
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec3

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
let ?f = "\<lambda> (x::nat) (n::nat). x ^ n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
have f_at_0: "\<forall> x. ?f x 0 = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x ^ 0 = g x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x ^ 0 = g x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x ^ 0 = g x
[PROOF STEP]
show "x ^ 0 = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ 0 = g x
[PROOF STEP]
by (simp add: g_def)
[PROOF STATE]
proof (state)
this:
x ^ 0 = g x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. x ^ 0 = g x

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
have f_at_Suc: "\<forall> x y. ?f x (Suc y) = h x (?f x y) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x ^ Suc y = h x (x ^ y) y
[PROOF STEP]
proof (rule allI, rule allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x ^ Suc y = h x (x ^ y) y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x ^ Suc y = h x (x ^ y) y
[PROOF STEP]
show "?f x (Suc y) = h x (?f x y) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ Suc y = h x (x ^ y) y
[PROOF STEP]
by (simp add: h_def)
[PROOF STATE]
proof (state)
this:
x ^ Suc y = h x (x ^ y) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x y. x ^ Suc y = h x (x ^ y) y

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
from g_is_pr h_is_pr f_at_0 f_at_Suc
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec1
h \<in> PrimRec3
\<forall>x. x ^ 0 = g x
\<forall>x y. x ^ Suc y = h x (x ^ y) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec1
h \<in> PrimRec3
\<forall>x. x ^ 0 = g x
\<forall>x y. x ^ Suc y = h x (x ^ y) y

goal (1 subgoal):
 1. (^) \<in> PrimRec2
[PROOF STEP]
by (rule pr_rec_last_scheme)
[PROOF STATE]
proof (state)
this:
(^) \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_hash_eq:
    assumes "distinct xs" "distinct ys" "set xs = set ys"
    shows "list_hash xs = list_hash ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
have "mset (remdups xs) = mset (remdups ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (remdups xs) = mset (remdups ys)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
set xs = set ys

goal (1 subgoal):
 1. mset (remdups xs) = mset (remdups ys)
[PROOF STEP]
using set_eq_iff_mset_remdups_eq
[PROOF STATE]
proof (prove)
using this:
set xs = set ys
(set ?x = set ?y) = (mset (remdups ?x) = mset (remdups ?y))

goal (1 subgoal):
 1. mset (remdups xs) = mset (remdups ys)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mset (remdups xs) = mset (remdups ys)

goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mset (remdups xs) = mset (remdups ys)
[PROOF STEP]
have "mset xs = mset ys"
[PROOF STATE]
proof (prove)
using this:
mset (remdups xs) = mset (remdups ys)

goal (1 subgoal):
 1. mset xs = mset ys
[PROOF STEP]
using assms(1, 2)
[PROOF STATE]
proof (prove)
using this:
mset (remdups xs) = mset (remdups ys)
distinct xs
distinct ys

goal (1 subgoal):
 1. mset xs = mset ys
[PROOF STEP]
by (simp add: distinct_remdups_id)
[PROOF STATE]
proof (state)
this:
mset xs = mset ys

goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
have "fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys
[PROOF STEP]
apply (rule fold_multiset_equiv)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> ((xor \<circ> hc) x \<circ>\<circ>\<circ> (\<circ>) xor) hc y = ((xor \<circ> hc) y \<circ>\<circ>\<circ> (\<circ>) xor) hc x
 2. mset xs = mset ys
[PROOF STEP]
apply (simp_all add: fun_eq_iff ac_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset xs = mset ys
[PROOF STEP]
using \<open>mset xs = mset ys\<close>
[PROOF STATE]
proof (prove)
using this:
mset xs = mset ys

goal (1 subgoal):
 1. mset xs = mset ys
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys

goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys

goal (1 subgoal):
 1. list_hash xs = list_hash ys
[PROOF STEP]
unfolding list_hash_def
[PROOF STATE]
proof (prove)
using this:
fold (xor \<circ> hc) xs = fold (xor \<circ> hc) ys

goal (1 subgoal):
 1. fold (xor \<circ> hc) xs 0 = fold (xor \<circ> hc) ys 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_hash xs = list_hash ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_all_edges:
  assumes "finite A"
  shows "card (all_edges A) = card A choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
have inj_on_mk_uedge: "inj_on mk_uedge {(a,b). a < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on mk_uedge {(a, b). a < b}
[PROOF STEP]
by (rule inj_onI) (auto simp: doubleton_eq_iff)
[PROOF STATE]
proof (state)
this:
inj_on mk_uedge {(a, b). a < b}

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
have "all_edges A = mk_uedge ` {(a,b). a \<in> A \<and> b \<in> A \<and> a < b}" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges A = mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}
[PROOF STEP]
by (auto simp: all_edges_def intro!: in_mk_uedge_img)
[PROOF STATE]
proof (state)
this:
all_edges A = mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
all_edges A = mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}
[PROOF STEP]
have "card ?L = card ?R"
[PROOF STATE]
proof (prove)
using this:
all_edges A = mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}

goal (1 subgoal):
 1. card (all_edges A) = card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (all_edges A) = card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b})

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (all_edges A) = card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b})

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
have "\<dots> = card {(a,b). a \<in> A \<and> b \<in> A \<and> a < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}) = card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}
[PROOF STEP]
using inj_on_mk_uedge
[PROOF STATE]
proof (prove)
using this:
inj_on mk_uedge {(a, b). a < b}

goal (1 subgoal):
 1. card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}) = card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}
[PROOF STEP]
by (blast intro: card_image subset_inj_on)
[PROOF STATE]
proof (state)
this:
card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}) = card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (mk_uedge ` {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}) = card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b}

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
have "\<dots> = (card A * (card A - 1)) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b} = card A * (card A - 1) div 2
[PROOF STEP]
using card_left_less_pair
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> card {(a, b). a \<in> ?A \<and> b \<in> ?A \<and> a < b} = card ?A * (card ?A - 1) div 2

goal (1 subgoal):
 1. card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b} = card A * (card A - 1) div 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> card {(a, b). a \<in> ?A \<and> b \<in> ?A \<and> a < b} = card ?A * (card ?A - 1) div 2
finite A

goal (1 subgoal):
 1. card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b} = card A * (card A - 1) div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b} = card A * (card A - 1) div 2

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {(a, b). a \<in> A \<and> b \<in> A \<and> a < b} = card A * (card A - 1) div 2

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
have "\<dots> = (card A choose 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A * (card A - 1) div 2 = card A choose 2
[PROOF STEP]
by (simp add: n_choose_2_nat)
[PROOF STATE]
proof (state)
this:
card A * (card A - 1) div 2 = card A choose 2

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (all_edges A) = card A choose 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (all_edges A) = card A choose 2

goal (1 subgoal):
 1. card (all_edges A) = card A choose 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (all_edges A) = card A choose 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_psubset_fset:
  shows "ys |\<subseteq>| xs \<Longrightarrow> card_fset ys < card_fset xs \<Longrightarrow> ys |\<subset>| xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ys |\<subseteq>| xs; card_fset ys < card_fset xs\<rbrakk> \<Longrightarrow> ys |\<subset>| xs
[PROOF STEP]
unfolding card_fset psubset_fset subset_fset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fset ys \<subseteq> fset xs; card (fset ys) < card (fset xs)\<rbrakk> \<Longrightarrow> fset ys \<subset> fset xs
[PROOF STEP]
by (rule card_psubset[OF finite_fset])


[STATEMENT]
lemma divisor_count_naive [code]:
  "divisor_count n = (if n = 0 then 0 else
     fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then Suc acc else acc) 1 n 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then Suc acc else acc) 1 n 0)
[PROOF STEP]
using divisor_sigma_naive[of "0 :: nat" n]
[PROOF STATE]
proof (prove)
using this:
divisor_sigma 0 n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then nat_power d 0 + acc else acc) 1 n 0)

goal (1 subgoal):
 1. divisor_count n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then Suc acc else acc) 1 n 0)
[PROOF STEP]
by (simp split: if_splits add: divisor_count_altdef cong: if_cong)


[STATEMENT]
lemma bin_UNIV_iff: "S = binUNIV \<longleftrightarrow> a \<in> S \<and> 1-a \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S = binUNIV) = (a \<in> S \<and> 1 - a \<in> S)
[PROOF STEP]
using two_in_bin_UNIV[OF bin_swap_neq']
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> ?S; 1 - ?a \<in> ?S\<rbrakk> \<Longrightarrow> ?S = binUNIV

goal (1 subgoal):
 1. (S = binUNIV) = (a \<in> S \<and> 1 - a \<in> S)
[PROOF STEP]
by blast


[STATEMENT]
lemma poly_of_pm_prod: "poly_of_pm x (prod f I) = (\<Prod>i\<in>I. poly_of_pm x (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (prod f I) = (\<Prod>i\<in>I. poly_of_pm x (f i))
[PROOF STEP]
by (induct I rule: infinite_finite_induct) (simp_all add: poly_of_pm_times)


[STATEMENT]
lemma inconsistent_eq_rank_less:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  shows "inconsistent A b = (rank A < (if (\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0)
                                            then (to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inconsistent A b = (rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0))
[PROOF STEP]
using inconsistent_imp_rank_less rank_less_imp_inconsistent
[PROOF STATE]
proof (prove)
using this:
inconsistent ?A ?b \<Longrightarrow> rank ?A < (if \<exists>a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a)) + 1 else 0)
rank ?A < (if \<exists>a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a)) + 1 else 0) \<Longrightarrow> inconsistent ?A ?b

goal (1 subgoal):
 1. inconsistent A b = (rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0))
[PROOF STEP]
by blast


[STATEMENT]
lemma (in prob_space) k_wise_indep_vars_compose:
  assumes "k_wise_indep_vars k M' X I"
  assumes "\<And>i. i \<in> I \<Longrightarrow> Y i \<in> measurable (M' i) (N i)"
  shows "k_wise_indep_vars k N (\<lambda>i x. Y i (X i x)) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k_wise_indep_vars k N (\<lambda>i x. Y i (X i x)) I
[PROOF STEP]
using indep_vars_compose2[where N="N" and X="X" and Y="Y" and M'="M'"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>indep_vars M' X ?I; \<And>i. i \<in> ?I \<Longrightarrow> Y i \<in> M' i \<rightarrow>\<^sub>M N i\<rbrakk> \<Longrightarrow> indep_vars N (\<lambda>i x. Y i (X i x)) ?I
k_wise_indep_vars k M' X I
?i11 \<in> I \<Longrightarrow> Y ?i11 \<in> M' ?i11 \<rightarrow>\<^sub>M N ?i11

goal (1 subgoal):
 1. k_wise_indep_vars k N (\<lambda>i x. Y i (X i x)) I
[PROOF STEP]
by (simp add: k_wise_indep_vars_def subsetD)


[STATEMENT]
lemma path_connected_linear_image:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
  assumes "path_connected S" "bounded_linear f"
    shows "path_connected(f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected (f ` S)
[PROOF STEP]
by (auto simp: linear_continuous_on assms path_connected_continuous_image)


[STATEMENT]
lemma Riemann_lebesgue_square_integrable:
  assumes "orthonormal_system S w" "\<And>i. w i square_integrable S" "f square_integrable S"
  shows "orthonormal_coeff S w f \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthonormal_coeff S w f \<longlonglongrightarrow> 0
[PROOF STEP]
using Fourier_series_square_summable [OF assms, of UNIV] summable_LIMSEQ_zero
[PROOF STATE]
proof (prove)
using this:
summable (confine (\<lambda>i. (orthonormal_coeff S w f i)\<^sup>2) UNIV)
summable ?f \<Longrightarrow> ?f \<longlonglongrightarrow> (0::?'a)

goal (1 subgoal):
 1. orthonormal_coeff S w f \<longlonglongrightarrow> 0
[PROOF STEP]
by force


[STATEMENT]
lemma numeral_powr_inverse_eq:
  "numeral x powr (inverse (numeral n)) = numeral x powr (1 / numeral n :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral x powr inverse (numeral n) = numeral x powr (1 / numeral n)
[PROOF STEP]
by simp


[STATEMENT]
lemma bij_betw_functions_of:
   assumes "finite A" "finite B"
  shows "bij_betw (functions_of A B) {N. number_partition (card A) N \<and> size N = card B} ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (Twelvefold_Way_Entry10.functions_of A B) {N. number_partition (card A) N \<and> size N = card B} ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B)
[PROOF STEP]
proof (rule bij_betw_byWitness[where f'="number_partition_of A B"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>a\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B. Twelvefold_Way_Entry10.functions_of A B (number_partition_of A B a') = a'
 3. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
have quotient_eq: "{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B = {F \<in> ((A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B). univ (\<lambda>f. f ` A = B) F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. f ` A = B) F}
[PROOF STEP]
using equiv_domain_and_range_permutation[of A B] surjective_respects_domain_and_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
equiv (A \<rightarrow>\<^sub>E B) (domain_and_range_permutation A B)
(\<lambda>f. f ` A = B) respects domain_and_range_permutation A B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. f ` A = B) F}
[PROOF STEP]
by (simp only: univ_preserves_predicate)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. f ` A = B) F}

goal (4 subgoals):
 1. \<forall>a\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B. Twelvefold_Way_Entry10.functions_of A B (number_partition_of A B a') = a'
 3. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
show "\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B.
       functions_of A B (number_partition_of A B F) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B. Twelvefold_Way_Entry10.functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B. Twelvefold_Way_Entry10.functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
by (auto simp only: quotient_eq functions_of_number_partition_of)
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B. Twelvefold_Way_Entry10.functions_of A B (number_partition_of A B F) = F

goal (3 subgoals):
 1. \<forall>a\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B a) = a
 2. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
 3. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
show "\<forall>N\<in>{N. number_partition (card A) N  \<and> size N = card B}. number_partition_of A B (functions_of A B N) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>N\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B N) = N
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. \<forall>N\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B N) = N
[PROOF STEP]
by (simp add: number_partition_of_functions_of)
[PROOF STATE]
proof (state)
this:
\<forall>N\<in>{N. number_partition (card A) N \<and> size N = card B}. number_partition_of A B (Twelvefold_Way_Entry10.functions_of A B N) = N

goal (2 subgoals):
 1. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
 2. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
show "number_partition_of A B ` ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B)
    \<subseteq> {N. number_partition (card A) N  \<and> size N = card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}
[PROOF STEP]
by (auto simp add: quotient_eq number_partition_of surj_on_implies_size_eq_card)
[PROOF STATE]
proof (state)
this:
number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B \<subseteq> {N. number_partition (card A) N \<and> size N = card B}

goal (1 subgoal):
 1. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
[PROOF STEP]
show "functions_of A B ` {N. number_partition (card A) N \<and> size N = card B}
    \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B
[PROOF STEP]
by (auto simp add: quotient_eq intro: functions_of functions_of_is_surj_on)
[PROOF STATE]
proof (state)
this:
Twelvefold_Way_Entry10.functions_of A B ` {N. number_partition (card A) N \<and> size N = card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_and_range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_le_iff': "x \<ge> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> sqrt x \<le> y \<longleftrightarrow> x \<le> y ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (sqrt x \<le> y) = (x \<le> y\<^sup>2)
[PROOF STEP]
using real_le_lsqrt sqrt_le_D
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?x; 0 \<le> ?y; ?x \<le> ?y\<^sup>2\<rbrakk> \<Longrightarrow> sqrt ?x \<le> ?y
sqrt ?x \<le> ?y \<Longrightarrow> ?x \<le> ?y\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (sqrt x \<le> y) = (x \<le> y\<^sup>2)
[PROOF STEP]
by blast


[STATEMENT]
lemma arr_Rel_converse_Rel_eq_iff[dg_Rel_cs_simps]:
  assumes "arr_Rel \<alpha> F" and "arr_Rel \<alpha> G"
  shows "F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l \<longleftrightarrow> F = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l) = (F = G)
[PROOF STEP]
proof(rule iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l \<Longrightarrow> F = G
 2. F = G \<Longrightarrow> F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l
[PROOF STEP]
show "F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l \<Longrightarrow> F = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l \<Longrightarrow> F = G
[PROOF STEP]
by (metis arr_Rel.arr_Rel_converse_Rel_converse_Rel assms)
[PROOF STATE]
proof (state)
this:
F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l \<Longrightarrow> F = G

goal (1 subgoal):
 1. F = G \<Longrightarrow> F\<inverse>\<^sub>R\<^sub>e\<^sub>l = G\<inverse>\<^sub>R\<^sub>e\<^sub>l
[PROOF STEP]
qed simp


[STATEMENT]
lemma violations_ge_0:
  shows
    "(if postrecording_event t i
     then card {j \<in> {i+1..<length t}. prerecording_event t j}
     else 0) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (if postrecording_event t i then card {j \<in> {i + 1..<length t}. prerecording_event t j} else 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma elements_with_ord_1: "n > 0 \<Longrightarrow> {x\<in>totatives n. ord n x = Suc 0} = {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> {x \<in> totatives n. ord n x = Suc 0} = {1}
[PROOF STEP]
by (auto simp: ord_eq_Suc_0_iff cong_def totatives_less)


[STATEMENT]
lemma product_two_squares_aux: "sum2sq_int(a, b) * sum2sq_int(c, d) = sum2sq_int(a*c - b*d, a*d + b*c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum2sq_int (a, b) * sum2sq_int (c, d) = sum2sq_int (a * c - b * d, a * d + b * c)
[PROOF STEP]
unfolding power2_eq_square sum2sq_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (a, b) of (a, b) \<Rightarrow> a * a + b * b) * (case (c, d) of (a, b) \<Rightarrow> a * a + b * b) = (case (a * c - b * d, a * d + b * c) of (a, b) \<Rightarrow> a * a + b * b)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
theorem wls_freshEnv_swapEnv_compose:
assumes "wlsEnv rho" and "freshEnv xs y rho" and "freshEnv xs z rho"
shows "((rho &[y \<and> x]_xs) &[z \<and> y]_xs) = (rho &[z \<and> x]_xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[y \<and> x]_xs &[z \<and> y]_xs = rho &[z \<and> x]_xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
freshEnv xs y rho
freshEnv xs z rho

goal (1 subgoal):
 1. rho &[y \<and> x]_xs &[z \<and> y]_xs = rho &[z \<and> x]_xs
[PROOF STEP]
by (intro freshEnv_swapEnv_compose) auto


[STATEMENT]
theorem summable_complex_powr_iff:
  assumes "Re s < -1"
  shows   "summable (\<lambda>n. exp (of_real (ln (of_nat n)) * s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. exp (complex_of_real (ln (real n)) * s))
[PROOF STEP]
by (rule summable_norm_cancel, subst abs_summable_complex_powr_iff) fact


[STATEMENT]
lemma div_3253:
  fixes a b c d m:: int and l :: nat
  defines "M \<equiv> mat a b c d"
  assumes "mat_21 M mod m = 0"
  shows "((mat_11 (mat_pow l M)) - a^l) mod m = 0" (is "?P l")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_11 (mat_pow l M) - a ^ l) mod m = 0
[PROOF STEP]
proof(induction l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (mat_11 (mat_pow 0 M) - a ^ 0) mod m = 0
 2. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
show "?P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_11 (mat_pow 0 M) - a ^ 0) mod m = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(mat_11 (mat_pow 0 M) - a ^ 0) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
fix l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
assume IH: "?P l"
[PROOF STATE]
proof (state)
this:
(mat_11 (mat_pow l M) - a ^ l) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
define Ml where "Ml = mat_pow l M"
[PROOF STATE]
proof (state)
this:
Ml = mat_pow l M

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from Ml_def
[PROOF STATE]
proof (chain)
picking this:
Ml = mat_pow l M
[PROOF STEP]
have S1: "mat_pow (Suc(l)) M = mat_mul M Ml"
[PROOF STATE]
proof (prove)
using this:
Ml = mat_pow l M

goal (1 subgoal):
 1. mat_pow (Suc l) M = mat_mul M Ml
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_pow (Suc l) M = mat_mul M Ml

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
have S2: "mat_11 (mat_mul M Ml) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_11 (mat_mul M Ml) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
[PROOF STEP]
by (rule_tac mat_mul.induct mat_plus.induct, auto)
[PROOF STATE]
proof (state)
this:
mat_11 (mat_mul M Ml) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
hence S3: "mat_11 (mat_pow (Suc(l)) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml"
[PROOF STATE]
proof (prove)
using this:
mat_11 (mat_mul M Ml) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml

goal (1 subgoal):
 1. mat_11 (mat_pow (Suc l) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
[PROOF STEP]
using S1
[PROOF STATE]
proof (prove)
using this:
mat_11 (mat_mul M Ml) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
mat_pow (Suc l) M = mat_mul M Ml

goal (1 subgoal):
 1. mat_11 (mat_pow (Suc l) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_11 (mat_pow (Suc l) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from M_def Ml_def assms(2) div_3252
[PROOF STATE]
proof (chain)
picking this:
M \<equiv> mat a b c d
Ml = mat_pow l M
mat_21 M mod m = 0
mat_21 (mat ?a ?b ?c ?d) mod ?m = 0 \<Longrightarrow> mat_21 (mat_pow ?l (mat ?a ?b ?c ?d)) mod ?m = 0
[PROOF STEP]
have S4: "mat_21 Ml mod m = 0"
[PROOF STATE]
proof (prove)
using this:
M \<equiv> mat a b c d
Ml = mat_pow l M
mat_21 M mod m = 0
mat_21 (mat ?a ?b ?c ?d) mod ?m = 0 \<Longrightarrow> mat_21 (mat_pow ?l (mat ?a ?b ?c ?d)) mod ?m = 0

goal (1 subgoal):
 1. mat_21 Ml mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_21 Ml mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from IH Ml_def
[PROOF STATE]
proof (chain)
picking this:
(mat_11 (mat_pow l M) - a ^ l) mod m = 0
Ml = mat_pow l M
[PROOF STEP]
have S5: "(mat_11 Ml - a ^ l) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
(mat_11 (mat_pow l M) - a ^ l) mod m = 0
Ml = mat_pow l M

goal (1 subgoal):
 1. (mat_11 Ml - a ^ l) mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_11 Ml - a ^ l) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from IH M_def
[PROOF STATE]
proof (chain)
picking this:
(mat_11 (mat_pow l M) - a ^ l) mod m = 0
M \<equiv> mat a b c d
[PROOF STEP]
have S6: "(mat_11 M -a) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
(mat_11 (mat_pow l M) - a ^ l) mod m = 0
M \<equiv> mat a b c d

goal (1 subgoal):
 1. (mat_11 M - a) mod m = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(mat_11 M - a) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from S4
[PROOF STATE]
proof (chain)
picking this:
mat_21 Ml mod m = 0
[PROOF STEP]
have S7: "(mat_12 M * mat_21 Ml) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
mat_21 Ml mod m = 0

goal (1 subgoal):
 1. mat_12 M * mat_21 Ml mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_12 M * mat_21 Ml mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from S5 S6
[PROOF STATE]
proof (chain)
picking this:
(mat_11 Ml - a ^ l) mod m = 0
(mat_11 M - a) mod m = 0
[PROOF STEP]
have S8: "(mat_11 M * mat_11 Ml- a^(Suc(l))) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
(mat_11 Ml - a ^ l) mod m = 0
(mat_11 M - a) mod m = 0

goal (1 subgoal):
 1. (mat_11 M * mat_11 Ml - a ^ Suc l) mod m = 0
[PROOF STEP]
by (metis M_def mat2.sel(1) mod_0 mod_mult_right_eq mult_zero_right power_Suc right_diff_distrib)
[PROOF STATE]
proof (state)
this:
(mat_11 M * mat_11 Ml - a ^ Suc l) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
have S9: "(mat_11 M * mat_11 Ml - a^(Suc(l)) + mat_12 M * mat_21 Ml ) mod m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_11 M * mat_11 Ml - a ^ Suc l + mat_12 M * mat_21 Ml) mod m = 0
[PROOF STEP]
using S7 S8
[PROOF STATE]
proof (prove)
using this:
mat_12 M * mat_21 Ml mod m = 0
(mat_11 M * mat_11 Ml - a ^ Suc l) mod m = 0

goal (1 subgoal):
 1. (mat_11 M * mat_11 Ml - a ^ Suc l + mat_12 M * mat_21 Ml) mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_11 M * mat_11 Ml - a ^ Suc l + mat_12 M * mat_21 Ml) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from S9
[PROOF STATE]
proof (chain)
picking this:
(mat_11 M * mat_11 Ml - a ^ Suc l + mat_12 M * mat_21 Ml) mod m = 0
[PROOF STEP]
have S10: "(mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml - a^(Suc(l))) mod m = 0"
[PROOF STATE]
proof (prove)
using this:
(mat_11 M * mat_11 Ml - a ^ Suc l + mat_12 M * mat_21 Ml) mod m = 0

goal (1 subgoal):
 1. (mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml - a ^ Suc l) mod m = 0
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
(mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml - a ^ Suc l) mod m = 0

goal (1 subgoal):
 1. \<And>l. (mat_11 (mat_pow l M) - a ^ l) mod m = 0 \<Longrightarrow> (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
from S3 S10
[PROOF STATE]
proof (chain)
picking this:
mat_11 (mat_pow (Suc l) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
(mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml - a ^ Suc l) mod m = 0
[PROOF STEP]
show "?P (Suc(l))"
[PROOF STATE]
proof (prove)
using this:
mat_11 (mat_pow (Suc l) M) = mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml
(mat_11 M * mat_11 Ml + mat_12 M * mat_21 Ml - a ^ Suc l) mod m = 0

goal (1 subgoal):
 1. (mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_11 (mat_pow (Suc l) M) - a ^ Suc l) mod m = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vimage_VLambda_vrange: "(\<lambda>a\<in>\<^sub>\<circ>A. f a) `\<^sub>\<circ> B = \<R>\<^sub>\<circ> (\<lambda>a\<in>\<^sub>\<circ>A \<inter>\<^sub>\<circ> B. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VLambda A f `\<^sub>\<circ> B = \<R>\<^sub>\<circ> (VLambda (A \<inter>\<^sub>\<circ> B) f)
[PROOF STEP]
unfolding vimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>\<langle>r, A\<rangle>\<in>\<^sub>\<circ>set {\<langle>VLambda A f, B\<rangle>}. \<R>\<^sub>\<circ> (r \<restriction>\<^sup>l\<^sub>\<circ> A))\<lparr>\<langle>VLambda A f, B\<rangle>\<rparr> = \<R>\<^sub>\<circ> (VLambda (A \<inter>\<^sub>\<circ> B) f)
[PROOF STEP]
by (simp add: vlrestriction_VLambda)


[STATEMENT]
lemma poly_pos_greater:
  "(\<forall>x. x > a \<longrightarrow> poly p x > 0) \<longleftrightarrow> (
       p \<noteq> 0 \<and> poly_inf p = 1 \<and> count_roots_above p a = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x>a. 0 < poly p x) = (p \<noteq> 0 \<and> poly_inf p = 1 \<and> count_roots_above p a = 0)
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x>a. 0 < poly p x) = (p \<noteq> 0 \<and> poly_inf p = 1 \<and> count_roots_above p a = 0)
[PROOF STEP]
by (subst poly_pos_greater, subst poly_no_roots_greater, force)


[STATEMENT]
theorem ta_prod_correct:
  assumes TA: "tree_automaton TA1" "tree_automaton TA2"
  shows
    "ta_lang (ta_prod TA1 TA2) = ta_lang TA1 \<inter> ta_lang TA2"
    "tree_automaton (ta_prod TA1 TA2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (ta_prod TA1 TA2) = ta_lang TA1 \<inter> ta_lang TA2 &&& tree_automaton (ta_prod TA1 TA2)
[PROOF STEP]
using ta_prod_correct_aux1
        ta_prod_correct_aux2[OF TA]
[PROOF STATE]
proof (prove)
using this:
ta_lang (ta_prod ?TA1.0 ?TA2.0) = ta_lang ?TA1.0 \<inter> ta_lang ?TA2.0
tree_automaton (ta_prod TA1 TA2)

goal (1 subgoal):
 1. ta_lang (ta_prod TA1 TA2) = ta_lang TA1 \<inter> ta_lang TA2 &&& tree_automaton (ta_prod TA1 TA2)
[PROOF STEP]
by auto


[STATEMENT]
lemma floor_eq_iff: "\<lfloor>x\<rfloor> = a \<longleftrightarrow> of_int a \<le> x \<and> x < of_int a + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> = a) = (of_int a \<le> x \<and> x < of_int a + (1::'a))
[PROOF STEP]
using floor_correct floor_unique
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>?x\<rfloor> \<le> ?x \<and> ?x < of_int (\<lfloor>?x\<rfloor> + 1)
\<lbrakk>of_int ?z \<le> ?x; ?x < of_int ?z + (1::?'a)\<rbrakk> \<Longrightarrow> \<lfloor>?x\<rfloor> = ?z

goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> = a) = (of_int a \<le> x \<and> x < of_int a + (1::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma Re_power2: "Re (x ^ 2) = (Re x)^2 - (Im x)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (x\<^sup>2) = (Re x)\<^sup>2 - (Im x)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma aHom_compos_assoc:"\<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L;
      g \<in> aHom L M; h \<in> aHom M N \<rbrakk>  \<Longrightarrow>
      compos K h (compos K g f) = compos K (compos L h g) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> compos K h (compos K g f) = compos K (compos L h g) f
[PROOF STEP]
apply (simp add:compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier K. h (if x \<in> carrier K then g (f x) else undefined)) = (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined)
[PROOF STEP]
apply (rule funcset_eq[of _ "carrier K"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier K. h (if x \<in> carrier K then g (f x) else undefined)) \<in> extensional (carrier K)
 2. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined) \<in> extensional (carrier K)
 3. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier K. (\<lambda>x\<in>carrier K. h (if x \<in> carrier K then g (f x) else undefined)) x = (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined) x
[PROOF STEP]
apply (simp add:restrict_def extensional_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined) \<in> extensional (carrier K)
 2. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier K. (\<lambda>x\<in>carrier K. h (if x \<in> carrier K then g (f x) else undefined)) x = (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined) x
[PROOF STEP]
apply (simp add:restrict_def extensional_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier K. (\<lambda>x\<in>carrier K. h (if x \<in> carrier K then g (f x) else undefined)) x = (\<lambda>x\<in>carrier K. if f x \<in> carrier L then h (g (f x)) else undefined) x
[PROOF STEP]
apply (rule ballI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>aGroup K; aGroup L; aGroup M; aGroup N; f \<in> aHom K L; g \<in> aHom L M; h \<in> aHom M N; x \<in> carrier K\<rbrakk> \<Longrightarrow> f x \<notin> carrier L \<longrightarrow> h (g (f x)) = undefined
[PROOF STEP]
apply (simp add:aHom_mem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Least_True [simp]:
  "(LEAST (n::nat). True) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. True) = 0
[PROOF STEP]
by (auto simp: Least_def)


[STATEMENT]
lemma of_nat_primes_omega_primorial [simp]: "real (primes_omega (primorial x)) = primes_pi x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (primes_omega (primorial x)) = primes_pi x
[PROOF STEP]
by (simp add: primes_omega_def primes_pi_def prime_sum_upto_def)


[STATEMENT]
lemma zip_takeWhile_snd: "zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. zip [] (takeWhile P ys) = takeWhile (P \<circ> snd) (zip [] ys)
 2. \<And>a xs ys. (\<And>ys. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)) \<Longrightarrow> zip (a # xs) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a # xs) ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. zip [] (takeWhile P ys) = takeWhile (P \<circ> snd) (zip [] ys)
 2. \<And>a xs ys. (\<And>ys. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)) \<Longrightarrow> zip (a # xs) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip [] (takeWhile P ys) = takeWhile (P \<circ> snd) (zip [] ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
zip [] (takeWhile P ys) = takeWhile (P \<circ> snd) (zip [] ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)) \<Longrightarrow> zip (a # xs) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a # xs) ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)) \<Longrightarrow> zip (a # xs) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a # xs) ys)
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
zip xs_ (takeWhile P ?ys) = takeWhile (P \<circ> snd) (zip xs_ ?ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. zip xs (takeWhile P ys) = takeWhile (P \<circ> snd) (zip xs ys)) \<Longrightarrow> zip (a # xs) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a # xs) ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
zip xs_ (takeWhile P ?ys) = takeWhile (P \<circ> snd) (zip xs_ ?ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
zip xs_ (takeWhile P ?ys) = takeWhile (P \<circ> snd) (zip xs_ ?ys)

goal (1 subgoal):
 1. zip (a_ # xs_) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a_ # xs_) ys)
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
zip (a_ # xs_) (takeWhile P ys) = takeWhile (P \<circ> snd) (zip (a_ # xs_) ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_vector_mult_code [code abstract]:
  "vec_nth (A *v x) = (%i. (\<Sum>j\<in>UNIV. A $ i $ j * x $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (A *v x) = (\<lambda>i. \<Sum>j\<in>UNIV. A $ i $ j * x $ j)
[PROOF STEP]
unfolding matrix_vector_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i. \<Sum>j\<in>UNIV. A $ i $ j * x $ j) = (\<lambda>i. \<Sum>j\<in>UNIV. A $ i $ j * x $ j)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma mat_times_vec_eqI[intro]:
  assumes "dim_col A\<^sup>T = dim_vec x"
  assumes "dim_row A\<^sup>T = dim_vec c"
  assumes "\<And>i. i < dim_vec c \<Longrightarrow> (A\<^sup>T *\<^sub>v x)$i = c$i"
  shows "[x \<^sub>v* A]=c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x\<^sub>v*A]=c
[PROOF STEP]
unfolding vec_times_mat_eq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<dim_vec c. (A\<^sup>T *\<^sub>v x) $ i = c $ i) \<and> dim_col A\<^sup>T = dim_vec x \<and> dim_row A\<^sup>T = dim_vec c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_col A\<^sup>T = dim_vec x
dim_row A\<^sup>T = dim_vec c
?i < dim_vec c \<Longrightarrow> (A\<^sup>T *\<^sub>v x) $ ?i = c $ ?i

goal (1 subgoal):
 1. (\<forall>i<dim_vec c. (A\<^sup>T *\<^sub>v x) $ i = c $ i) \<and> dim_col A\<^sup>T = dim_vec x \<and> dim_row A\<^sup>T = dim_vec c
[PROOF STEP]
by blast