[STATEMENT]
theorem (in conservative) disjoint_sets_measure_Cesaro_tendsto_zero:
  fixes P::"'a measure" and A::"nat \<Rightarrow> 'a set"
  assumes [measurable]: "\<And>n. A n \<in> sets M"
      and "disjoint_family A"
          "absolutely_continuous M P" "sets P = sets M"
          "emeasure P (space M) \<noteq> \<infinity>"
  shows "(\<lambda>n. (\<Sum>i<n. measure P (space M \<inter> (T^^i)-`(A i)))/n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have "space P = space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space P = space M
[PROOF STEP]
using assms(4) sets_eq_imp_space_eq
[PROOF STATE]
proof (prove)
using this:
sets P = sets M
sets ?M = sets ?M' \<Longrightarrow> space ?M = space ?M'

goal (1 subgoal):
 1. space P = space M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
space P = space M

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
space P = space M

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have "emeasure P Q \<le> emeasure P (space P)" for Q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure P Q \<le> emeasure P (space P)
[PROOF STEP]
by (simp add: emeasure_space)
[PROOF STATE]
proof (state)
this:
emeasure P ?Q3 \<le> emeasure P (space P)

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
space P = space M
emeasure P ?Q3 \<le> emeasure P (space P)
[PROOF STEP]
have [simp]: "emeasure P Q \<noteq> \<top>" for Q
[PROOF STATE]
proof (prove)
using this:
space P = space M
emeasure P ?Q3 \<le> emeasure P (space P)

goal (1 subgoal):
 1. emeasure P Q \<noteq> \<top>
[PROOF STEP]
using \<open>emeasure P (space M) \<noteq> \<infinity>\<close> neq_top_trans
[PROOF STATE]
proof (prove)
using this:
space P = space M
emeasure P ?Q3 \<le> emeasure P (space P)
emeasure P (space M) \<noteq> \<infinity>
\<lbrakk>?y \<noteq> \<top>; ?x \<le> ?y\<rbrakk> \<Longrightarrow> ?x \<noteq> \<top>

goal (1 subgoal):
 1. emeasure P Q \<noteq> \<top>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
emeasure P ?Q3 \<noteq> \<top>

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have *: "ennreal ((\<Sum>i<n. measure P (space M \<inter> (T^^i)-`(A i)))/n) = (\<Sum>i<n. emeasure P (space M \<inter> (T^^i)-`(A i)))/n" if "n > 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
apply (subst divide_ennreal[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 \<le> (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i))
 2. 0 < real n
 3. ennreal (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / ennreal (real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
apply (auto intro!: sum_nonneg that simp add: ennreal_of_nat_eq_real_of_nat[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
apply(subst sum_ennreal[symmetric], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. ennreal (Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i))) / of_nat n = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
apply (subst emeasure_eq_ennreal_measure)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. emeasure P (space M \<inter> (T ^^ i) -` A i) \<noteq> \<top>
 2. (\<Sum>i<n. ennreal (Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i))) / of_nat n = (\<Sum>i<n. ennreal (Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i))) / of_nat n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < ?n3 \<Longrightarrow> ennreal ((\<Sum>i<?n3. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real ?n3) = (\<Sum>i<?n3. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat ?n3

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
have "eventually (\<lambda>n. ennreal ((\<Sum>i<n. measure P (space M \<inter> (T^^i)-`(A i)))/n) = (\<Sum>i<n. emeasure P (space M \<inter> (T^^i)-`(A i)))/n) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
apply (rule exI[of _ 1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>1. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 < ?n3 \<Longrightarrow> ennreal ((\<Sum>i<?n3. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real ?n3) = (\<Sum>i<?n3. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat ?n3

goal (1 subgoal):
 1. \<forall>n\<ge>1. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
[PROOF STEP]
have *: "(\<lambda>n. ennreal ((\<Sum>i<n. measure P (space M \<inter> (T^^i)-`(A i)))/n)) \<longlonglongrightarrow> ennreal 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n

goal (1 subgoal):
 1. (\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> ennreal 0
[PROOF STEP]
using disjoint_sets_emeasure_Cesaro_tendsto_zero[OF assms] tendsto_cong
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) = (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n
(\<lambda>n. (\<Sum>i<n. emeasure P (space M \<inter> (T ^^ i) -` A i)) / of_nat n) \<longlonglongrightarrow> 0
\<forall>\<^sub>F x in ?F. ?f x = ?g x \<Longrightarrow> (?f \<longlongrightarrow> ?c) ?F = (?g \<longlongrightarrow> ?c) ?F

goal (1 subgoal):
 1. (\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> ennreal 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> ennreal 0

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (subst tendsto_ennreal_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>\<^sub>F x in sequentially. 0 \<le> (\<Sum>i<x. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real x
 2. 0 \<le> 0
 3. (\<lambda>x. ennreal ((\<Sum>i<x. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real x)) \<longlonglongrightarrow> ennreal 0
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> ennreal 0

goal (3 subgoals):
 1. \<forall>\<^sub>F x in sequentially. 0 \<le> (\<Sum>i<x. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real x
 2. 0 \<le> 0
 3. (\<lambda>x. ennreal ((\<Sum>i<x. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real x)) \<longlonglongrightarrow> ennreal 0
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. 0 \<le> (\<Sum>i<x. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real x
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> 0 \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. 0 \<le> (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n
[PROOF STEP]
apply (rule exI[of _ 1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ennreal ((\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n)) \<longlonglongrightarrow> 0 \<Longrightarrow> \<forall>n\<ge>1. 0 \<le> (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n
[PROOF STEP]
by (auto simp add: divide_simps intro!: sum_nonneg)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Sum>i<n. Sigma_Algebra.measure P (space M \<inter> (T ^^ i) -` A i)) / real n) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_by_eta:
  "Max_by f = (\<lambda>S. (SOME x. x \<in> S \<and> f x = Max (f ` S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_by f = (\<lambda>S. SOME x. x \<in> S \<and> f x = Max (f ` S))
[PROOF STEP]
by(auto simp add: Max_by_def)


[STATEMENT]
lemma wf_graph_remove_edges_union:
    "wf_graph \<lparr> nodes = V, edges = E \<union> E' \<rparr> \<Longrightarrow> wf_graph \<lparr> nodes = V, edges=E\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_graph \<lparr>nodes = V, edges = E \<union> E'\<rparr> \<Longrightarrow> wf_graph \<lparr>nodes = V, edges = E\<rparr>
[PROOF STEP]
by(auto simp add: wf_graph_def)


[STATEMENT]
lemma bounds_compare_Some [simp]:
  "x \<le>\<^sub>u\<^sub>b Some c \<longleftrightarrow> x \<le> c" "x \<ge>\<^sub>u\<^sub>b Some c \<longleftrightarrow> x \<ge> c"
  "x <\<^sub>u\<^sub>b Some c \<longleftrightarrow> x < c" "x >\<^sub>u\<^sub>b Some c \<longleftrightarrow> x > c"
  "x \<ge>\<^sub>l\<^sub>b Some c \<longleftrightarrow> x \<ge> c" "x \<le>\<^sub>l\<^sub>b Some c \<longleftrightarrow> x \<le> c"
  "x >\<^sub>l\<^sub>b Some c \<longleftrightarrow> x > c" "x <\<^sub>l\<^sub>b Some c \<longleftrightarrow> x < c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x \<le>\<^sub>u\<^sub>b Some c = (x \<le> c) &&& x \<ge>\<^sub>u\<^sub>b Some c = (c \<le> x)) &&& x <\<^sub>u\<^sub>b Some c = (x < c) &&& x >\<^sub>u\<^sub>b Some c = (c < x)) &&& (x \<ge>\<^sub>l\<^sub>b Some c = (c \<le> x) &&& x \<le>\<^sub>l\<^sub>b Some c = (x \<le> c)) &&& x >\<^sub>l\<^sub>b Some c = (c < x) &&& x <\<^sub>l\<^sub>b Some c = (x < c)
[PROOF STEP]
by (auto simp add: bound_compare_defs)


[STATEMENT]
lemma disjoint_iff_in_not_in2: "(A \<inter> B = {}) = (\<forall>x\<in>B. x \<notin> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<inter> B = {}) = (\<forall>x\<in>B. x \<notin> A)
[PROOF STEP]
by blast


[STATEMENT]
lemma localSS'_aux_b: "((\<lambda>(x, u, v) ab. u = 0 \<and> (case ab of (y, u', v') \<Rightarrow> u' = Suc 0 \<and> v = v')) OO (\<lambda>(x, u, v) (y, u', v'). u = u'))
    = (\<lambda> (x, u, v) (y, u', v') . u = 0 \<and> u' = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, u, v) ab. u = (0::'b) \<and> (case ab of (y, u', v') \<Rightarrow> u' = Suc 0 \<and> v = v')) OO (\<lambda>(x, u, v) (y, u', v'). u = u') = (\<lambda>(x, u, v) (y, u', v'). u = (0::'b) \<and> u' = 1)
[PROOF STEP]
by (simp add: fun_eq_iff relcompp_exists)


[STATEMENT]
lemma E_ss: "E \<subseteq> {0..<N}\<times>{0..<N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E \<subseteq> {0..<N} \<times> {0..<N}
[PROOF STEP]
using E_ss_VxV V_ss
[PROOF STATE]
proof (prove)
using this:
E \<subseteq> V \<times> V
V \<subseteq> {0..<N}

goal (1 subgoal):
 1. E \<subseteq> {0..<N} \<times> {0..<N}
[PROOF STEP]
by auto


[STATEMENT]
lemma f_Exec_Stream_expand_aggregate_map_nth_eq_i_nth: "
  \<lbrakk> 0 < k; n < n' \<rbrakk> \<Longrightarrow>
  f_aggregate (map f (f_Exec_Comp_Stream trans_fun (input \<Down> n' \<odot>\<^sub>f k) c)) k ag ! n =
  i_aggregate (f \<circ> (i_Exec_Comp_Stream trans_fun (input \<odot>\<^sub>i k) c)) k ag n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < n'\<rbrakk> \<Longrightarrow> f_aggregate (map f (f_Exec_Comp_Stream trans_fun (input \<Down> n' \<odot> k) c)) k ag ! n = i_aggregate (f \<circ> i_Exec_Comp_Stream trans_fun (input \<odot> k) c) k ag n
[PROOF STEP]
apply (simp add: f_aggregate_nth i_aggregate_nth f_Exec_Stream_take f_Exec_Stream_drop i_Exec_Stream_take i_Exec_Stream_drop drop_map take_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < n'\<rbrakk> \<Longrightarrow> ag (map f (f_Exec_Comp_Stream trans_fun (input \<Down> n' \<odot> k \<up> (n * k) \<down> k) (f_Exec_Comp trans_fun (input \<Down> n' \<odot> k \<down> (n * k)) c))) = ag (map f (f_Exec_Comp_Stream trans_fun (input \<odot> k \<Up> (n * k) \<Down> k) (f_Exec_Comp trans_fun (input \<odot> k \<Down> (n * k)) c)))
[PROOF STEP]
apply (simp add: f_expand_take_mod i_expand_i_take_mod f_expand_drop_mod i_expand_i_drop_mod i_drop_i_take_1 drop_take_1 min_eqR)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_poly_degree_less:
  assumes "f (lead_coeff p) =0" "degree p\<noteq>0"
  shows "degree (map_poly f p) < degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "length (coeffs p) >1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length (coeffs p)
[PROOF STEP]
using \<open>degree p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
degree p \<noteq> 0

goal (1 subgoal):
 1. 1 < length (coeffs p)
[PROOF STEP]
by (simp add: degree_eq_length_coeffs)
[PROOF STATE]
proof (state)
this:
1 < length (coeffs p)

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < length (coeffs p)
[PROOF STEP]
obtain xs x where xs_def:"coeffs p=xs@[x]" "length xs>0"
[PROOF STATE]
proof (prove)
using this:
1 < length (coeffs p)

goal (1 subgoal):
 1. (\<And>xs x. \<lbrakk>coeffs p = xs @ [x]; 0 < length xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis One_nat_def add.commute add_diff_cancel_left' append_Nil assms(2)
        degree_eq_length_coeffs length_greater_0_conv list.size(3) list.size(4) not_less_zero
        rev_exhaust)
[PROOF STATE]
proof (state)
this:
coeffs p = xs @ [x]
0 < length xs

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "f x=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = (0::'a)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
f (lead_coeff p) = (0::'a)

goal (1 subgoal):
 1. f x = (0::'a)
[PROOF STEP]
by (simp add: lead_coeff_list_def xs_def(1))
[PROOF STATE]
proof (state)
this:
f x = (0::'a)

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "degree (map_poly f p) = length (strip_while ((=) 0) (map f (xs@[x]))) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (map_poly f p) = length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1
[PROOF STEP]
unfolding map_poly_def degree_eq_length_coeffs coeffs_Poly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (strip_while ((=) (0::'a)) (map f (coeffs p))) - 1 = length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1
[PROOF STEP]
by (subst xs_def,auto)
[PROOF STATE]
proof (state)
this:
degree (map_poly f p) = length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (map_poly f p) = length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "... = length (strip_while ((=) 0) (map f xs)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1 = length (strip_while ((=) (0::'a)) (map f xs)) - 1
[PROOF STEP]
using \<open>f x=0\<close>
[PROOF STATE]
proof (prove)
using this:
f x = (0::'a)

goal (1 subgoal):
 1. length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1 = length (strip_while ((=) (0::'a)) (map f xs)) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1 = length (strip_while ((=) (0::'a)) (map f xs)) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (strip_while ((=) (0::'a)) (map f (xs @ [x]))) - 1 = length (strip_while ((=) (0::'a)) (map f xs)) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "... \<le> length xs -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (strip_while ((=) (0::'a)) (map f xs)) - 1 \<le> length xs - 1
[PROOF STEP]
using length_strip_while_le
[PROOF STATE]
proof (prove)
using this:
length (strip_while ?P ?xs) \<le> length ?xs

goal (1 subgoal):
 1. length (strip_while ((=) (0::'a)) (map f xs)) - 1 \<le> length xs - 1
[PROOF STEP]
by (metis diff_le_mono length_map)
[PROOF STATE]
proof (state)
this:
length (strip_while ((=) (0::'a)) (map f xs)) - 1 \<le> length xs - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (strip_while ((=) (0::'a)) (map f xs)) - 1 \<le> length xs - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "... < length (xs@[x]) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs - 1 < length (xs @ [x]) - 1
[PROOF STEP]
using xs_def(2)
[PROOF STATE]
proof (prove)
using this:
0 < length xs

goal (1 subgoal):
 1. length xs - 1 < length (xs @ [x]) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs - 1 < length (xs @ [x]) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length xs - 1 < length (xs @ [x]) - 1

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
have "... = degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (xs @ [x]) - 1 = degree p
[PROOF STEP]
unfolding degree_eq_length_coeffs xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (xs @ [x]) - 1 = length (xs @ [x]) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (xs @ [x]) - 1 = degree p

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (map_poly f p) < degree p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (map_poly f p) < degree p

goal (1 subgoal):
 1. degree (map_poly f p) < degree p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
degree (map_poly f p) < degree p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chaos_skip: "chaos \<sqsubseteq> skip"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
(* 46 *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
have "chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)
variables:
(\<iinter>), (\<parallel>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)

goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)
[PROOF STEP]
have "\<dots> \<sqsubseteq> (chaos \<iinter> skip) \<parallel> (skip \<iinter> chaos)"
[PROOF STATE]
proof (prove)
using this:
chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)

goal (1 subgoal):
 1. (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos) \<sqsubseteq> chaos \<iinter> skip \<parallel> skip \<iinter> chaos
variables:
chaos, skip :: 'a
(\<iinter>), (\<parallel>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using parallel_interchange
[PROOF STATE]
proof (prove)
using this:
chaos = (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos)
((?c\<^sub>0::'a::refinement_lattice) \<parallel> (?c\<^sub>1::'a::refinement_lattice)) \<iinter> ((?d\<^sub>0::'a::refinement_lattice) \<parallel> (?d\<^sub>1::'a::refinement_lattice)) \<sqsubseteq> ?c\<^sub>0 \<iinter> ?d\<^sub>0 \<parallel> ?c\<^sub>1 \<iinter> ?d\<^sub>1

goal (1 subgoal):
 1. (chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos) \<sqsubseteq> chaos \<iinter> skip \<parallel> skip \<iinter> chaos
variables:
chaos, skip :: 'a
(\<iinter>), (\<parallel>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos) \<sqsubseteq> chaos \<iinter> skip \<parallel> skip \<iinter> chaos

goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(chaos \<parallel> skip) \<iinter> (skip \<parallel> chaos) \<sqsubseteq> chaos \<iinter> skip \<parallel> skip \<iinter> chaos

goal (1 subgoal):
 1. chaos \<sqsubseteq> skip
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
chaos \<sqsubseteq> skip

goal:
No subgoals!
variables:
chaos, skip :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma mem_permute_iff:
  shows "(p \<bullet> x) \<in> (p \<bullet> X) \<longleftrightarrow> x \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<bullet> x \<in> p \<bullet> X) = (x \<in> X)
[PROOF STEP]
unfolding permute_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<bullet> x \<in> {p \<bullet> x |x. x \<in> X}) = (x \<in> X)
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_le_1[simp]:
assumes *: "proper c" and **: "i < brn c"
shows "sum (wt c s) {..i} \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (wt c s) {..i} \<le> 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (wt c s) {..i} \<le> 1
[PROOF STEP]
have "{..i} \<subseteq> {..< brn c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..i} \<subseteq> {..<brn c}
[PROOF STEP]
using **
[PROOF STATE]
proof (prove)
using this:
i < brn c

goal (1 subgoal):
 1. {..i} \<subseteq> {..<brn c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..i} \<subseteq> {..<brn c}

goal (1 subgoal):
 1. sum (wt c s) {..i} \<le> 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{..i} \<subseteq> {..<brn c}

goal (1 subgoal):
 1. sum (wt c s) {..i} \<le> 1
[PROOF STEP]
using assms sum_subset_le_1[of c "{..i}" s]
[PROOF STATE]
proof (prove)
using this:
{..i} \<subseteq> {..<brn c}
proper c
i < brn c
\<lbrakk>proper c; {..i} \<subseteq> {..<brn c}\<rbrakk> \<Longrightarrow> sum (wt c s) {..i} \<le> 1

goal (1 subgoal):
 1. sum (wt c s) {..i} \<le> 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum (wt c s) {..i} \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma horner_eval'_interval:
  fixes x::"'a::linordered_ring"
  assumes "\<And>i. i < n \<Longrightarrow> f i \<in> set_of (g i)"
  assumes "x \<in>\<^sub>i I" "v \<in>\<^sub>i V"
  shows "horner_eval' f x v n \<in>\<^sub>i horner_eval' g I V n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. horner_eval' f x v n \<in>\<^sub>i horner_eval' g I V n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> f ?i \<in>\<^sub>i g ?i
x \<in>\<^sub>i I
v \<in>\<^sub>i V

goal (1 subgoal):
 1. horner_eval' f x v n \<in>\<^sub>i horner_eval' g I V n
[PROOF STEP]
by (induction n arbitrary: v V) (auto intro!: plus_in_intervalI times_in_intervalI)


[STATEMENT]
lemma funpower_consume_function:
  assumes law: "\<And> X. P X \<Longrightarrow> f (g X) = h (f X) \<and> P (g X)"
  shows "P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P I \<Longrightarrow> P (funpower g 0 I) \<and> f (funpower g 0 I) = funpower h 0 (f I)
 2. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
P I

goal (2 subgoals):
 1. P I \<Longrightarrow> P (funpower g 0 I) \<and> f (funpower g 0 I) = funpower h 0 (f I)
 2. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P I
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P I

goal (1 subgoal):
 1. P (funpower g 0 I) \<and> f (funpower g 0 I) = funpower h 0 (f I)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (funpower g 0 I) \<and> f (funpower g 0 I) = funpower h 0 (f I)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I)
P I

goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I)
P I
[PROOF STEP]
have S1: "P (funpower g n I)" and S2: "f (funpower g n I) = funpower h n (f I)"
[PROOF STATE]
proof (prove)
using this:
P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I)
P I

goal (1 subgoal):
 1. P (funpower g n I) &&& f (funpower g n I) = funpower h n (f I)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P (funpower g n I)
f (funpower g n I) = funpower h n (f I)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
have law1: "\<And> X. P X \<Longrightarrow> f (g X) = h (f X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X. P X \<Longrightarrow> f (g X) = h (f X)
[PROOF STEP]
using law
[PROOF STATE]
proof (prove)
using this:
P ?X \<Longrightarrow> f (g ?X) = h (f ?X) \<and> P (g ?X)

goal (1 subgoal):
 1. \<And>X. P X \<Longrightarrow> f (g X) = h (f X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P ?X \<Longrightarrow> f (g ?X) = h (f ?X)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
have law2: "\<And> X. P X \<Longrightarrow> P (g X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X. P X \<Longrightarrow> P (g X)
[PROOF STEP]
using law
[PROOF STATE]
proof (prove)
using this:
P ?X \<Longrightarrow> f (g ?X) = h (f ?X) \<and> P (g ?X)

goal (1 subgoal):
 1. \<And>X. P X \<Longrightarrow> P (g X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P ?X \<Longrightarrow> P (g ?X)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>P I \<Longrightarrow> P (funpower g n I) \<and> f (funpower g n I) = funpower h n (f I); P I\<rbrakk> \<Longrightarrow> P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (g (funpower g n I)) \<and> f (g (funpower g n I)) = h (funpower h n (f I))
[PROOF STEP]
apply (subst law1[where X="funpower g n I"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. P (funpower g n I)
 2. P (g (funpower g n I)) \<and> h (f (funpower g n I)) = h (funpower h n (f I))
[PROOF STEP]
apply (simp add: S1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (g (funpower g n I)) \<and> h (f (funpower g n I)) = h (funpower h n (f I))
[PROOF STEP]
apply (subst S2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (g (funpower g n I)) \<and> h (funpower h n (f I)) = h (funpower h n (f I))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (g (funpower g n I))
[PROOF STEP]
apply (rule law2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (funpower g n I)
[PROOF STEP]
apply (simp add: S1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
P (funpower g (Suc n) I) \<and> f (funpower g (Suc n) I) = funpower h (Suc n) (f I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_merge_length:
  "T_merge ts\<^sub>1 ts\<^sub>2 + length (merge ts\<^sub>1 ts\<^sub>2) \<le> 2 * (length ts\<^sub>1 + length ts\<^sub>2) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_merge ts\<^sub>1 ts\<^sub>2 + length (merge ts\<^sub>1 ts\<^sub>2) \<le> 2 * (length ts\<^sub>1 + length ts\<^sub>2) + 1
[PROOF STEP]
by (induction ts\<^sub>1 ts\<^sub>2 rule: T_merge.induct)
   (auto simp: T_ins_tree_length algebra_simps)


[STATEMENT]
lemma "ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None#xs \<Longrightarrow>
      xs = map Some (dropWhile (\<lambda>x. x=0) [a,b,c,d,e,f,g,h])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
[PROOF STEP]
apply(case_tac "a=0",case_tac [!] "b=0",case_tac [!] "c=0",case_tac [!] "d=0",
          case_tac [!] "e=0",case_tac [!] "f=0",case_tac [!] "g=0",case_tac [!] "h=0")
[PROOF STATE]
proof (prove)
goal (256 subgoals):
 1. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g = 0; h = 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 2. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g = 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 3. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g \<noteq> 0; h = 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 4. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; g \<noteq> 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 5. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f \<noteq> 0; g = 0; h = 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 6. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f \<noteq> 0; g = 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 7. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f \<noteq> 0; g \<noteq> 0; h = 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 8. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e = 0; f \<noteq> 0; g \<noteq> 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 9. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e \<noteq> 0; f = 0; g = 0; h = 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
 10. \<lbrakk>ipv6_preferred_to_compressed (IPv6AddrPreferred a b c d e f g h) = None # xs; a = 0; b = 0; c = 0; d = 0; e \<noteq> 0; f = 0; g = 0; h \<noteq> 0\<rbrakk> \<Longrightarrow> xs = map Some (dropWhile (\<lambda>x. x = 0) [a, b, c, d, e, f, g, h])
A total of 256 subgoals...
[PROOF STEP]
by(simp_all add: ipv6_preferred_to_compressed_pull_out_if max_zero_streak_def)


[STATEMENT]
lemma listsum_update:
  fixes xs :: "'a::ring list"
  assumes "i < length xs"
  shows "list_sum (xs[i := v]) = list_sum xs - xs ! i + v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_sum (xs[i := v]) = list_sum xs - xs ! i + v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < length xs

goal (1 subgoal):
 1. list_sum (xs[i := v]) = list_sum xs - xs ! i + v
[PROOF STEP]
proof (induct xs arbitrary: i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> list_sum ([][i := v]) = list_sum [] - [] ! i + v
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs)\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
i < length []

goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> list_sum ([][i := v]) = list_sum [] - [] ! i + v
 2. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs)\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i < length []

goal (1 subgoal):
 1. list_sum ([][i := v]) = list_sum [] - [] ! i + v
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
list_sum ([][i := v]) = list_sum [] - [] ! i + v

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs)\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs)\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
?i < length xs \<Longrightarrow> list_sum (xs[?i := v]) = list_sum xs - xs ! ?i + v
i < length (a # xs)

goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs)\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < length xs \<Longrightarrow> list_sum (xs[?i := v]) = list_sum xs - xs ! ?i + v
i < length (a # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?i < length xs \<Longrightarrow> list_sum (xs[?i := v]) = list_sum xs - xs ! ?i + v
i < length (a # xs)

goal (1 subgoal):
 1. list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = 0\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
 2. \<And>nat. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = Suc nat\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = 0\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
 2. \<And>nat. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = Suc nat\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = Suc nat\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = Suc nat\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
case (Suc i')
[PROOF STATE]
proof (state)
this:
i = Suc i'

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>\<And>i. i < length xs \<Longrightarrow> list_sum (xs[i := v]) = list_sum xs - xs ! i + v; i < length (a # xs); i = Suc nat\<rbrakk> \<Longrightarrow> list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
?i < length xs \<Longrightarrow> list_sum (xs[?i := v]) = list_sum xs - xs ! ?i + v
i < length (a # xs)
i = Suc i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < length xs \<Longrightarrow> list_sum (xs[?i := v]) = list_sum xs - xs ! ?i + v
i < length (a # xs)
i = Suc i'

goal (1 subgoal):
 1. list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list_sum ((a # xs)[i := v]) = list_sum (a # xs) - (a # xs) ! i + v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bl2nat_append:
  "bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
proof(induct "length xs" arbitrary: xs ys, simp add: bl2nat.simps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
fix x xs ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
assume ind:
    "\<And>xs ys. x = length xs \<Longrightarrow>
             bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)"
    and h: "Suc x = length (xs::cell list)"
[PROOF STATE]
proof (state)
this:
x = length ?xs \<Longrightarrow> bl2nat (?xs @ ?ys) 0 = bl2nat ?xs 0 + bl2nat ?ys (length ?xs)
Suc x = length xs

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
have "\<exists> ks k. xs = ks @ [k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ks k. xs = ks @ [k]
[PROOF STEP]
apply(rule_tac x = "butlast xs" in exI,
        rule_tac x = "last xs" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = butlast xs @ [last xs]
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
Suc x = length xs

goal (1 subgoal):
 1. xs = butlast xs @ [last xs]
[PROOF STEP]
apply(cases xs, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>ks k. xs = ks @ [k]

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>ks k. xs = ks @ [k]
[PROOF STEP]
obtain ks k where "xs = ks @ [k]"
[PROOF STATE]
proof (prove)
using this:
\<exists>ks k. xs = ks @ [k]

goal (1 subgoal):
 1. (\<And>ks k. xs = ks @ [k] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
xs = ks @ [k]

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs = ks @ [k]

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
hence
    "bl2nat (ks @ (k # ys)) 0 = bl2nat ks 0 +
                               bl2nat (k # ys) (length ks)"
[PROOF STATE]
proof (prove)
using this:
xs = ks @ [k]

goal (1 subgoal):
 1. bl2nat (ks @ k # ys) 0 = bl2nat ks 0 + bl2nat (k # ys) (length ks)
[PROOF STEP]
apply(rule_tac ind)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = ks @ [k] \<Longrightarrow> x = length ks
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
Suc x = length xs

goal (1 subgoal):
 1. xs = ks @ [k] \<Longrightarrow> x = length ks
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bl2nat (ks @ k # ys) 0 = bl2nat ks 0 + bl2nat (k # ys) (length ks)

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. x = length xs \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs); Suc x = length xs\<rbrakk> \<Longrightarrow> bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs = ks @ [k]
bl2nat (ks @ k # ys) 0 = bl2nat ks 0 + bl2nat (k # ys) (length ks)
[PROOF STEP]
show "bl2nat (xs @ ys) 0 =
                  bl2nat xs 0 + bl2nat ys (length xs)"
[PROOF STATE]
proof (prove)
using this:
xs = ks @ [k]
bl2nat (ks @ k # ys) 0 = bl2nat ks 0 + bl2nat (k # ys) (length ks)

goal (1 subgoal):
 1. bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)
[PROOF STEP]
apply(cases k, simp_all add: bl2nat.simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>bl2nat (ks @ Bk # ys) 0 = bl2nat ks 0 + bl2nat ys (Suc (length ks)); k = Bk; xs = ks @ [Bk]\<rbrakk> \<Longrightarrow> bl2nat ks 0 = bl2nat (ks @ [Bk]) 0
 2. \<lbrakk>bl2nat (ks @ Oc # ys) 0 = bl2nat ks 0 + (2 ^ length ks + bl2nat ys (Suc (length ks))); k = Oc; xs = ks @ [Oc]\<rbrakk> \<Longrightarrow> bl2nat ks 0 + 2 ^ length ks = bl2nat (ks @ [Oc]) 0
[PROOF STEP]
apply(simp_all only: bl2nat_cons_bk bl2nat_cons_oc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
bl2nat (xs @ ys) 0 = bl2nat xs 0 + bl2nat ys (length xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_replicate1: "zip (replicate n x) ys = map (Pair x) (take n ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip (replicate n x) ys = map (Pair x) (take n ys)
[PROOF STEP]
by(induction ys arbitrary: n)(case_tac [2] n, simp_all)


[STATEMENT]
lemma rel_nabla_coinduct: "P \<subseteq> relfdia X P \<union> rdom Q \<Longrightarrow> P \<subseteq> rel_nabla X \<union> relfdia (rtrancl X) Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<subseteq> relfdia X P \<union> rdom Q \<Longrightarrow> P \<subseteq> rel_nabla X \<union> relfdia (X\<^sup>*) Q
[PROOF STEP]
by (meson nabla_fusion2 order_trans rel_nabla_bin_coinduct)


[STATEMENT]
lemma fps_to_fls_Abs_fps:
  "fps_to_fls (Abs_fps F) = Abs_fls (\<lambda>n. if n<0 then 0 else F (nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_to_fls (Abs_fps F) = Abs_fls (\<lambda>n. if n < 0 then 0::'a else F (nat n))
[PROOF STEP]
using nth_Abs_fls_lower_bound[of 0 "(\<lambda>n::int. if n<0 then 0 else F (nat n))"]
[PROOF STATE]
proof (prove)
using this:
\<forall>n<0. (if n < 0 then 0::'a else F (nat n)) = (0::'a) \<Longrightarrow> Abs_fls (\<lambda>n. if n < 0 then 0::'a else F (nat n)) $$ ?n = (if ?n < 0 then 0::'a else F (nat ?n))

goal (1 subgoal):
 1. fps_to_fls (Abs_fps F) = Abs_fls (\<lambda>n. if n < 0 then 0::'a else F (nat n))
[PROOF STEP]
by    (intro fls_eqI) simp


[STATEMENT]
lemma is_interval_cball_1[intro, simp]: "is_interval (cball a b)" for a b::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval (cball a b)
[PROOF STEP]
by (simp add: cball_eq_atLeastAtMost is_interval_def)


[STATEMENT]
lemma euclidean_size_lcm_less1:
  assumes "b \<noteq> 0" and "\<not> b dvd a"
  shows "euclidean_size a < euclidean_size (lcm a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclidean_size a < euclidean_size (lcm a b)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
\<not> b dvd a
[PROOF STEP]
have "a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
\<not> b dvd a

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

goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>euclidean_size a < euclidean_size (lcm a b)"
[PROOF STATE]
proof (state)
this:
\<not> euclidean_size a < euclidean_size (lcm a b)

goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
with \<open>a \<noteq> 0\<close> and \<open>b \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
b \<noteq> (0::'a)
\<not> euclidean_size a < euclidean_size (lcm a b)
[PROOF STEP]
have "euclidean_size (lcm a b) = euclidean_size a"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)
b \<noteq> (0::'a)
\<not> euclidean_size a < euclidean_size (lcm a b)

goal (1 subgoal):
 1. euclidean_size (lcm a b) = euclidean_size a
[PROOF STEP]
by (intro le_antisym, simp, intro euclidean_size_lcm_le1)
[PROOF STATE]
proof (state)
this:
euclidean_size (lcm a b) = euclidean_size a

goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> (0::'a)
\<not> b dvd a
euclidean_size (lcm a b) = euclidean_size a
[PROOF STEP]
have "lcm a b dvd a"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
\<not> b dvd a
euclidean_size (lcm a b) = euclidean_size a

goal (1 subgoal):
 1. lcm a b dvd a
[PROOF STEP]
by (rule_tac dvd_euclidean_size_eq_imp_dvd) (auto simp: lcm_eq_0_iff)
[PROOF STATE]
proof (state)
this:
lcm a b dvd a

goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
hence "b dvd a"
[PROOF STATE]
proof (prove)
using this:
lcm a b dvd a

goal (1 subgoal):
 1. b dvd a
[PROOF STEP]
by (rule lcm_dvdD2)
[PROOF STATE]
proof (state)
this:
b dvd a

goal (1 subgoal):
 1. \<not> euclidean_size a < euclidean_size (lcm a b) \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not>b dvd a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> b dvd a
b dvd a
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> b dvd a
b dvd a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma psi_l_dim:
  "psi_l l \<in> carrier_vec N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psi_l l \<in> carrier_vec N
[PROOF STEP]
unfolding psi_l_def \<alpha>_def \<beta>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alpha_l l \<cdot>\<^sub>v Matrix.vec N (\<lambda>x. complex_of_real (if f x then 0 else 1 / sqrt (real (N - M)))) + beta_l l \<cdot>\<^sub>v Matrix.vec N (\<lambda>x. complex_of_real (if f x then 1 / sqrt (real M) else 0)) \<in> carrier_vec N
[PROOF STEP]
by auto


[STATEMENT]
lemma fmrel_on_fsetD: "x |\<in>| S \<Longrightarrow> fmrel_on_fset S P m n \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x |\<in>| S; fmrel_on_fset S P m n\<rbrakk> \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)
[PROOF STEP]
unfolding fmrel_on_fset_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x |\<in>| S; fBall S (\<lambda>x. rel_option P (fmlookup m x) (fmlookup n x))\<rbrakk> \<Longrightarrow> rel_option P (fmlookup m x) (fmlookup n x)
[PROOF STEP]
by auto


[STATEMENT]
lemma scf_anonymous_neutral':
  assumes perm: "\<sigma> permutes alts" and wf: "is_pref_profile R1" "is_pref_profile R2"
  assumes eq: "anonymous_profile R1 =
                 image_mset (map (\<lambda>A. \<sigma> ` A)) (anonymous_profile R2)"
  shows   "\<sigma> x \<in> scf R1 \<longleftrightarrow> x \<in> scf R2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
have "scf R1 = \<sigma> ` scf R2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scf R1 = \<sigma> ` scf R2
[PROOF STEP]
by (intro scf_anonymous_neutral) fact+
[PROOF STATE]
proof (state)
this:
scf R1 = \<sigma> ` scf R2

goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
scf R1 = \<sigma> ` scf R2

goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
have "\<sigma> x \<in> \<dots> \<longleftrightarrow> x \<in> scf R2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<sigma> x \<in> \<sigma> ` scf R2) = (x \<in> scf R2)
[PROOF STEP]
by (blast dest: injD[OF permutes_inj[OF perm]])
[PROOF STATE]
proof (state)
this:
(\<sigma> x \<in> \<sigma> ` scf R2) = (x \<in> scf R2)

goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<sigma> x \<in> scf R1) = (x \<in> scf R2)

goal (1 subgoal):
 1. (\<sigma> x \<in> scf R1) = (x \<in> scf R2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<sigma> x \<in> scf R1) = (x \<in> scf R2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_component:
  "f absolutely_integrable_on A \<Longrightarrow> (\<lambda>x. f x \<bullet> (b :: 'b :: euclidean_space)) absolutely_integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f absolutely_integrable_on A \<Longrightarrow> (\<lambda>x. f x \<bullet> b) absolutely_integrable_on A
[PROOF STEP]
by (drule absolutely_integrable_linear[OF _ bounded_linear_inner_left[of b]]) (simp add: o_def)


[STATEMENT]
lemma step_eps_closure_set_idem: "step_eps_closure_set (step_eps_closure_set R bs) bs =
  step_eps_closure_set R bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. step_eps_closure_set (step_eps_closure_set R bs) bs = step_eps_closure_set R bs
[PROOF STEP]
unfolding step_eps_closure_set_def step_eps_closure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>q\<in>\<Union>q\<in>R. Collect ((step_eps bs)\<^sup>*\<^sup>* q). Collect ((step_eps bs)\<^sup>*\<^sup>* q)) = (\<Union>q\<in>R. Collect ((step_eps bs)\<^sup>*\<^sup>* q))
[PROOF STEP]
by auto


[STATEMENT]
lemma last_index_le_size: "last_index xs x <= size xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_index xs x \<le> length xs
[PROOF STEP]
by(simp add: last_index_def Let_def index_le_size)


[STATEMENT]
lemma timpl_closure_set_mono:
  assumes "M \<subseteq> M'" "TI \<subseteq> TI'"
  shows "timpl_closure_set M TI \<subseteq> timpl_closure_set M' TI'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. timpl_closure_set M TI \<subseteq> timpl_closure_set M' TI'
[PROOF STEP]
using assms(1) timpl_closure_mono[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
M \<subseteq> M'
timpl_closure ?t TI \<subseteq> timpl_closure ?t TI'

goal (1 subgoal):
 1. timpl_closure_set M TI \<subseteq> timpl_closure_set M' TI'
[PROOF STEP]
unfolding timpl_closure_set_def
[PROOF STATE]
proof (prove)
using this:
M \<subseteq> M'
timpl_closure ?t TI \<subseteq> timpl_closure ?t TI'

goal (1 subgoal):
 1. (\<Union>t\<in>M. timpl_closure t TI) \<subseteq> (\<Union>t\<in>M'. timpl_closure t TI')
[PROOF STEP]
by fast


[STATEMENT]
lemma fps_mult_left_inverse_unit_factor:
  fixes   f :: "'a::ring_1 fps"
  assumes "x * f $ subdegree f = 1"
  shows   "fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f
[PROOF STEP]
have
    "fps_left_inverse (unit_factor f) x * f =
      fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f
[PROOF STEP]
using fps_unit_factor_decompose[of f]
[PROOF STATE]
proof (prove)
using this:
f = unit_factor f * fps_X ^ subdegree f

goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f
[PROOF STEP]
by (simp add: mult.assoc)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (unit_factor f) x * f = fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f

goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x * f $ subdegree f = (1::'a)
fps_left_inverse (unit_factor f) x * f = fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * f $ subdegree f = (1::'a)
fps_left_inverse (unit_factor f) x * f = fps_left_inverse (unit_factor f) x * unit_factor f * fps_X ^ subdegree f

goal (1 subgoal):
 1. fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f
[PROOF STEP]
by (simp add: fps_left_inverse)
[PROOF STATE]
proof (state)
this:
fps_left_inverse (unit_factor f) x * f = fps_X ^ subdegree f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmax_ex_gr: "fBex X (\<lambda>x. k < x) \<Longrightarrow> X \<noteq> {||} \<Longrightarrow> k < fMax X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fBex X ((<) k); X \<noteq> {||}\<rbrakk> \<Longrightarrow> k < fMax X
[PROOF STEP]
by transfer (rule max_ex_gr)


[STATEMENT]
lemma Carmichael_dvd_mono_coprime:
  assumes "coprime m n" "m > 1" "n > 1"
  shows   "Carmichael m dvd Carmichael (m * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael m dvd Carmichael (m * n)
[PROOF STEP]
unfolding Carmichael_def[of m]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm (ord m ` totatives m) dvd Carmichael (m * n)
[PROOF STEP]
proof (intro Lcm_least, safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
assume x: "x \<in> totatives m"
[PROOF STATE]
proof (state)
this:
x \<in> totatives m

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
coprime m n
1 < m
1 < n
[PROOF STEP]
have "totatives n \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
coprime m n
1 < m
1 < n

goal (1 subgoal):
 1. totatives n \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
totatives n \<noteq> {}

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
totatives n \<noteq> {}
[PROOF STEP]
obtain y where y: "y \<in> totatives n"
[PROOF STATE]
proof (prove)
using this:
totatives n \<noteq> {}

goal (1 subgoal):
 1. (\<And>y. y \<in> totatives n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> totatives n

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
from binary_chinese_remainder_nat[OF assms(1), of x y]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xa. [xa = x] (mod m) \<and> [xa = y] (mod n)
[PROOF STEP]
obtain z where z: "[z = x] (mod m)" "[z = y] (mod n)"
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. [xa = x] (mod m) \<and> [xa = y] (mod n)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>[z = x] (mod m); [z = y] (mod n)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[z = x] (mod m)
[z = y] (mod n)

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
have z': "coprime z n" "coprime z m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime z n &&& coprime z m
[PROOF STEP]
by (rule cong_imp_coprime; use x y z in \<open>force simp: totatives_def cong_sym_eq\<close>)+
[PROOF STATE]
proof (state)
this:
coprime z n
coprime z m

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
from z
[PROOF STATE]
proof (chain)
picking this:
[z = x] (mod m)
[z = y] (mod n)
[PROOF STEP]
have "ord m x = ord m z"
[PROOF STATE]
proof (prove)
using this:
[z = x] (mod m)
[z = y] (mod n)

goal (1 subgoal):
 1. ord m x = ord m z
[PROOF STEP]
by (intro ord_cong) (auto simp: cong_sym_eq)
[PROOF STATE]
proof (state)
this:
ord m x = ord m z

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ord m x = ord m z

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
have "ord m z dvd ord (m * n) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord m z dvd ord (m * n) z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
coprime m n
1 < m
1 < n

goal (1 subgoal):
 1. ord m z dvd ord (m * n) z
[PROOF STEP]
by (auto simp: ord_modulus_mult_coprime)
[PROOF STATE]
proof (state)
this:
ord m z dvd ord (m * n) z

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ord m z dvd ord (m * n) z

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
from z' assms
[PROOF STATE]
proof (chain)
picking this:
coprime z n
coprime z m
coprime m n
1 < m
1 < n
[PROOF STEP]
have "\<dots> dvd Carmichael (m * n)"
[PROOF STATE]
proof (prove)
using this:
coprime z n
coprime z m
coprime m n
1 < m
1 < n

goal (1 subgoal):
 1. ord (m * n) z dvd Carmichael (m * n)
[PROOF STEP]
by (intro ord_dvd_Carmichael) (auto simp: coprime_commute intro!:one_less_mult)
[PROOF STATE]
proof (state)
this:
ord (m * n) z dvd Carmichael (m * n)

goal (1 subgoal):
 1. \<And>b x. x \<in> totatives m \<Longrightarrow> ord m x dvd Carmichael (m * n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ord m x dvd Carmichael (m * n)
[PROOF STEP]
show "ord m x dvd Carmichael (m * n)"
[PROOF STATE]
proof (prove)
using this:
ord m x dvd Carmichael (m * n)

goal (1 subgoal):
 1. ord m x dvd Carmichael (m * n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ord m x dvd Carmichael (m * n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma E_ss: "E \<subseteq> {0..<N}\<times>{0..<N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E \<subseteq> {0..<N} \<times> {0..<N}
[PROOF STEP]
using E_ss_VxV V_ss
[PROOF STATE]
proof (prove)
using this:
E \<subseteq> V \<times> V
V \<subseteq> {0..<N}

goal (1 subgoal):
 1. E \<subseteq> {0..<N} \<times> {0..<N}
[PROOF STEP]
by auto


[STATEMENT]
lemma pdouble_closed:
  "on_curvep a b p \<Longrightarrow> on_curvep a b (pdouble a p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. on_curvep a b p \<Longrightarrow> on_curvep a b (pdouble a p)
[PROOF STEP]
by (simp add: on_curvep_iff_on_curve pdouble_correct add_closed)


[STATEMENT]
lemma mult_matrix_nm:
  assumes "ncols A <= n" "nrows B <= n" "ncols A <= m" "nrows B <= m" "fadd 0 0 = 0" "fmul 0 0 = 0"
  shows "mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
ncols A \<le> n
nrows B \<le> n
ncols A \<le> m
nrows B \<le> m
fadd (0::'c) (0::'c) = (0::'c)
fmul (0::'a) (0::'b) = (0::'c)
[PROOF STEP]
have "mult_matrix_n n fmul fadd A B = mult_matrix fmul fadd A B"
[PROOF STATE]
proof (prove)
using this:
ncols A \<le> n
nrows B \<le> n
ncols A \<le> m
nrows B \<le> m
fadd (0::'c) (0::'c) = (0::'c)
fmul (0::'a) (0::'b) = (0::'c)

goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix fmul fadd A B
[PROOF STEP]
by (simp add: mult_matrix_n)
[PROOF STATE]
proof (state)
this:
mult_matrix_n n fmul fadd A B = mult_matrix fmul fadd A B

goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mult_matrix_n n fmul fadd A B = mult_matrix fmul fadd A B

goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
ncols A \<le> n
nrows B \<le> n
ncols A \<le> m
nrows B \<le> m
fadd (0::'c) (0::'c) = (0::'c)
fmul (0::'a) (0::'b) = (0::'c)
[PROOF STEP]
have "\<dots> = mult_matrix_n m fmul fadd A B"
[PROOF STATE]
proof (prove)
using this:
ncols A \<le> n
nrows B \<le> n
ncols A \<le> m
nrows B \<le> m
fadd (0::'c) (0::'c) = (0::'c)
fmul (0::'a) (0::'b) = (0::'c)

goal (1 subgoal):
 1. mult_matrix fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
by (simp add: mult_matrix_n[THEN sym])
[PROOF STATE]
proof (state)
this:
mult_matrix fmul fadd A B = mult_matrix_n m fmul fadd A B

goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
show "mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B"
[PROOF STATE]
proof (prove)
using this:
mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B

goal (1 subgoal):
 1. mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mult_matrix_n n fmul fadd A B = mult_matrix_n m fmul fadd A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rat_induct_pos [case_names Fract, induct type: rat]:
  assumes step: "\<And>a b. 0 < b \<Longrightarrow> P (Fract a b)"
  shows "P q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P q
[PROOF STEP]
proof (cases q)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>q = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> P q
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
q = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>q = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> P q
[PROOF STEP]
have step': "P (Fract a b)" if b: "b < 0" for a b :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (Fract a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P (Fract a b)
[PROOF STEP]
from b
[PROOF STATE]
proof (chain)
picking this:
b < 0
[PROOF STEP]
have "0 < - b"
[PROOF STATE]
proof (prove)
using this:
b < 0

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

goal (1 subgoal):
 1. P (Fract a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < - b
[PROOF STEP]
have "P (Fract (- a) (- b))"
[PROOF STATE]
proof (prove)
using this:
0 < - b

goal (1 subgoal):
 1. P (Fract (- a) (- b))
[PROOF STEP]
by (rule step)
[PROOF STATE]
proof (state)
this:
P (Fract (- a) (- b))

goal (1 subgoal):
 1. P (Fract a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P (Fract (- a) (- b))
[PROOF STEP]
show "P (Fract a b)"
[PROOF STATE]
proof (prove)
using this:
P (Fract (- a) (- b))

goal (1 subgoal):
 1. P (Fract a b)
[PROOF STEP]
by (simp add: order_less_imp_not_eq [OF b])
[PROOF STATE]
proof (state)
this:
P (Fract a b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?b < 0 \<Longrightarrow> P (Fract ?a ?b)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>q = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> P q
[PROOF STEP]
from Fract
[PROOF STATE]
proof (chain)
picking this:
q = Fract a b
0 < b
coprime a b
[PROOF STEP]
show "P q"
[PROOF STATE]
proof (prove)
using this:
q = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. P q
[PROOF STEP]
by (auto simp add: linorder_neq_iff step step')
[PROOF STATE]
proof (state)
this:
P q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma markedElementIsMemberOfItsMarkedElementsTo:
  assumes
  "uniq (elements M)" and "marked e" and "e \<in> set M"
  shows
  "element e \<in> set (markedElementsTo (element e) M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. element e \<in> set (markedElementsTo (element e) M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)
marked e
e \<in> set M

goal (1 subgoal):
 1. element e \<in> set (markedElementsTo (element e) M)
[PROOF STEP]
unfolding markedElementsTo_def
[PROOF STATE]
proof (prove)
using this:
uniq (elements M)
marked e
e \<in> set M

goal (1 subgoal):
 1. element e \<in> set (markedElements (prefixToElement (element e) M))
[PROOF STEP]
by (induct M) (auto split: if_split_asm)


[STATEMENT]
lemma root_divisor: assumes "period w k" and  "k dvd \<^bold>|w\<^bold>|" shows "w \<in> (take k w)*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> take k w*
[PROOF STEP]
using rootI[of "take k w" "(\<^bold>|w\<^bold>| div k)"]
[PROOF STATE]
proof (prove)
using this:
take k w \<^sup>@ (\<^bold>|w\<^bold>| div k) \<in> take k w*

goal (1 subgoal):
 1. w \<in> take k w*
[PROOF STEP]
unfolding
    take_several_pers[OF \<open>period w k\<close>, of "\<^bold>|w\<^bold>| div k", unfolded dvd_div_mult_self[OF \<open>k dvd \<^bold>|w\<^bold>|\<close>] take_self, OF , OF order_refl]
[PROOF STATE]
proof (prove)
using this:
w \<in> take k w*

goal (1 subgoal):
 1. w \<in> take k w*
[PROOF STEP]
.


[STATEMENT]
lemma map_mem_spmf_of_set:
  assumes "finite B" "B \<noteq> {}"
  shows "map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B) = spmf_of_pmf (bernoulli_pmf (card (A \<inter> B) / card B))"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B) = spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))
[PROOF STEP]
proof(rule spmf_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
have "ennreal (spmf ?lhs i) = card (B \<inter> (\<lambda>x. x \<in> A) -` {i}) / (card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i) = ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B))
[PROOF STEP]
by(subst ennreal_spmf_map)(simp add: measure_spmf_spmf_of_set assms emeasure_pmf_of_set)
[PROOF STATE]
proof (state)
this:
ennreal (spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i) = ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i) = ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
have "\<dots> = (if i then card (B \<inter> A) / card B else card (B - A) / card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B))
[PROOF STEP]
by(auto intro: arg_cong[where f=card])
[PROOF STATE]
proof (state)
this:
ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (real (card (B \<inter> (\<lambda>x. x \<in> A) -` {i})) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
have "\<dots> = (if i then card (B \<inter> A) / card B else (card B - card (B \<inter> A)) / card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card B - card (B \<inter> A)) / real (card B))
[PROOF STEP]
by(auto simp add: card_Diff_subset_Int assms)
[PROOF STATE]
proof (state)
this:
ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card B - card (B \<inter> A)) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card (B - A)) / real (card B)) = ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card B - card (B \<inter> A)) / real (card B))

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
have "\<dots> = ennreal (spmf ?rhs i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card B - card (B \<inter> A)) / real (card B)) = ennreal (spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i)
[PROOF STEP]
by(simp add: assms card_gt_0_iff field_simps card_mono Int_commute of_nat_diff)
[PROOF STATE]
proof (state)
this:
ennreal (if i then real (card (B \<inter> A)) / real (card B) else real (card B - card (B \<inter> A)) / real (card B)) = ennreal (spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i)

goal (1 subgoal):
 1. \<And>i. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i) = ennreal (spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i)
[PROOF STEP]
show "spmf ?lhs i = spmf ?rhs i"
[PROOF STATE]
proof (prove)
using this:
ennreal (spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i) = ennreal (spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i)

goal (1 subgoal):
 1. spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
spmf (map_spmf (\<lambda>x. x \<in> A) (spmf_of_set B)) i = spmf (spmf_of_pmf (bernoulli_pmf (real (card (A \<inter> B)) / real (card B)))) i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma intersect_ts_iff [simp]: "c \<in> (A \<Rightarrow>\<inter> B) k = (c \<in> A k \<and> c \<in> B k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<in> (A \<Rightarrow>\<inter>  B) k) = (c \<in> A k \<and> c \<in> B k)
[PROOF STEP]
by (unfold intersect_ts_def) blast


[STATEMENT]
lemma sign_cases [case_names even odd]:
  obtains \<open>sign p = 1\<close> | \<open>sign p = - 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sign p = 1 \<Longrightarrow> thesis; sign p = - 1 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (cases \<open>evenperm p\<close>) (simp_all add: sign_def)


[STATEMENT]
lemma d_separates_forest_modulo_equivalence_1:
  assumes "forest_modulo_equivalence x d"
  shows "x * d \<le> -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
have "x * d \<le> (x * d)\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * d \<le> (x * d)\<^sup>+
[PROOF STEP]
using star.circ_mult_increasing
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?x\<^sup>+

goal (1 subgoal):
 1. x * d \<le> (x * d)\<^sup>+
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * d \<le> (x * d)\<^sup>+

goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * d \<le> (x * d)\<^sup>+

goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
have "... \<le> -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * d)\<^sup>+ \<le> - x
[PROOF STEP]
using assms(1) forest_modulo_equivalence_def le_bot pseudo_complement
[PROOF STATE]
proof (prove)
using this:
forest_modulo_equivalence x d
forest_modulo_equivalence ?x ?d \<equiv> equivalence ?x \<and> coreflexive (?x * ?d[[?x * ?d]]) \<and> coreflexive (?x \<sqinter> ?d * ?d\<^sup>T) \<and> (?x * ?d)\<^sup>+ \<sqinter> ?x \<le> bot
?a \<le> bot \<Longrightarrow> ?a = bot
(?x \<sqinter> ?y = bot) = (?x \<le> - ?y)

goal (1 subgoal):
 1. (x * d)\<^sup>+ \<le> - x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(x * d)\<^sup>+ \<le> - x

goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * d \<le> - x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * d \<le> - x

goal (1 subgoal):
 1. x * d \<le> - x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * d \<le> - x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_diff_swap:
  assumes vs: "a \<in> V"  "b \<in> V"  "c \<in> V"  "d \<in> V"
    and eq: "a + b = c + d"
  shows "a - c = d - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
a + b = c + d
[PROOF STEP]
have "- c + (a + b) = - c + (c + d)"
[PROOF STATE]
proof (prove)
using this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
a + b = c + d

goal (1 subgoal):
 1. - c + (a + b) = - c + (c + d)
[PROOF STEP]
by (simp add: add_left_cancel)
[PROOF STATE]
proof (state)
this:
- c + (a + b) = - c + (c + d)

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- c + (a + b) = - c + (c + d)

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
have "\<dots> = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - c + (c + d) = d
[PROOF STEP]
using \<open>c \<in> V\<close> \<open>d \<in> V\<close>
[PROOF STATE]
proof (prove)
using this:
c \<in> V
d \<in> V

goal (1 subgoal):
 1. - c + (c + d) = d
[PROOF STEP]
by (rule minus_add_cancel)
[PROOF STATE]
proof (state)
this:
- c + (c + d) = d

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- c + (a + b) = d
[PROOF STEP]
have eq: "- c + (a + b) = d"
[PROOF STATE]
proof (prove)
using this:
- c + (a + b) = d

goal (1 subgoal):
 1. - c + (a + b) = d
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
- c + (a + b) = d

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
from vs
[PROOF STATE]
proof (chain)
picking this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
[PROOF STEP]
have "a - c = (- c + (a + b)) + - b"
[PROOF STATE]
proof (prove)
using this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V

goal (1 subgoal):
 1. a - c = - c + (a + b) + - b
[PROOF STEP]
by (simp add: add_ac diff_eq1)
[PROOF STATE]
proof (state)
this:
a - c = - c + (a + b) + - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a - c = - c + (a + b) + - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
from vs eq
[PROOF STATE]
proof (chain)
picking this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
- c + (a + b) = d
[PROOF STEP]
have "\<dots>  = d + - b"
[PROOF STATE]
proof (prove)
using this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
- c + (a + b) = d

goal (1 subgoal):
 1. - c + (a + b) + - b = d + - b
[PROOF STEP]
by (simp add: add_right_cancel)
[PROOF STATE]
proof (state)
this:
- c + (a + b) + - b = d + - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- c + (a + b) + - b = d + - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
from vs
[PROOF STATE]
proof (chain)
picking this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V
[PROOF STEP]
have "\<dots> = d - b"
[PROOF STATE]
proof (prove)
using this:
a \<in> V
b \<in> V
c \<in> V
d \<in> V

goal (1 subgoal):
 1. d + - b = d - b
[PROOF STEP]
by (simp add: diff_eq2)
[PROOF STATE]
proof (state)
this:
d + - b = d - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a - c = d - b
[PROOF STEP]
show "a - c = d - b"
[PROOF STATE]
proof (prove)
using this:
a - c = d - b

goal (1 subgoal):
 1. a - c = d - b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a - c = d - b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_pos: "summable f \<Longrightarrow> (\<And>n. 0 < f n) \<Longrightarrow> 0 < suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) < f n\<rbrakk> \<Longrightarrow> (0::'a) < suminf f
[PROOF STEP]
by (intro suminf_pos2[where i=0]) (auto intro: less_imp_le)


[STATEMENT]
lemma exp_le_one_iff [simp]: "exp x \<le> 1 \<longleftrightarrow> x \<le> 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp x \<le> 1) = (x \<le> 0)
[PROOF STEP]
using exp_le_cancel_iff [where x = x and y = 0]
[PROOF STATE]
proof (prove)
using this:
(exp x \<le> exp 0) = (x \<le> 0)

goal (1 subgoal):
 1. (exp x \<le> 1) = (x \<le> 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma U0_in_NUM: "U\<^sub>0 \<in> NUM"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sub>0 \<in> NUM
[PROOF STEP]
using prenum_in_R2 U0_altdef
[PROOF STATE]
proof (prove)
using this:
prenum \<in> \<R>\<^sup>2
U\<^sub>0 = {prenum e |e. e \<in> UNIV}

goal (1 subgoal):
 1. U\<^sub>0 \<in> NUM
[PROOF STEP]
by (intro NUM_I[of prenum]; force)


[STATEMENT]
lemma ap_substs: "ap Q \<Longrightarrow> length xs = length ys \<Longrightarrow> ap (Q[xs \<^bold>\<rightarrow>\<^sup>* ys])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ap Q; length xs = length ys\<rbrakk> \<Longrightarrow> ap (Q[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
proof (induct Q arbitrary: xs ys rule: ap.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p ts xs ys. length xs = length ys \<Longrightarrow> ap (Pred p ts[xs \<^bold>\<rightarrow>\<^sup>* ys])
 2. \<And>x c xs ys. length xs = length ys \<Longrightarrow> ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
case (Pred p ts)
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (2 subgoals):
 1. \<And>p ts xs ys. length xs = length ys \<Longrightarrow> ap (Pred p ts[xs \<^bold>\<rightarrow>\<^sup>* ys])
 2. \<And>x c xs ys. length xs = length ys \<Longrightarrow> ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. ap (Pred p ts[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
by (induct xs ys arbitrary: ts rule: list_induct2) (auto intro!: ap.intros)
[PROOF STATE]
proof (state)
this:
ap (Pred p ts[xs \<^bold>\<rightarrow>\<^sup>* ys])

goal (1 subgoal):
 1. \<And>x c xs ys. length xs = length ys \<Longrightarrow> ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x c xs ys. length xs = length ys \<Longrightarrow> ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
case (Eqc x c)
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (1 subgoal):
 1. \<And>x c xs ys. length xs = length ys \<Longrightarrow> ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])
[PROOF STEP]
by (induct xs ys arbitrary: x rule: list_induct2) (auto intro!: ap.intros)
[PROOF STATE]
proof (state)
this:
ap (fmla.Eq x (Const c)[xs \<^bold>\<rightarrow>\<^sup>* ys])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in finite_cyclic_group) ord_gen_gt_zero:
  "ord gen > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < ord gen
[PROOF STEP]
using ord_ge_1[OF fin gen_closed]
[PROOF STATE]
proof (prove)
using this:
1 \<le> ord gen

goal (1 subgoal):
 1. 0 < ord gen
[PROOF STEP]
by simp


[STATEMENT]
lemma set_update_subsetI: "\<lbrakk>set xs \<subseteq> A; x \<in> A\<rbrakk> \<Longrightarrow> set(xs[i := x]) \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs \<subseteq> A; x \<in> A\<rbrakk> \<Longrightarrow> set (xs[i := x]) \<subseteq> A
[PROOF STEP]
by (blast dest!: set_update_subset_insert [THEN subsetD])


[STATEMENT]
lemma pq_coprime: "coprime p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime p q
[PROOF STEP]
using pq_neq p_prime primes_coprime_nat q_prime
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
prime p
\<lbrakk>prime ?p; prime ?q; ?p \<noteq> ?q\<rbrakk> \<Longrightarrow> coprime ?p ?q
prime q

goal (1 subgoal):
 1. coprime p q
[PROOF STEP]
by blast


[STATEMENT]
lemma mann1: "-(-x \<squnion> y) = -(-(-(-x \<squnion> y) \<squnion> x \<squnion> y) \<squnion> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- x \<squnion> y) = - (- (- (- x \<squnion> y) \<squnion> x \<squnion> y) \<squnion> y)
[PROOF STEP]
by (metis robbins sup_comm sup_assoc)


[STATEMENT]
lemma HMA_mat_minus[transfer_rule]: "(HMA_M ===> HMA_M ===> HMA_M)
  (\<lambda> A B. A + map_mat uminus B) ((-) :: 'a :: group_add ^'nc^'nr \<Rightarrow> 'a^'nc^'nr \<Rightarrow> 'a^'nc^'nr)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (HMA_M ===> HMA_M ===> HMA_M) (\<lambda>A B. A + map_mat uminus B) (-)
[PROOF STEP]
unfolding rel_fun_def HMA_M_def from_hma\<^sub>m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x = Matrix.mat CARD('nr) CARD('nc) (\<lambda>(i, j). y $h Bij_Nat.from_nat i $h Bij_Nat.from_nat j) \<longrightarrow> (\<forall>xa ya. xa = Matrix.mat CARD('nr) CARD('nc) (\<lambda>(i, j). ya $h Bij_Nat.from_nat i $h Bij_Nat.from_nat j) \<longrightarrow> x + map_mat uminus xa = Matrix.mat CARD('nr) CARD('nc) (\<lambda>(i, j). (y - ya) $h Bij_Nat.from_nat i $h Bij_Nat.from_nat j))
[PROOF STEP]
by auto


[STATEMENT]
lemma Arcsin_bounds: "\<bar>Re z\<bar> < 1 \<Longrightarrow> \<bar>Re(Arcsin z)\<bar> < pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re z\<bar> < 1 \<Longrightarrow> \<bar>Re (Arcsin z)\<bar> < pi / 2
[PROOF STEP]
unfolding Re_Arcsin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re z\<bar> < 1 \<Longrightarrow> \<bar>Im (Ln (\<i> * z + csqrt (1 - z\<^sup>2)))\<bar> < pi / 2
[PROOF STEP]
by (blast intro: Re_Ln_pos_lt_imp Arcsin_range_lemma)


[STATEMENT]
lemma Coinitial_iff_Con:
    shows "Coinitial t u \<longleftrightarrow> t \<frown> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Arr t \<and> Arr u \<and> Src t = Src u) = (t \ u \<noteq> \<^bold>\<sharp>)
[PROOF STEP]
using Coinitial_implies_Con_ind Con_implies_Coinitial_ind
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>local.size (Src ?t) \<le> ?n; Arr ?t \<and> Arr ?u \<and> Src ?t = Src ?u\<rbrakk> \<Longrightarrow> ?t \ ?u \<noteq> \<^bold>\<sharp>
\<lbrakk>local.size ?t + local.size ?u \<le> ?n; ?t \ ?u \<noteq> \<^bold>\<sharp>\<rbrakk> \<Longrightarrow> Arr ?t \<and> Arr ?u \<and> Src ?t = Src ?u

goal (1 subgoal):
 1. (Arr t \<and> Arr u \<and> Src t = Src u) = (t \ u \<noteq> \<^bold>\<sharp>)
[PROOF STEP]
by blast


[STATEMENT]
lemma (in information_space) finite_entropy_simple_function:
  assumes X: "simple_function M X"
  shows "finite_entropy (count_space (X`space M)) X (\<lambda>a. measure M {x \<in> space M. X x = a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_entropy (count_space (X ` space M)) X (\<lambda>a. prob {x \<in> space M. X x = a})
[PROOF STEP]
unfolding finite_entropy_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x})) \<and> integrable (count_space (X ` space M)) (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x})) \<and> (\<forall>x\<in>space (count_space (X ` space M)). 0 \<le> prob {xa \<in> space M. X xa = x})
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))
 2. integrable (count_space (X ` space M)) (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))
 3. \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> prob {xa \<in> space M. X xa = x}
[PROOF STEP]
have [simp]: "finite (X ` space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (X ` space M)
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
simple_function M X

goal (1 subgoal):
 1. finite (X ` space M)
[PROOF STEP]
by (auto simp: simple_function_def)
[PROOF STATE]
proof (state)
this:
finite (X ` space M)

goal (3 subgoals):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))
 2. integrable (count_space (X ` space M)) (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))
 3. \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> prob {xa \<in> space M. X xa = x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (X ` space M)
[PROOF STEP]
show "integrable (count_space (X ` space M))
     (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))"
[PROOF STATE]
proof (prove)
using this:
finite (X ` space M)

goal (1 subgoal):
 1. integrable (count_space (X ` space M)) (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))
[PROOF STEP]
by (rule integrable_count_space)
[PROOF STATE]
proof (state)
this:
integrable (count_space (X ` space M)) (\<lambda>x. prob {xa \<in> space M. X xa = x} * log b (prob {xa \<in> space M. X xa = x}))

goal (2 subgoals):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))
 2. \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> prob {xa \<in> space M. X xa = x}
[PROOF STEP]
have d: "distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (if x \<in> X`space M then prob {xa \<in> space M. X xa = x} else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (if x \<in> X ` space M then prob {xa \<in> space M. X xa = x} else 0))
[PROOF STEP]
by (rule distributed_simple_function_superset[OF X]) (auto intro!: arg_cong[where f=prob])
[PROOF STATE]
proof (state)
this:
distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (if x \<in> X ` space M then prob {xa \<in> space M. X xa = x} else 0))

goal (2 subgoals):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))
 2. \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> prob {xa \<in> space M. X xa = x}
[PROOF STEP]
show "distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))
[PROOF STEP]
by (rule distributed_cong_density[THEN iffD1, OF _ _ _ d]) auto
[PROOF STATE]
proof (state)
this:
distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob {xa \<in> space M. X xa = x}))

goal (1 subgoal):
 1. \<And>x. x \<in> space (count_space (X ` space M)) \<Longrightarrow> 0 \<le> prob {xa \<in> space M. X xa = x}
[PROOF STEP]
qed (rule measure_nonneg)


[STATEMENT]
lemma is_lub_bigger2 [iff]:
  "is_lub (r\<^sup>*) x y x = ((y,x)\<in>r\<^sup>*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_lub (r\<^sup>*) x y x = ((y, x) \<in> r\<^sup>*)
[PROOF STEP]
apply (unfold is_lub_def is_ub_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((x, x) \<in> r\<^sup>* \<and> (y, x) \<in> r\<^sup>*) \<and> (\<forall>z. (x, z) \<in> r\<^sup>* \<and> (y, z) \<in> r\<^sup>* \<longrightarrow> (x, z) \<in> r\<^sup>*)) = ((y, x) \<in> r\<^sup>*)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_qr_to_qr_Poly:
  assumes "length (xs :: int list) < Suc (nat n)"
          "xs \<noteq> []"
  shows "of_qr (to_qr
    (Poly (map (of_int_mod_ring :: int \<Rightarrow> 'a mod_ring) xs))) =
     Poly (map (of_int_mod_ring :: int \<Rightarrow> 'a mod_ring) xs)"
    (is "_ = ?Poly")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)
[PROOF STEP]
have deg: "degree (?Poly) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (degree (Poly (map of_int_mod_ring xs))) < n
[PROOF STEP]
using deg_Poly'[of "map of_int_mod_ring xs"] assms
[PROOF STATE]
proof (prove)
using this:
Poly (map of_int_mod_ring xs) \<noteq> 0 \<Longrightarrow> degree (Poly (map of_int_mod_ring xs)) \<le> length (map of_int_mod_ring xs) - 1
length xs < Suc (nat n)
xs \<noteq> []

goal (1 subgoal):
 1. int (degree (Poly (map of_int_mod_ring xs))) < n
[PROOF STEP]
by (smt (verit, del_insts) One_nat_def Suc_pred degree_0
      length_greater_0_conv length_map less_Suc_eq_le
      order_less_le_trans zless_nat_eq_int_zless)
[PROOF STATE]
proof (state)
this:
int (degree (Poly (map of_int_mod_ring xs))) < n

goal (1 subgoal):
 1. of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int (degree (Poly (map of_int_mod_ring xs))) < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (degree (Poly (map of_int_mod_ring xs))) < n

goal (1 subgoal):
 1. of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)
[PROOF STEP]
using of_qr_to_qr[of "?Poly"] deg_mod_qr_poly[of "?Poly"]
      deg_qr_n
[PROOF STATE]
proof (prove)
using this:
int (degree (Poly (map of_int_mod_ring xs))) < n
of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs) mod qr_poly
degree (Poly (map of_int_mod_ring xs)) < deg_qr TYPE('a) \<Longrightarrow> Poly (map of_int_mod_ring xs) mod qr_poly = Poly (map of_int_mod_ring xs)
int (deg_qr TYPE('a)) = n

goal (1 subgoal):
 1. of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)
[PROOF STEP]
by (smt (verit, best) of_nat_less_imp_less)
[PROOF STATE]
proof (state)
this:
of_qr (to_qr (Poly (map of_int_mod_ring xs))) = Poly (map of_int_mod_ring xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtersD3:
  "\<lbrakk> F \<in> filters T; A\<in>F;  B\<in>F \<rbrakk> \<Longrightarrow> A \<inter> B \<in> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> Filters\<^bsub>T\<^esub>; A \<in> F; B \<in> F\<rbrakk> \<Longrightarrow> A \<inter> B \<in> F
[PROOF STEP]
by (blast elim: filtersE)


[STATEMENT]
lemma count_repeat_zmset[simp]: "zcount (repeat_zmset i A) a = of_nat i * zcount A a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zcount (repeat_zmset i A) a = int i * zcount A a
[PROOF STEP]
by (induct i) (auto simp: semiring_normalization_rules(3))


[STATEMENT]
lemma prv_neg_neg_exi:
  assumes "x \<in> var" "\<phi> \<in> fmla"
    and "prv (neg \<phi>)"
  shows "prv (neg (exi x \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (neg (exi x \<phi>))
[PROOF STEP]
using assms neg_def prv_exi_imp_gen
[PROOF STATE]
proof (prove)
using this:
x \<in> var
\<phi> \<in> fmla
prv (neg \<phi>)
neg ?\<phi> = imp ?\<phi> fls
\<lbrakk>?x \<in> var; ?\<phi> \<in> fmla; ?\<chi> \<in> fmla; ?x \<notin> Fvars ?\<chi>; prv (imp ?\<phi> ?\<chi>)\<rbrakk> \<Longrightarrow> prv (imp (exi ?x ?\<phi>) ?\<chi>)

goal (1 subgoal):
 1. prv (neg (exi x \<phi>))
[PROOF STEP]
by auto