[STATEMENT]
lemma AxT4_AxPT4: \<open>(AxT \<oplus> Ax4) = (AxPT \<oplus> AxP4) o lift\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AxT \<oplus> Ax4 = AxPT \<oplus> AxP4 \<circ> lift
[PROOF STEP]
using AxT_AxPT Ax4_AxP4
[PROOF STATE]
proof (prove)
using this:
AxT = AxPT \<circ> lift
Ax4 = AxP4 \<circ> lift

goal (1 subgoal):
 1. AxT \<oplus> Ax4 = AxPT \<oplus> AxP4 \<circ> lift
[PROOF STEP]
unfolding comp_apply
[PROOF STATE]
proof (prove)
using this:
AxT = (\<lambda>x. AxPT (lift x))
Ax4 = (\<lambda>x. AxP4 (lift x))

goal (1 subgoal):
 1. AxT \<oplus> Ax4 = (\<lambda>x. (AxPT \<oplus> AxP4) (lift x))
[PROOF STEP]
by metis


[STATEMENT]
lemma cross_ratio_abs:
  fixes u v :: "real^3" and i j k l :: real
  assumes "u \<noteq> 0" and "v \<noteq> 0" and "proj2_abs u \<noteq> proj2_abs v"
  and "j \<noteq> 0" and "l \<noteq> 0"
  shows "cross_ratio (proj2_abs u) (proj2_abs v)
  (proj2_abs (i *\<^sub>R u + j *\<^sub>R v))
  (proj2_abs (k *\<^sub>R u + l *\<^sub>R v))
  = j * k / (i * l)"
  (is "cross_ratio ?p ?q ?r ?s = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
from \<open>u \<noteq> 0\<close> and proj2_rep_abs2
[PROOF STATE]
proof (chain)
picking this:
u \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v
[PROOF STEP]
obtain g where "g \<noteq> 0" and "proj2_rep ?p = g *\<^sub>R u"
[PROOF STATE]
proof (prove)
using this:
u \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g \<noteq> 0; proj2_rep (proj2_abs u) = g *\<^sub>R u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<noteq> 0
proj2_rep (proj2_abs u) = g *\<^sub>R u

goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
from \<open>v \<noteq> 0\<close> and proj2_rep_abs2
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v
[PROOF STEP]
obtain h where "h \<noteq> 0" and "proj2_rep ?q = h *\<^sub>R v"
[PROOF STATE]
proof (prove)
using this:
v \<noteq> 0
?v \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs ?v) = k *\<^sub>R ?v

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<noteq> 0; proj2_rep (proj2_abs v) = h *\<^sub>R v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h \<noteq> 0
proj2_rep (proj2_abs v) = h *\<^sub>R v

goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
with \<open>g \<noteq> 0\<close> and \<open>proj2_rep ?p = g *\<^sub>R u\<close>
[PROOF STATE]
proof (chain)
picking this:
g \<noteq> 0
proj2_rep (proj2_abs u) = g *\<^sub>R u
h \<noteq> 0
proj2_rep (proj2_abs v) = h *\<^sub>R v
[PROOF STEP]
have "?r = proj2_abs ((i/g) *\<^sub>R proj2_rep ?p + (j/h) *\<^sub>R proj2_rep ?q)"
    and "?s = proj2_abs ((k/g) *\<^sub>R proj2_rep ?p + (l/h) *\<^sub>R proj2_rep ?q)"
[PROOF STATE]
proof (prove)
using this:
g \<noteq> 0
proj2_rep (proj2_abs u) = g *\<^sub>R u
h \<noteq> 0
proj2_rep (proj2_abs v) = h *\<^sub>R v

goal (1 subgoal):
 1. proj2_abs (i *\<^sub>R u + j *\<^sub>R v) = proj2_abs ((i / g) *\<^sub>R proj2_rep (proj2_abs u) + (j / h) *\<^sub>R proj2_rep (proj2_abs v)) &&& proj2_abs (k *\<^sub>R u + l *\<^sub>R v) = proj2_abs ((k / g) *\<^sub>R proj2_rep (proj2_abs u) + (l / h) *\<^sub>R proj2_rep (proj2_abs v))
[PROOF STEP]
by (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
proj2_abs (i *\<^sub>R u + j *\<^sub>R v) = proj2_abs ((i / g) *\<^sub>R proj2_rep (proj2_abs u) + (j / h) *\<^sub>R proj2_rep (proj2_abs v))
proj2_abs (k *\<^sub>R u + l *\<^sub>R v) = proj2_abs ((k / g) *\<^sub>R proj2_rep (proj2_abs u) + (l / h) *\<^sub>R proj2_rep (proj2_abs v))

goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
with \<open>?p \<noteq> ?q\<close> and \<open>h \<noteq> 0\<close> and \<open>j \<noteq> 0\<close> and \<open>l \<noteq> 0\<close> and proj2_Col_coeff_abs
[PROOF STATE]
proof (chain)
picking this:
proj2_abs u \<noteq> proj2_abs v
h \<noteq> 0
j \<noteq> 0
l \<noteq> 0
\<lbrakk>?p \<noteq> ?q; ?j \<noteq> 0\<rbrakk> \<Longrightarrow> proj2_Col_coeff ?p ?q (proj2_abs (?i *\<^sub>R proj2_rep ?p + ?j *\<^sub>R proj2_rep ?q)) = ?i / ?j
proj2_abs (i *\<^sub>R u + j *\<^sub>R v) = proj2_abs ((i / g) *\<^sub>R proj2_rep (proj2_abs u) + (j / h) *\<^sub>R proj2_rep (proj2_abs v))
proj2_abs (k *\<^sub>R u + l *\<^sub>R v) = proj2_abs ((k / g) *\<^sub>R proj2_rep (proj2_abs u) + (l / h) *\<^sub>R proj2_rep (proj2_abs v))
[PROOF STEP]
have "proj2_Col_coeff ?p ?q ?r = h*i/(g*j)"
    and "proj2_Col_coeff ?p ?q ?s = h*k/(g*l)"
[PROOF STATE]
proof (prove)
using this:
proj2_abs u \<noteq> proj2_abs v
h \<noteq> 0
j \<noteq> 0
l \<noteq> 0
\<lbrakk>?p \<noteq> ?q; ?j \<noteq> 0\<rbrakk> \<Longrightarrow> proj2_Col_coeff ?p ?q (proj2_abs (?i *\<^sub>R proj2_rep ?p + ?j *\<^sub>R proj2_rep ?q)) = ?i / ?j
proj2_abs (i *\<^sub>R u + j *\<^sub>R v) = proj2_abs ((i / g) *\<^sub>R proj2_rep (proj2_abs u) + (j / h) *\<^sub>R proj2_rep (proj2_abs v))
proj2_abs (k *\<^sub>R u + l *\<^sub>R v) = proj2_abs ((k / g) *\<^sub>R proj2_rep (proj2_abs u) + (l / h) *\<^sub>R proj2_rep (proj2_abs v))

goal (1 subgoal):
 1. proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) = h * i / (g * j) &&& proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = h * k / (g * l)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) = h * i / (g * j)
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = h * k / (g * l)

goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
with \<open>g \<noteq> 0\<close> and \<open>h \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
g \<noteq> 0
h \<noteq> 0
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) = h * i / (g * j)
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = h * k / (g * l)
[PROOF STEP]
show "cross_ratio ?p ?q ?r ?s = j*k/(i*l)"
[PROOF STATE]
proof (prove)
using this:
g \<noteq> 0
h \<noteq> 0
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) = h * i / (g * j)
proj2_Col_coeff (proj2_abs u) (proj2_abs v) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = h * k / (g * l)

goal (1 subgoal):
 1. cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)
[PROOF STEP]
by (unfold cross_ratio_def) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
cross_ratio (proj2_abs u) (proj2_abs v) (proj2_abs (i *\<^sub>R u + j *\<^sub>R v)) (proj2_abs (k *\<^sub>R u + l *\<^sub>R v)) = j * k / (i * l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pn_props_correct:
  assumes [simp]: "finite ps"
  shows "pn_props ps \<le> SPEC(\<lambda>r. r =
  ({p. Prop_ltlr p \<in> ps}, {p. Nprop_ltlr p \<in> ps}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pn_props ps \<le> SPEC (\<lambda>r. r = ({p. prop\<^sub>r(p) \<in> ps}, {p. nprop\<^sub>r(p) \<in> ps}))
[PROOF STEP]
unfolding pn_props_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FOREACH\<^bsup>\<lambda>it (P, N). P = {p. prop\<^sub>r(p) \<in> ps - it} \<and> N = {p. nprop\<^sub>r(p) \<in> ps - it}\<^esup> ps (\<lambda>p (P, N). case p of prop\<^sub>r(p) \<Rightarrow> RETURN (insert p P, N) | nprop\<^sub>r(p) \<Rightarrow> RETURN (P, insert p N) | _ \<Rightarrow> RETURN (P, N)) ({}, {}) \<le> SPEC (\<lambda>r. r = ({p. prop\<^sub>r(p) \<in> ps}, {p. nprop\<^sub>r(p) \<in> ps}))
[PROOF STEP]
apply (refine_rcg refine_vcg)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. finite ps
 2. \<And>x1 x2. ({}, {}) = (x1, x2) \<Longrightarrow> x1 = {p. prop\<^sub>r(p) \<in> ps - ps}
 3. \<And>x1 x2. ({}, {}) = (x1, x2) \<Longrightarrow> x2 = {p. nprop\<^sub>r(p) \<in> ps - ps}
 4. \<And>x it \<sigma> a b. \<lbrakk>x \<in> it; it \<subseteq> ps; case \<sigma> of (P, N) \<Rightarrow> P = {p. prop\<^sub>r(p) \<in> ps - it} \<and> N = {p. nprop\<^sub>r(p) \<in> ps - it}; \<sigma> = (a, b)\<rbrakk> \<Longrightarrow> (case x of prop\<^sub>r(p) \<Rightarrow> RETURN (insert p a, b) | nprop\<^sub>r(p) \<Rightarrow> RETURN (a, insert p b) | _ \<Rightarrow> RETURN (a, b)) \<le> SPEC (\<lambda>(P, N). P = {p. prop\<^sub>r(p) \<in> ps - (it - {x})} \<and> N = {p. nprop\<^sub>r(p) \<in> ps - (it - {x})})
 5. \<And>\<sigma>. case \<sigma> of (P, N) \<Rightarrow> P = {p. prop\<^sub>r(p) \<in> ps - {}} \<and> N = {p. nprop\<^sub>r(p) \<in> ps - {}} \<Longrightarrow> \<sigma> = ({p. prop\<^sub>r(p) \<in> ps}, {p. nprop\<^sub>r(p) \<in> ps})
[PROOF STEP]
apply (auto split: ltlr.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eucl_less_iff_less_nth_eucl: "eucl_less x y \<longleftrightarrow> (\<forall>i<DIM('a). (x $\<^sub>e i) < (y $\<^sub>e i))"
  for x::"'a::executable_euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_less x y = (\<forall>i<DIM('a). x $\<^sub>e i < y $\<^sub>e i)
[PROOF STEP]
apply (auto simp: nth_eucl_def algebra_simps eucl_less_def[where 'a='a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<forall>i<DIM('a). x \<bullet> Basis_list ! i < y \<bullet> Basis_list ! i; i \<in> Basis\<rbrakk> \<Longrightarrow> x \<bullet> i < y \<bullet> i
[PROOF STEP]
by (metis Basis_zero eucl_eq_iff inner_not_same_Basis inner_zero_left length_Basis_list
      nth_Basis_list_in_Basis nth_eucl_def)


[STATEMENT]
lemma (in encoding_wrt_barbs) indRelRSTPO_impl_SRel_and_TRel_preserve_barbs:
  fixes SRel :: "('procS \<times> 'procS) set"
    and TRel :: "('procT \<times> 'procT) set"
  assumes preservation: "rel_preserves_barbs (indRelRSTPO SRel TRel) (STCalWB SWB TWB)"
  shows "rel_preserves_barbs SRel SWB"
    and "rel_preserves_barbs TRel TWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB) &&& rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
 2. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
show "rel_preserves_barbs SRel SWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
[PROOF STEP]
using preservation rel_with_source_impl_SRel_preserves_barbs[where
                          Rel="indRelRSTPO SRel TRel" and SRel="SRel"]
[PROOF STATE]
proof (prove)
using this:
rel_preserves_binary_pred (indRelRSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB))
rel_preserves_binary_pred (indRelRSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB)) \<and> (\<forall>S1 S2. (S1, S2) \<in> SRel \<longrightarrow> SourceTerm S1 \<lesssim>\<lbrakk>\<cdot>\<rbrakk>R<SRel,TRel> SourceTerm S2) \<Longrightarrow> rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
[PROOF STEP]
by (simp add: indRelRSTPO.source)
[PROOF STATE]
proof (state)
this:
rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
show "rel_preserves_barbs TRel TWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
using preservation rel_with_target_impl_TRel_preserves_barbs[where
                          Rel="indRelRSTPO SRel TRel" and TRel="TRel"]
[PROOF STATE]
proof (prove)
using this:
rel_preserves_binary_pred (indRelRSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB))
rel_preserves_binary_pred (indRelRSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB)) \<and> (\<forall>T1 T2. (T1, T2) \<in> TRel \<longrightarrow> TargetTerm T1 \<lesssim>\<lbrakk>\<cdot>\<rbrakk>R<SRel,TRel> TargetTerm T2) \<Longrightarrow> rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
by (simp add: indRelRSTPO.target)
[PROOF STATE]
proof (state)
this:
rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bit_iff_and_push_bit_not_eq_0:
  \<open>bit a n \<longleftrightarrow> a AND push_bit n 1 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit a n = (a AND push_bit n (1::'a) \<noteq> (0::'a))
[PROOF STEP]
apply (cases \<open>2 ^ n = 0\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (2::'a) ^ n = (0::'a) \<Longrightarrow> bit a n = (a AND push_bit n (1::'a) \<noteq> (0::'a))
 2. (2::'a) ^ n \<noteq> (0::'a) \<Longrightarrow> bit a n = (a AND push_bit n (1::'a) \<noteq> (0::'a))
[PROOF STEP]
apply (simp_all add: bit_eq_iff bit_and_iff bit_push_bit_iff exp_eq_0_imp_not_bit)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>na. possible_bit TYPE('a) na \<and> bit ((2::'a) ^ n) na \<Longrightarrow> bit a n = (\<exists>na. possible_bit TYPE('a) na \<and> bit a na \<and> bit ((2::'a) ^ n) na)
[PROOF STEP]
apply (simp_all add: bit_exp_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma order_finite_set_obtain_foundation:
  fixes   t :: "_ :: order"
  assumes "finite M"
    and   "t \<in> M"
  obtains s where "s \<in> M" "s \<le> t" "\<forall>u\<in>M. \<not> u < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. \<lbrakk>s \<in> M; s \<le> t; \<forall>u\<in>M. \<not> u < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms order_finite_set_exists_foundation
[PROOF STATE]
proof (prove)
using this:
finite M
t \<in> M
\<lbrakk>finite ?M; ?t \<in> ?M\<rbrakk> \<Longrightarrow> \<exists>s\<in>?M. s \<le> ?t \<and> (\<forall>u\<in>?M. \<not> u < s)

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>s \<in> M; s \<le> t; \<forall>u\<in>M. \<not> u < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma sum_nodes_finite[intro]:
      assumes "alphabet\<^sub>1 A = alphabet\<^sub>2 B"
      assumes "finite (a.nodes A)" "finite (b.nodes B)"
      shows "finite (c.nodes (sum A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (c.nodes' (local.sum A B))
[PROOF STEP]
using finite_subset sum_nodes assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
alphabet\<^sub>1 ?A = alphabet\<^sub>2 ?B \<Longrightarrow> c.nodes' (local.sum ?A ?B) \<subseteq> a.nodes' ?A <+> b.nodes' ?B
alphabet\<^sub>1 A = alphabet\<^sub>2 B
finite (a.nodes' A)
finite (b.nodes' B)

goal (1 subgoal):
 1. finite (c.nodes' (local.sum A B))
[PROOF STEP]
by (auto intro: finite_Plus)


[STATEMENT]
lemma rel_list_all2_update_cong:
  "\<lbrakk> i<size xs; list_all2 (fun_of S) xs ys; (x,y) \<in> S \<rbrakk>
  \<Longrightarrow> list_all2 (fun_of S) (xs[i:=x]) (ys[i:=y])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length xs; list_all2 (fun_of S) xs ys; (x, y) \<in> S\<rbrakk> \<Longrightarrow> list_all2 (fun_of S) (xs[i := x]) (ys[i := y])
[PROOF STEP]
by (simp add: list_all2_update_cong)


[STATEMENT]
lemma tendsto_fbint_fact: "(\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0
[PROOF STEP]
have "(\<lambda>n. dist (fbint (fact n)) (fbint 0)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. dist (fbint (fact n)) (fbint 0)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule tendsto_sandwich[OF always_eventually always_eventually]; safe?)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x. ?f1 x \<le> dist (fbint (fact x)) (fbint 0)
 2. \<And>x. dist (fbint (fact x)) (fbint 0) \<le> ?h1 x
 3. ?f1 \<longlonglongrightarrow> 0
 4. ?h1 \<longlonglongrightarrow> 0
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x. ?f1 x \<le> dist (fbint (fact x)) (fbint 0)
 2. \<And>x. dist (fbint (fact x)) (fbint 0) \<le> ?h1 x
 3. ?f1 \<longlonglongrightarrow> 0
 4. ?h1 \<longlonglongrightarrow> 0
[PROOF STEP]
show "dist (fbint (fact n)) (fbint 0) \<le> 1 / 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (fbint (fact n)) (fbint 0) \<le> 1 / 2 ^ n
[PROOF STEP]
unfolding dist_fbint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fb.dist (fbint (fact n)) (fbint 0) \<le> 1 / 2 ^ n
[PROOF STEP]
by (transfer fixing: n) (use fb.N_fact_le[of n] in simp)
[PROOF STATE]
proof (state)
this:
dist (fbint (fact n)) (fbint 0) \<le> 1 / 2 ^ n

goal (3 subgoals):
 1. \<And>x. ?f1 x \<le> dist (fbint (fact x)) (fbint 0)
 2. ?f1 \<longlonglongrightarrow> 0
 3. (\<lambda>x. 1 / 2 ^ x) \<longlonglongrightarrow> 0
[PROOF STEP]
show "dist (fbint (fact n)) (fbint 0) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> dist (fbint (fact n)) (fbint 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> dist (fbint (fact n)) (fbint 0)

goal (2 subgoals):
 1. (\<lambda>x. 0) \<longlonglongrightarrow> 0
 2. (\<lambda>x. 1 / 2 ^ x) \<longlonglongrightarrow> 0
[PROOF STEP]
show "(\<lambda>n. 1 / 2 ^ n :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / 2 ^ n) \<longlonglongrightarrow> 0
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / 2 ^ n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>x. 0) \<longlonglongrightarrow> 0
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>n. dist (fbint (fact n)) (fbint 0)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. dist (fbint (fact n)) (fbint 0)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0
[PROOF STEP]
using tendsto_dist_iff
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. dist (fbint (fact n)) (fbint 0)) \<longlonglongrightarrow> 0
(?f \<longlongrightarrow> ?l) ?F = ((\<lambda>x. dist (?f x) ?l) \<longlongrightarrow> 0) ?F

goal (1 subgoal):
 1. (\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>n. fbint (fact n)) \<longlonglongrightarrow> fbint 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_pderiv2:
  "pderiv p \<noteq> 0 \<Longrightarrow> order a p \<noteq> 0 \<Longrightarrow> order a (pderiv p) = n \<longleftrightarrow> order a p = Suc n"
  for p :: "'a::field_char_0 poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pderiv p \<noteq> 0; order a p \<noteq> 0\<rbrakk> \<Longrightarrow> (order a (pderiv p) = n) = (order a p = Suc n)
[PROOF STEP]
by (auto dest: order_pderiv)


[STATEMENT]
lemma list_length1E:
  assumes "length xs = Suc 0" obtains x where "xs = [x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. xs = [x] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = Suc 0

goal (1 subgoal):
 1. (\<And>x. xs = [x] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma sin_vangle_zero_iff: "sin (vangle u v) = 0 \<longleftrightarrow> vangle u v \<in> {0, pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin (vangle u v) = 0) = (vangle u v \<in> {0, pi})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
assume "sin (vangle u v) = 0"
[PROOF STATE]
proof (state)
this:
sin (vangle u v) = 0

goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin (vangle u v) = 0
[PROOF STEP]
obtain n :: int where n: "of_int n = vangle u v / pi"
[PROOF STATE]
proof (prove)
using this:
sin (vangle u v) = 0

goal (1 subgoal):
 1. (\<And>n. real_of_int n = vangle u v / pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) sin_zero_iff_int2) auto
[PROOF STATE]
proof (state)
this:
real_of_int n = vangle u v / pi

goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int n = vangle u v / pi

goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
have "\<dots> \<in> {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vangle u v / pi \<in> {0..1}
[PROOF STEP]
using vangle_bounds
[PROOF STATE]
proof (prove)
using this:
0 \<le> vangle ?u ?v
vangle ?u ?v \<le> pi

goal (1 subgoal):
 1. vangle u v / pi \<in> {0..1}
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
vangle u v / pi \<in> {0..1}

goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int n \<in> {0..1}
[PROOF STEP]
have "n \<in> {0,1}"
[PROOF STATE]
proof (prove)
using this:
real_of_int n \<in> {0..1}

goal (1 subgoal):
 1. n \<in> {0, 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<in> {0, 1}

goal (2 subgoals):
 1. sin (vangle u v) = 0 \<Longrightarrow> vangle u v \<in> {0, pi}
 2. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
thus "vangle u v \<in> {0,pi}"
[PROOF STATE]
proof (prove)
using this:
n \<in> {0, 1}

goal (1 subgoal):
 1. vangle u v \<in> {0, pi}
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n \<in> {0, 1}
real_of_int n = vangle u v / pi

goal (1 subgoal):
 1. vangle u v \<in> {0, pi}
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
vangle u v \<in> {0, pi}

goal (1 subgoal):
 1. vangle u v \<in> {0, pi} \<Longrightarrow> sin (vangle u v) = 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma del_min_mset:
  fixes heap::"int \<Rightarrow> int"
  assumes
    "l < r"
    "is_heap (\<le>) heap l r"
    "mod_heap = heap(l := heap (r - 1))"
    "arr_mset mod_heap l (r - 1) = arr_mset new_heap l (r - 1)"
  shows
    "arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
let ?heap_mset = "arr_mset heap l r"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
have l_is_min: "heap l = Min_mset ?heap_mset"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. heap l = Min_mset (arr_mset heap l r)
[PROOF STEP]
using assms(1,2) heap_minimum
[PROOF STATE]
proof (prove)
using this:
l < r
is_heap (\<le>) heap l r
\<lbrakk>?l < ?r; is_heap (\<le>) ?heap ?l ?r\<rbrakk> \<Longrightarrow> ?heap ?l = Min_mset (arr_mset ?heap ?l ?r)

goal (1 subgoal):
 1. heap l = Min_mset (arr_mset heap l r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
heap l = Min_mset (arr_mset heap l r)

goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
have "(arr_mset mod_heap l r) = ?heap_mset + {#heap (r-1)#} - {#heap l#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_mset mod_heap l r = arr_mset heap l r + {#heap (r - 1)#} - {#heap l#}
[PROOF STEP]
by (simp add: assms(1,3) mset_ran_subst_inside)
[PROOF STATE]
proof (state)
this:
arr_mset mod_heap l r = arr_mset heap l r + {#heap (r - 1)#} - {#heap l#}

goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
hence "(arr_mset mod_heap l (r - 1)) = ?heap_mset - {#heap l#}"
[PROOF STATE]
proof (prove)
using this:
arr_mset mod_heap l r = arr_mset heap l r + {#heap (r - 1)#} - {#heap l#}

goal (1 subgoal):
 1. arr_mset mod_heap l (r - 1) = arr_mset heap l r - {#heap l#}
[PROOF STEP]
by (simp add: assms(1,3) arr_mset_remove_last)
[PROOF STATE]
proof (state)
this:
arr_mset mod_heap l (r - 1) = arr_mset heap l r - {#heap l#}

goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
arr_mset mod_heap l (r - 1) = arr_mset heap l r - {#heap l#}

goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
using assms(4) l_is_min
[PROOF STATE]
proof (prove)
using this:
arr_mset mod_heap l (r - 1) = arr_mset heap l r - {#heap l#}
arr_mset mod_heap l (r - 1) = arr_mset new_heap l (r - 1)
heap l = Min_mset (arr_mset heap l r)

goal (1 subgoal):
 1. arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
arr_mset new_heap l (r - 1) = arr_mset heap l r - {#Min_mset (arr_mset heap l r)#}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma B_greater_zero: "x \<in> B \<Longrightarrow> 0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> B \<Longrightarrow> 0 < x
[PROOF STEP]
using a_nonzero
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. x \<in> B \<Longrightarrow> 0 < x
[PROOF STEP]
by (auto simp add: B_def A_greater_zero)


[STATEMENT]
lemma lemma_2_4_7_a: "a l-n\<rightarrow> b = a ^ n l\<rightarrow> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a l-n\<rightarrow> b = a ^ n l\<rightarrow> b
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a l-0\<rightarrow> b = a ^ 0 l\<rightarrow> b
 2. \<And>n. a l-n\<rightarrow> b = a ^ n l\<rightarrow> b \<Longrightarrow> a l-Suc n\<rightarrow> b = a ^ Suc n l\<rightarrow> b
[PROOF STEP]
by (simp_all add: left_impl_ded)


[STATEMENT]
lemma smallo_imp_less_real:
  assumes "f \<in> o[F](g)" "eventually (\<lambda>x. g x > (0::real)) F"
  shows   "eventually (\<lambda>x. f x < g x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x < g x
[PROOF STEP]
using smallo_imp_abs_less_real[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. \<bar>f x\<bar> < g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x < g x
[PROOF STEP]
by eventually_elim simp


[STATEMENT]
lemma invimage_vrange_vsubset[simp]:
  assumes "\<R>\<^sub>\<circ> r \<subseteq>\<^sub>\<circ> B"
  shows "r -`\<^sub>\<circ> B = \<D>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r -`\<^sub>\<circ> B = \<D>\<^sub>\<circ> r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<R>\<^sub>\<circ> r \<subseteq>\<^sub>\<circ> B

goal (1 subgoal):
 1. r -`\<^sub>\<circ> B = \<D>\<^sub>\<circ> r
[PROOF STEP]
unfolding app_invimage_def
[PROOF STATE]
proof (prove)
using this:
\<R>\<^sub>\<circ> r \<subseteq>\<^sub>\<circ> B

goal (1 subgoal):
 1. r\<inverse>\<^sub>\<circ> `\<^sub>\<circ> B = \<D>\<^sub>\<circ> r
[PROOF STEP]
by (blast intro!: vsubset_antisym)


[STATEMENT]
lemma set_mset_poly_roots: "p \<noteq> 0 \<Longrightarrow> set_mset (poly_roots p) = {x. poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> set_mset (poly_roots p) = {x. poly p x = (0::'a)}
[PROOF STEP]
using in_poly_roots_iff[of p]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> (?x \<in># poly_roots p) = (poly p ?x = (0::'a))

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> set_mset (poly_roots p) = {x. poly p x = (0::'a)}
[PROOF STEP]
by blast


[STATEMENT]
lemma rel_boundary_of_polyhedron:
  fixes S :: "'a :: euclidean_space set"
  assumes "polyhedron S"
    shows "S - rel_interior S = \<Union> {F. F facet_of S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - rel_interior S = \<Union> {F. F facet_of S}
[PROOF STEP]
using facet_of_imp_subset
[PROOF STATE]
proof (prove)
using this:
?F facet_of ?S \<Longrightarrow> ?F \<subseteq> ?S

goal (1 subgoal):
 1. S - rel_interior S = \<Union> {F. F facet_of S}
[PROOF STEP]
by (fastforce simp add: rel_interior_of_polyhedron assms)


[STATEMENT]
lemma mem_samp_primes_prime:
  shows "x \<in> set_spmf sample_primes \<Longrightarrow> prime x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set_spmf sample_primes \<Longrightarrow> prime x
[PROOF STEP]
apply (simp add: finite_prime_set sample_primes_def prime_set_ass)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> prime_set \<Longrightarrow> prime x
[PROOF STEP]
using prime_set_ass
[PROOF STATE]
proof (prove)
using this:
prime_set \<subseteq> {x. prime x \<and> 2 < x}

goal (1 subgoal):
 1. x \<in> prime_set \<Longrightarrow> prime x
[PROOF STEP]
by blast


[STATEMENT]
lemma prefixes_set : "set (prefixes xs) = {xs' . \<exists> xs'' . xs'@xs'' = xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs}
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (prefixes []) = {xs'. \<exists>xs''. xs' @ xs'' = []}
 2. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. set (prefixes []) = {xs'. \<exists>xs''. xs' @ xs'' = []}
 2. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (prefixes []) = {xs'. \<exists>xs''. xs' @ xs'' = []}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (prefixes []) = {xs'. \<exists>xs''. xs' @ xs'' = []}

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs}

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs}

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
have "prefixes (x#xs) = [] # map ((#) x) (prefixes xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefixes (x # xs) = [] # map ((#) x) (prefixes xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prefixes (x # xs) = [] # map ((#) x) (prefixes xs)

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs}
prefixes (x # xs) = [] # map ((#) x) (prefixes xs)
[PROOF STEP]
have *: "set (prefixes (x#xs)) = insert [] (((#) x) ` {xs'. \<exists>xs''. xs' @ xs'' = xs})"
[PROOF STATE]
proof (prove)
using this:
set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs}
prefixes (x # xs) = [] # map ((#) x) (prefixes xs)

goal (1 subgoal):
 1. set (prefixes (x # xs)) = insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (prefixes (x # xs)) = insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (prefixes (x # xs)) = insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
have "\<dots> = {xs' . \<exists> xs'' . xs'@xs'' = (x#xs)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<subseteq> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
 2. {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<subseteq> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
show "insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<subseteq> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<subseteq> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<subseteq> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<subseteq> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
show "{xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<subseteq> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<subseteq> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> xa \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> xa \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
assume "y \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}"
[PROOF STATE]
proof (state)
this:
y \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> xa \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
obtain y' where "y@y' = x # xs"
[PROOF STATE]
proof (prove)
using this:
y \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

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

goal (1 subgoal):
 1. \<And>xa. xa \<in> {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> xa \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y @ y' = x # xs
[PROOF STEP]
show "y \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})"
[PROOF STATE]
proof (prove)
using this:
y @ y' = x # xs

goal (1 subgoal):
 1. y \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
by (cases y; auto)
[PROOF STATE]
proof (state)
this:
y \<in> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<subseteq> insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
insert [] ((#) x ` {xs'. \<exists>xs''. xs' @ xs'' = xs}) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. \<And>a xs. set (prefixes xs) = {xs'. \<exists>xs''. xs' @ xs'' = xs} \<Longrightarrow> set (prefixes (a # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = a # xs}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (prefixes (x # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (prefixes (x # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. set (prefixes (x # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set (prefixes (x # xs)) = {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem ce_intersect: "\<lbrakk> A \<in> ce_sets; B \<in> ce_sets \<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
assume A1: "A \<in> ce_sets"
[PROOF STATE]
proof (state)
this:
A \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<in> ce_sets
[PROOF STEP]
obtain p_a where S2: "p_a \<in> PrimRec2" and S3: "A = fn_to_set p_a"
[PROOF STATE]
proof (prove)
using this:
A \<in> ce_sets

goal (1 subgoal):
 1. (\<And>p_a. \<lbrakk>p_a \<in> PrimRec2; A = fn_to_set p_a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
p_a \<in> PrimRec2
A = fn_to_set p_a

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
assume A2: "B \<in> ce_sets"
[PROOF STATE]
proof (state)
this:
B \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> ce_sets
[PROOF STEP]
obtain p_b where S5: "p_b \<in> PrimRec2" and S6: "B = fn_to_set p_b"
[PROOF STATE]
proof (prove)
using this:
B \<in> ce_sets

goal (1 subgoal):
 1. (\<And>p_b. \<lbrakk>p_b \<in> PrimRec2; B = fn_to_set p_b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
p_b \<in> PrimRec2
B = fn_to_set p_b

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
let ?p = "(\<lambda> x y. (p_a x (c_fst y)) + (p_b x (c_snd y)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
from S2 S5
[PROOF STATE]
proof (chain)
picking this:
p_a \<in> PrimRec2
p_b \<in> PrimRec2
[PROOF STEP]
have S7: "?p \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
p_a \<in> PrimRec2
p_b \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
have S8: "\<forall> x. (\<exists> y. ?p x y = 0) = ((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
show "(\<exists> y. ?p x y = 0) = ((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
have 1: "(\<exists> y. ?p x y = 0) \<Longrightarrow> ((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0 \<Longrightarrow> (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0 \<Longrightarrow> (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)

goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
have 2: "((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0)) \<Longrightarrow> (\<exists> y. ?p x y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
assume "((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0))"
[PROOF STATE]
proof (state)
this:
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)

goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)
[PROOF STEP]
obtain z1 z2 where s_23: "p_a x z1 = 0" and s_24: "p_b x z2 = 0"
[PROOF STATE]
proof (prove)
using this:
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)

goal (1 subgoal):
 1. (\<And>z1 z2. \<lbrakk>p_a x z1 = 0; p_b x z2 = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p_a x z1 = 0
p_b x z2 = 0

goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
let ?y1 = "c_pair z1 z2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
from s_23
[PROOF STATE]
proof (chain)
picking this:
p_a x z1 = 0
[PROOF STEP]
have s_25: "p_a x (c_fst ?y1) = 0"
[PROOF STATE]
proof (prove)
using this:
p_a x z1 = 0

goal (1 subgoal):
 1. p_a x (c_fst (c_pair z1 z2)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p_a x (c_fst (c_pair z1 z2)) = 0

goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
from s_24
[PROOF STATE]
proof (chain)
picking this:
p_b x z2 = 0
[PROOF STEP]
have s_26: "p_b x (c_snd ?y1) = 0"
[PROOF STATE]
proof (prove)
using this:
p_b x z2 = 0

goal (1 subgoal):
 1. p_b x (c_snd (c_pair z1 z2)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p_b x (c_snd (c_pair z1 z2)) = 0

goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
from s_25 s_26
[PROOF STATE]
proof (chain)
picking this:
p_a x (c_fst (c_pair z1 z2)) = 0
p_b x (c_snd (c_pair z1 z2)) = 0
[PROOF STEP]
have s_27: "p_a x (c_fst ?y1) + p_b x (c_snd ?y1) = 0"
[PROOF STATE]
proof (prove)
using this:
p_a x (c_fst (c_pair z1 z2)) = 0
p_b x (c_snd (c_pair z1 z2)) = 0

goal (1 subgoal):
 1. p_a x (c_fst (c_pair z1 z2)) + p_b x (c_snd (c_pair z1 z2)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p_a x (c_fst (c_pair z1 z2)) + p_b x (c_snd (c_pair z1 z2)) = 0

goal (1 subgoal):
 1. (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p_a x (c_fst (c_pair z1 z2)) + p_b x (c_snd (c_pair z1 z2)) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p_a x (c_fst (c_pair z1 z2)) + p_b x (c_snd (c_pair z1 z2)) = 0

goal (1 subgoal):
 1. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0

goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
from 1 2
[PROOF STATE]
proof (chain)
picking this:
\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0 \<Longrightarrow> (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0
[PROOF STEP]
have "(\<exists> y. ?p x y = 0) = ((\<exists> z. p_a x z = 0) \<and> (\<exists> z. p_b x z = 0))"
[PROOF STATE]
proof (prove)
using this:
\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0 \<Longrightarrow> (\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0)
(\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0) \<Longrightarrow> \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0

goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
by (rule iffI)
[PROOF STATE]
proof (state)
this:
(\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal (1 subgoal):
 1. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
let ?C = "fn_to_set ?p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
have S9: "?C = {x. \<exists> y. ?p x y = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = {x. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = {x. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
A = fn_to_set p_a
[PROOF STEP]
have S10: "A = {x. \<exists> y. p_a x y = 0}"
[PROOF STATE]
proof (prove)
using this:
A = fn_to_set p_a

goal (1 subgoal):
 1. A = {x. \<exists>y. p_a x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
A = {x. \<exists>y. p_a x y = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
from S6
[PROOF STATE]
proof (chain)
picking this:
B = fn_to_set p_b
[PROOF STEP]
have S11: "B = {x. \<exists> y. p_b x y = 0}"
[PROOF STATE]
proof (prove)
using this:
B = fn_to_set p_b

goal (1 subgoal):
 1. B = {x. \<exists>y. p_b x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
B = {x. \<exists>y. p_b x y = 0}

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
from S10 S11 S9 S8
[PROOF STATE]
proof (chain)
picking this:
A = {x. \<exists>y. p_a x y = 0}
B = {x. \<exists>y. p_b x y = 0}
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = {x. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0}
\<forall>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))
[PROOF STEP]
have S12: "?C = A \<inter> B"
[PROOF STATE]
proof (prove)
using this:
A = {x. \<exists>y. p_a x y = 0}
B = {x. \<exists>y. p_b x y = 0}
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = {x. \<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0}
\<forall>x. (\<exists>y. p_a x (c_fst y) + p_b x (c_snd y) = 0) = ((\<exists>z. p_a x z = 0) \<and> (\<exists>z. p_b x z = 0))

goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = A \<inter> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = A \<inter> B

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
from S7
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> PrimRec2
[PROOF STEP]
have "?C \<in> ce_sets"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> PrimRec2

goal (1 subgoal):
 1. fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> ce_sets
[PROOF STEP]
by (auto simp add: ce_sets_def)
[PROOF STATE]
proof (state)
this:
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> ce_sets

goal (1 subgoal):
 1. \<lbrakk>A \<in> ce_sets; B \<in> ce_sets\<rbrakk> \<Longrightarrow> A \<inter> B \<in> ce_sets
[PROOF STEP]
with S12
[PROOF STATE]
proof (chain)
picking this:
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = A \<inter> B
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> ce_sets
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) = A \<inter> B
fn_to_set (\<lambda>x y. p_a x (c_fst y) + p_b x (c_snd y)) \<in> ce_sets

goal (1 subgoal):
 1. A \<inter> B \<in> ce_sets
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<inter> B \<in> ce_sets

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rbt_comp_del: "rbt_comp_del = ord.rbt_del (lt_of_comp c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
fix k a b and s t :: "('a,'b)rbt"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
have
    "rbt_comp_del_from_left k t a b s = ord.rbt_del_from_left (lt_of_comp c) k t a b s"
    "rbt_comp_del_from_right k t a b s = ord.rbt_del_from_right (lt_of_comp c) k t a b s"
    "rbt_comp_del k t = ord.rbt_del (lt_of_comp c) k t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.rbt_comp_del_from_left k t a b s = ord.rbt_del_from_left (lt_of_comp c) k t a b s &&& local.rbt_comp_del_from_right k t a b s = ord.rbt_del_from_right (lt_of_comp c) k t a b s &&& local.rbt_comp_del k t = ord.rbt_del (lt_of_comp c) k t
[PROOF STEP]
by (induct k t a b s and k t a b s and k t rule: rbt_comp_del_from_left_rbt_comp_del_from_right_rbt_comp_del.induct,
    unfold
      rbt_comp_del.simps ord.rbt_del.simps
      rbt_comp_del_from_left.simps ord.rbt_del_from_left.simps
      rbt_comp_del_from_right.simps ord.rbt_del_from_right.simps
      comparator.two_comparisons_into_case_order[OF c],
    auto split: order.split)
[PROOF STATE]
proof (state)
this:
local.rbt_comp_del_from_left k t a b s = ord.rbt_del_from_left (lt_of_comp c) k t a b s
local.rbt_comp_del_from_right k t a b s = ord.rbt_del_from_right (lt_of_comp c) k t a b s
local.rbt_comp_del k t = ord.rbt_del (lt_of_comp c) k t

goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
local.rbt_comp_del_from_left ?k65 ?t65 ?a65 ?b65 ?s65 = ord.rbt_del_from_left (lt_of_comp c) ?k65 ?t65 ?a65 ?b65 ?s65
local.rbt_comp_del_from_right ?k65 ?t65 ?a65 ?b65 ?s65 = ord.rbt_del_from_right (lt_of_comp c) ?k65 ?t65 ?a65 ?b65 ?s65
local.rbt_comp_del ?k65 ?t65 = ord.rbt_del (lt_of_comp c) ?k65 ?t65

goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
local.rbt_comp_del_from_left ?k65 ?t65 ?a65 ?b65 ?s65 = ord.rbt_del_from_left (lt_of_comp c) ?k65 ?t65 ?a65 ?b65 ?s65
local.rbt_comp_del_from_right ?k65 ?t65 ?a65 ?b65 ?s65 = ord.rbt_del_from_right (lt_of_comp c) ?k65 ?t65 ?a65 ?b65 ?s65
local.rbt_comp_del ?k65 ?t65 = ord.rbt_del (lt_of_comp c) ?k65 ?t65

goal (1 subgoal):
 1. local.rbt_comp_del = ord.rbt_del (lt_of_comp c)
[PROOF STEP]
by (intro ext)
[PROOF STATE]
proof (state)
this:
local.rbt_comp_del = ord.rbt_del (lt_of_comp c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_bi_edges_alt2:  "all_bi_edges X Y = {{x, y} | x y. x \<in> X \<and> y \<in> Y }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_bi_edges X Y = {{x, y} |x y. x \<in> X \<and> y \<in> Y}
[PROOF STEP]
unfolding all_bi_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_edge ` (X \<times> Y) = {{x, y} |x y. x \<in> X \<and> y \<in> Y}
[PROOF STEP]
proof (intro subset_antisym subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> mk_edge ` (X \<times> Y) \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> mk_edge ` (X \<times> Y) \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
assume "x \<in> mk_edge ` (X \<times> Y)"
[PROOF STATE]
proof (state)
this:
x \<in> mk_edge ` (X \<times> Y)

goal (2 subgoals):
 1. \<And>x. x \<in> mk_edge ` (X \<times> Y) \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
obtain a b where "(a, b) \<in> (X \<times> Y)" and xeq: "x = mk_edge (a, b) "
[PROOF STATE]
proof (prove)
using this:
x \<in> mk_edge ` (X \<times> Y)

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>(a, b) \<in> X \<times> Y; x = mk_edge (a, b)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a, b) \<in> X \<times> Y
x = mk_edge (a, b)

goal (2 subgoals):
 1. \<And>x. x \<in> mk_edge ` (X \<times> Y) \<Longrightarrow> x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
 2. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a, b) \<in> X \<times> Y
x = mk_edge (a, b)
[PROOF STEP]
show "x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> X \<times> Y
x = mk_edge (a, b)

goal (1 subgoal):
 1. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}

goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
assume "x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}"
[PROOF STATE]
proof (state)
this:
x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}

goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}
[PROOF STEP]
obtain a b where xeq: "x = {a, b}" and "a \<in> X" and "b \<in> Y"
[PROOF STATE]
proof (prove)
using this:
x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = {a, b}; a \<in> X; b \<in> Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = {a, b}
a \<in> X
b \<in> Y

goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = {a, b}
a \<in> X
b \<in> Y
[PROOF STEP]
have "(a, b) \<in> (X \<times> Y)"
[PROOF STATE]
proof (prove)
using this:
x = {a, b}
a \<in> X
b \<in> Y

goal (1 subgoal):
 1. (a, b) \<in> X \<times> Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, b) \<in> X \<times> Y

goal (1 subgoal):
 1. \<And>x. x \<in> {{x, y} |x y. x \<in> X \<and> y \<in> Y} \<Longrightarrow> x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a, b) \<in> X \<times> Y
[PROOF STEP]
show "x \<in> mk_edge ` (X \<times> Y)"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> X \<times> Y

goal (1 subgoal):
 1. x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
using in_mk_edge_img xeq
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> X \<times> Y
(?a, ?b) \<in> ?A \<or> (?b, ?a) \<in> ?A \<Longrightarrow> {?a, ?b} \<in> mk_edge ` ?A
x = {a, b}

goal (1 subgoal):
 1. x \<in> mk_edge ` (X \<times> Y)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x \<in> mk_edge ` (X \<times> Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicative_function_of_natD:
  "multiplicative_function (\<lambda>n. of_nat (f n) :: 'a :: {ring_char_0, comm_semiring_1}) \<Longrightarrow>
     multiplicative_function f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (\<lambda>n. of_nat (f n)) \<Longrightarrow> multiplicative_function f
[PROOF STEP]
unfolding multiplicative_function_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (f 0) = (0::'a) \<and> of_nat (f 1) = (1::'a) \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> coprime a b \<longrightarrow> of_nat (f (a * b)) = of_nat (f a) * of_nat (f b)) \<Longrightarrow> f 0 = 0 \<and> f 1 = 1 \<and> (\<forall>a b. 1 < a \<longrightarrow> 1 < b \<longrightarrow> coprime a b \<longrightarrow> f (a * b) = f a * f b)
[PROOF STEP]
by (auto simp: of_nat_mult [symmetric] of_nat_eq_1_iff simp del: of_nat_mult)


[STATEMENT]
lemma sums_diff: "f sums a \<Longrightarrow> g sums b \<Longrightarrow> (\<lambda>n. f n - g n) sums (a - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f sums a; g sums b\<rbrakk> \<Longrightarrow> (\<lambda>n. f n - g n) sums (a - b)
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> a; (\<lambda>n. sum g {..<n}) \<longlonglongrightarrow> b\<rbrakk> \<Longrightarrow> (\<lambda>n. \<Sum>n<n. f n - g n) \<longlonglongrightarrow> a - b
[PROOF STEP]
by (simp add: sum_subtractf tendsto_diff)


[STATEMENT]
lemma Inf_aform_aform_of_ivl:
  assumes "l \<le> u"
  shows "Inf_aform (aform_of_ivl l u) = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_aform (aform_of_ivl l u) = l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<le> u

goal (1 subgoal):
 1. Inf_aform (aform_of_ivl l u) = l
[PROOF STEP]
by (auto simp: Inf_aform_def aform_of_ivl_def tdev_pdevs_of_ivl abs_diff_eq1 algebra_simps)
    (metis field_sum_of_halves scaleR_add_left scaleR_one)


[STATEMENT]
lemma dim_diag_block_mat:
  "dim_row (diag_block_mat As) = sum_list (map dim_row As)" (is "?row")
  "dim_col (diag_block_mat As) = sum_list (map dim_col As)" (is "?col")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As) &&& dim_col (diag_block_mat As) = sum_list (map dim_col As)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As)
 2. dim_col (diag_block_mat As) = sum_list (map dim_col As)
[PROOF STEP]
have "?row \<and> ?col"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As) \<and> dim_col (diag_block_mat As) = sum_list (map dim_col As)
[PROOF STEP]
by (induct As, auto simp: Let_def)
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat As) = sum_list (map dim_row As) \<and> dim_col (diag_block_mat As) = sum_list (map dim_col As)

goal (2 subgoals):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As)
 2. dim_col (diag_block_mat As) = sum_list (map dim_col As)
[PROOF STEP]
thus ?row and ?col
[PROOF STATE]
proof (prove)
using this:
dim_row (diag_block_mat As) = sum_list (map dim_row As) \<and> dim_col (diag_block_mat As) = sum_list (map dim_col As)

goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As) &&& dim_col (diag_block_mat As) = sum_list (map dim_col As)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat As) = sum_list (map dim_row As)
dim_col (diag_block_mat As) = sum_list (map dim_col As)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma delete_set_none: "(map_of l)(x := None) = map_of (delete x l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_of l)(x := None) = map_of (delete x l)
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (map_of [])(x := None) = map_of (delete x [])
 2. \<And>a l. (map_of l)(x := None) = map_of (delete x l) \<Longrightarrow> (map_of (a # l))(x := None) = map_of (delete x (a # l))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (map_of [])(x := None) = map_of (delete x [])
 2. \<And>a l. (map_of l)(x := None) = map_of (delete x l) \<Longrightarrow> (map_of (a # l))(x := None) = map_of (delete x (a # l))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_of [])(x := None) = map_of (delete x [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(map_of [])(x := None) = map_of (delete x [])

goal (1 subgoal):
 1. \<And>a l. (map_of l)(x := None) = map_of (delete x l) \<Longrightarrow> (map_of (a # l))(x := None) = map_of (delete x (a # l))
[PROOF STEP]
case (Cons l ls)
[PROOF STATE]
proof (state)
this:
(map_of ls)(x := None) = map_of (delete x ls)

goal (1 subgoal):
 1. \<And>a l. (map_of l)(x := None) = map_of (delete x l) \<Longrightarrow> (map_of (a # l))(x := None) = map_of (delete x (a # l))
[PROOF STEP]
from this[symmetric]
[PROOF STATE]
proof (chain)
picking this:
map_of (delete x ls) = (map_of ls)(x := None)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map_of (delete x ls) = (map_of ls)(x := None)

goal (1 subgoal):
 1. (map_of (l # ls))(x := None) = map_of (delete x (l # ls))
[PROOF STEP]
by (cases "fst l = x") auto
[PROOF STATE]
proof (state)
this:
(map_of (l # ls))(x := None) = map_of (delete x (l # ls))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_vec_last[simp]: "dim_vec (vec_last v n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_last v n) = n
[PROOF STEP]
unfolding vec_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec n (\<lambda>i. v $ (dim_vec v - n + i))) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma vectorize_mult_scalar:
  "vectorize_poly (p \<odot> q) = MPoly_Type_Class.punit.monom_mult p 0 (vectorize_poly q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorize_poly (p \<odot> q) = MPoly_Type_Class.punit.monom_mult p 0 (vectorize_poly q)
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_vectorize_poly MPoly_Type_Class.punit.lookup_monom_mult_zero proj_mult_scalar)


[STATEMENT]
lemma dvd_prodI:
  assumes "finite A" "x \<in> A"
  shows   "f x dvd prod f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x dvd prod f A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x dvd prod f A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
x \<in> A
[PROOF STEP]
have "prod f A = f x * prod f (A - {x})"
[PROOF STATE]
proof (prove)
using this:
finite A
x \<in> A

goal (1 subgoal):
 1. prod f A = f x * prod f (A - {x})
[PROOF STEP]
by (intro prod.remove) simp_all
[PROOF STATE]
proof (state)
this:
prod f A = f x * prod f (A - {x})

goal (1 subgoal):
 1. f x dvd prod f A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prod f A = f x * prod f (A - {x})

goal (1 subgoal):
 1. f x dvd prod f A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f x dvd prod f A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_nlistsD:
  assumes "finite (nlists A n)"
  shows "finite A \<or> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<or> n = 0
[PROOF STEP]
proof(rule disjCI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
assume "n \<noteq> 0"
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
obtain n' where n: "n = Suc n'"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<And>n'. n = Suc n' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(cases n)auto
[PROOF STATE]
proof (state)
this:
n = Suc n'

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = Suc n'
[PROOF STEP]
have "A = hd ` nlists A n"
[PROOF STATE]
proof (prove)
using this:
n = Suc n'

goal (1 subgoal):
 1. A = hd ` nlists A n
[PROOF STEP]
by(auto 4 4 simp add: nlists_Suc intro: rev_image_eqI rev_bexI)
[PROOF STATE]
proof (state)
this:
A = hd ` nlists A n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A = hd ` nlists A n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
have "finite \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (hd ` nlists A n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (nlists A n)

goal (1 subgoal):
 1. finite (hd ` nlists A n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
finite (hd ` nlists A n)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> finite A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show "finite A"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quotient_eq_singleton: "equiv A r \<Longrightarrow> A // r = {B} \<Longrightarrow> B = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv A r; A // r = {B}\<rbrakk> \<Longrightarrow> B = A
[PROOF STEP]
using Union_quotient[of A r]
[PROOF STATE]
proof (prove)
using this:
equiv A r \<Longrightarrow> \<Union> (A // r) = A

goal (1 subgoal):
 1. \<lbrakk>equiv A r; A // r = {B}\<rbrakk> \<Longrightarrow> B = A
[PROOF STEP]
by auto


[STATEMENT]
lemma STAR_tan_Infinitesimal [simp]:
  assumes "x \<in> Infinitesimal"
  shows "( *f* tan) x \<approx> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*f* tan) x \<approx> x
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (*f* tan) x \<approx> x
 2. x \<noteq> 0 \<Longrightarrow> (*f* tan) x \<approx> x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (*f* tan) x \<approx> x
 2. x \<noteq> 0 \<Longrightarrow> (*f* tan) x \<approx> x
[PROOF STEP]
have "NSDERIV tan 0 :> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSDERIV tan (0::'b) :> (1::'b)
[PROOF STEP]
using DERIV_tan [of 0]
[PROOF STATE]
proof (prove)
using this:
cos (0::?'c1) \<noteq> (0::?'c1) \<Longrightarrow> (tan has_field_derivative inverse ((cos (0::?'c1))\<^sup>2)) (at (0::?'c1))

goal (1 subgoal):
 1. NSDERIV tan (0::'b) :> (1::'b)
[PROOF STEP]
by (simp add: NSDERIV_DERIV_iff)
[PROOF STATE]
proof (state)
this:
NSDERIV tan (0::?'b1) :> (1::?'b1)

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (*f* tan) x \<approx> x
 2. x \<noteq> 0 \<Longrightarrow> (*f* tan) x \<approx> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
NSDERIV tan (0::?'b1) :> (1::?'b1)
[PROOF STEP]
have "(*f* tan) x / x \<approx> 1"
[PROOF STATE]
proof (prove)
using this:
NSDERIV tan (0::?'b1) :> (1::?'b1)

goal (1 subgoal):
 1. (*f* tan) x / x \<approx> 1
[PROOF STEP]
using False NSDERIVD2 assms
[PROOF STATE]
proof (prove)
using this:
NSDERIV tan (0::?'b1) :> (1::?'b1)
x \<noteq> 0
\<lbrakk>NSDERIV ?g ?x :> ?Db; ?y \<in> Infinitesimal; ?y \<noteq> 0\<rbrakk> \<Longrightarrow> ((*f* ?g) (star_of ?x + ?y) - star_of (?g ?x)) / ?y \<approx> star_of ?Db
x \<in> Infinitesimal

goal (1 subgoal):
 1. (*f* tan) x / x \<approx> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(*f* tan) x / x \<approx> 1

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (*f* tan) x \<approx> x
 2. x \<noteq> 0 \<Longrightarrow> (*f* tan) x \<approx> x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> Infinitesimal
(*f* tan) x / x \<approx> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> Infinitesimal
(*f* tan) x / x \<approx> 1

goal (1 subgoal):
 1. (*f* tan) x \<approx> x
[PROOF STEP]
unfolding star_one_def
[PROOF STATE]
proof (prove)
using this:
x \<in> Infinitesimal
(*f* tan) x / x \<approx> star_of (1::'a)

goal (1 subgoal):
 1. (*f* tan) x \<approx> x
[PROOF STEP]
by (metis False Infinitesimal_approx Infinitesimal_ratio approx_star_of_HFinite)
[PROOF STATE]
proof (state)
this:
(*f* tan) x \<approx> x

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> (*f* tan) x \<approx> x
[PROOF STEP]
qed auto


[STATEMENT]
lemma decseq_convergent:
  fixes X :: "nat \<Rightarrow> real"
  assumes "decseq X"
    and "\<forall>i. B \<le> X i"
  obtains L where "X \<longlonglongrightarrow> L" "\<forall>i. L \<le> X i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>L. \<lbrakk>X \<longlonglongrightarrow> L; \<forall>i. L \<le> X i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof atomize_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>L. X \<longlonglongrightarrow> L \<and> (\<forall>i. L \<le> X i)
[PROOF STEP]
from decseq_bounded[OF assms] \<open>decseq X\<close> Bseq_monoseq_convergent[of X]
[PROOF STATE]
proof (chain)
picking this:
Bseq X
decseq X
\<lbrakk>Bseq X; monoseq X\<rbrakk> \<Longrightarrow> convergent X
[PROOF STEP]
obtain L where "X \<longlonglongrightarrow> L"
[PROOF STATE]
proof (prove)
using this:
Bseq X
decseq X
\<lbrakk>Bseq X; monoseq X\<rbrakk> \<Longrightarrow> convergent X

goal (1 subgoal):
 1. (\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: convergent_def monoseq_def decseq_def)
[PROOF STATE]
proof (state)
this:
X \<longlonglongrightarrow> L

goal (1 subgoal):
 1. \<exists>L. X \<longlonglongrightarrow> L \<and> (\<forall>i. L \<le> X i)
[PROOF STEP]
with \<open>decseq X\<close>
[PROOF STATE]
proof (chain)
picking this:
decseq X
X \<longlonglongrightarrow> L
[PROOF STEP]
show "\<exists>L. X \<longlonglongrightarrow> L \<and> (\<forall>i. L \<le> X i)"
[PROOF STATE]
proof (prove)
using this:
decseq X
X \<longlonglongrightarrow> L

goal (1 subgoal):
 1. \<exists>L. X \<longlonglongrightarrow> L \<and> (\<forall>i. L \<le> X i)
[PROOF STEP]
by (auto intro!: exI[of _ L] decseq_ge)
[PROOF STATE]
proof (state)
this:
\<exists>L. X \<longlonglongrightarrow> L \<and> (\<forall>i. L \<le> X i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_diff[simp]:
shows "|A - B| \<le>o |A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A - B| \<le>o |A|
[PROOF STEP]
using inj_on_id[of "A - B"] card_of_ordLeq[of "A - B" _]
[PROOF STATE]
proof (prove)
using this:
inj_on id (A - B)
(\<exists>f. inj_on f (A - B) \<and> f ` (A - B) \<subseteq> ?B) = (|A - B| \<le>o |?B|)

goal (1 subgoal):
 1. |A - B| \<le>o |A|
[PROOF STEP]
by fastforce


[STATEMENT]
lemma permutes_vimage: "f permutes A \<Longrightarrow> f -` A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f permutes A \<Longrightarrow> f -` A = A
[PROOF STEP]
by (simp add: bij_vimage_eq_inv_image permutes_bij permutes_image[OF permutes_inv])


[STATEMENT]
lemma fps_of_ratfps_divide [simp]:
  "fps_of_ratfps (f div g) = fps_of_ratfps f div fps_of_ratfps g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_ratfps (f / g) = fps_of_ratfps f / fps_of_ratfps g
[PROOF STEP]
unfolding fps_divide_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_ratfps (f / g) = fps_shift (subdegree (fps_of_ratfps g)) (fps_of_ratfps f * inverse (unit_factor (fps_of_ratfps g)))
[PROOF STEP]
by transfer' (simp add: Let_def ratfps_subdegree_altdef)


[STATEMENT]
lemma preprm_apply_composition:
  shows "preprm_apply (preprm_compose f g) x = preprm_apply f (preprm_apply g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. preprm_apply (preprm_compose f g) x = preprm_apply f (preprm_apply g x)
[PROOF STEP]
unfolding preprm_compose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. preprm_apply (f @ g) x = preprm_apply f (preprm_apply g x)
[PROOF STEP]
by(induction f, simp_all)


[STATEMENT]
lemma suf_comp_or: "u \<bowtie>\<^sub>s v \<longleftrightarrow> u \<le>s v \<or> v \<le>s u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<bowtie>\<^sub>s v) = (u \<le>s v \<or> v \<le>s u)
[PROOF STEP]
unfolding suffix_comparable_def prefix_comparable_def suf_rev_pref_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rev u \<le>p rev v \<or> rev v \<le>p rev u) = (rev u \<le>p rev v \<or> rev v \<le>p rev u)
[PROOF STEP]
..


[STATEMENT]
lemma subtensor0:
assumes "ds \<noteq> []" and "i<hd ds"
shows "subtensor (tensor0 ds) i = tensor0 (tl ds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtensor (tensor0 ds) i = tensor0 (tl ds)
[PROOF STEP]
proof (rule tensor_lookup_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dims (subtensor (tensor0 ds) i) = dims (tensor0 (tl ds))
 2. \<And>is. is \<lhd> dims (subtensor (tensor0 ds) i) \<Longrightarrow> lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
show 1:"dims (subtensor (tensor0 ds) i) = dims (tensor0 (tl ds))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (subtensor (tensor0 ds) i) = dims (tensor0 (tl ds))
[PROOF STEP]
by (simp add: assms(1) assms(2))
[PROOF STATE]
proof (state)
this:
dims (subtensor (tensor0 ds) i) = dims (tensor0 (tl ds))

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (subtensor (tensor0 ds) i) \<Longrightarrow> lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
fix "is"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (subtensor (tensor0 ds) i) \<Longrightarrow> lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
assume "is \<lhd> dims (subtensor (tensor0 ds) i)"
[PROOF STATE]
proof (state)
this:
is \<lhd> dims (subtensor (tensor0 ds) i)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (subtensor (tensor0 ds) i) \<Longrightarrow> lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> dims (subtensor (tensor0 ds) i)
[PROOF STEP]
have "i # is \<lhd> dims (tensor0 ds)"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (subtensor (tensor0 ds) i)

goal (1 subgoal):
 1. i # is \<lhd> dims (tensor0 ds)
[PROOF STEP]
using assms(1) assms(2) valid_index.Cons
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (subtensor (tensor0 ds) i)
ds \<noteq> []
i < hd ds
\<lbrakk>?is \<lhd> ?ds; ?i < ?d\<rbrakk> \<Longrightarrow> ?i # ?is \<lhd> ?d # ?ds

goal (1 subgoal):
 1. i # is \<lhd> dims (tensor0 ds)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
i # is \<lhd> dims (tensor0 ds)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (subtensor (tensor0 ds) i) \<Longrightarrow> lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i # is \<lhd> dims (tensor0 ds)
[PROOF STEP]
show "lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is"
[PROOF STATE]
proof (prove)
using this:
i # is \<lhd> dims (tensor0 ds)

goal (1 subgoal):
 1. lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
using lookup_subtensor1  1 \<open>is \<lhd> dims (subtensor (tensor0 ds) i)\<close> dims_tensor0 lookup_tensor0
[PROOF STATE]
proof (prove)
using this:
i # is \<lhd> dims (tensor0 ds)
?i # ?is \<lhd> dims ?A \<Longrightarrow> lookup (subtensor ?A ?i) ?is = lookup ?A (?i # ?is)
dims (subtensor (tensor0 ds) i) = dims (tensor0 (tl ds))
is \<lhd> dims (subtensor (tensor0 ds) i)
dims (tensor0 ?d) = ?d
?is \<lhd> ?ds \<Longrightarrow> lookup (tensor0 ?ds) ?is = (0::?'a)

goal (1 subgoal):
 1. lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
lookup (subtensor (tensor0 ds) i) is = lookup (tensor0 (tl ds)) is

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filter2_sound: "\<forall>i. i < length (fst (filter2 P as bs)) \<longrightarrow> P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)
[PROOF STEP]
proof (induct as arbitrary: bs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>bs. \<forall>i<length (fst (filter2 P [] bs)). P (fst (filter2 P [] bs) ! i) (snd (filter2 P [] bs) ! i)
 2. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>bs. \<forall>i<length (fst (filter2 P [] bs)). P (fst (filter2 P [] bs) ! i) (snd (filter2 P [] bs) ! i)
 2. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P [] bs)). P (fst (filter2 P [] bs) ! i) (snd (filter2 P [] bs) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P [] bs)). P (fst (filter2 P [] bs) ! i) (snd (filter2 P [] bs) ! i)

goal (1 subgoal):
 1. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
case (Cons a as)
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)

goal (1 subgoal):
 1. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
note IH = this
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)

goal (1 subgoal):
 1. \<And>a as bs. (\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i)) \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)

goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
proof (cases bs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = []\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
 2. \<And>aa list. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = aa # list\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
bs = []

goal (2 subgoals):
 1. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = []\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
 2. \<And>aa list. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = aa # list\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bs = []

goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)

goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = aa # list\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bs = aa # list\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)
[PROOF STEP]
case (Cons b bs)
[PROOF STATE]
proof (state)
this:
bsa__ = b # bs

goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<And>bs. \<forall>i<length (fst (filter2 P as bs)). P (fst (filter2 P as bs) ! i) (snd (filter2 P as bs) ! i); bsa__ = aa # list\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bsa__ = b # bs

goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
proof (cases "P a b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
 2. \<lbrakk>bsa__ = b # bs; \<not> P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> P a b

goal (2 subgoals):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
 2. \<lbrakk>bsa__ = b # bs; \<not> P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
with Cons and IH
[PROOF STATE]
proof (chain)
picking this:
bsa__ = b # bs
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)
\<not> P a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bsa__ = b # bs
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)
\<not> P a b

goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P a b

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
P a b

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
assume i_bd: "i < length (fst (filter2 P (a # as) (b # bs)))"
[PROOF STATE]
proof (state)
this:
i < length (fst (filter2 P (a # as) (b # bs)))

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
have "P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
 2. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
 2. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
P a b
i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P a b
i = 0

goal (1 subgoal):
 1. P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
i = Suc j

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
with i_bd and True
[PROOF STATE]
proof (chain)
picking this:
i < length (fst (filter2 P (a # as) (b # bs)))
P a b
i = Suc j
[PROOF STEP]
have "j < length (fst (filter2 P as bs))"
[PROOF STATE]
proof (prove)
using this:
i < length (fst (filter2 P (a # as) (b # bs)))
P a b
i = Suc j

goal (1 subgoal):
 1. j < length (fst (filter2 P as bs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j < length (fst (filter2 P as bs))

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
with Suc and IH and True
[PROOF STATE]
proof (chain)
picking this:
i = Suc j
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)
P a b
j < length (fst (filter2 P as bs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i = Suc j
\<forall>i<length (fst (filter2 P as ?bs)). P (fst (filter2 P as ?bs) ! i) (snd (filter2 P as ?bs) ! i)
P a b
j < length (fst (filter2 P as bs))

goal (1 subgoal):
 1. P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P (fst (filter2 P (a # as) (b # bs)) ! i) (snd (filter2 P (a # as) (b # bs)) ! i)

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < length (fst (filter2 P (a # as) (b # bs))) \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! ?i2) (snd (filter2 P (a # as) (b # bs)) ! ?i2)

goal (1 subgoal):
 1. \<lbrakk>bsa__ = b # bs; P a b\<rbrakk> \<Longrightarrow> \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
bsa__ = b # bs
?i2 < length (fst (filter2 P (a # as) (b # bs))) \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! ?i2) (snd (filter2 P (a # as) (b # bs)) ! ?i2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bsa__ = b # bs
?i2 < length (fst (filter2 P (a # as) (b # bs))) \<Longrightarrow> P (fst (filter2 P (a # as) (b # bs)) ! ?i2) (snd (filter2 P (a # as) (b # bs)) ! ?i2)

goal (1 subgoal):
 1. \<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P (a # as) bsa__)). P (fst (filter2 P (a # as) bsa__) ! i) (snd (filter2 P (a # as) bsa__) ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<length (fst (filter2 P (a # as) bs)). P (fst (filter2 P (a # as) bs) ! i) (snd (filter2 P (a # as) bs) ! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llength_mono [iff]:
  assumes"r \<in> A\<^sup>\<star>"
  shows "s<r \<Longrightarrow> llength s < llength r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s < r \<Longrightarrow> LList2.llength s < LList2.llength r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r \<in> A\<^sup>\<star>

goal (1 subgoal):
 1. s < r \<Longrightarrow> LList2.llength s < LList2.llength r
[PROOF STEP]
proof(induct "r" arbitrary: s)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l s. \<lbrakk>l = LNil; s < l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength l
 2. \<And>a l s. \<lbrakk>l \<in> A\<^sup>\<star>; \<And>s. s < l \<Longrightarrow> LList2.llength s < LList2.llength l; a \<in> A; s < a ## l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
case LNil_fin
[PROOF STATE]
proof (state)
this:
l_ = LNil
s < l_

goal (2 subgoals):
 1. \<And>l s. \<lbrakk>l = LNil; s < l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength l
 2. \<And>a l s. \<lbrakk>l \<in> A\<^sup>\<star>; \<And>s. s < l \<Longrightarrow> LList2.llength s < LList2.llength l; a \<in> A; s < a ## l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
l_ = LNil
s < l_

goal (1 subgoal):
 1. LList2.llength s < LList2.llength l_
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LList2.llength s < LList2.llength l_

goal (1 subgoal):
 1. \<And>a l s. \<lbrakk>l \<in> A\<^sup>\<star>; \<And>s. s < l \<Longrightarrow> LList2.llength s < LList2.llength l; a \<in> A; s < a ## l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l s. \<lbrakk>l \<in> A\<^sup>\<star>; \<And>s. s < l \<Longrightarrow> LList2.llength s < LList2.llength l; a \<in> A; s < a ## l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
case (LCons_fin a l)
[PROOF STATE]
proof (state)
this:
l \<in> A\<^sup>\<star>
?s < l \<Longrightarrow> LList2.llength ?s < LList2.llength l
a \<in> A
s < a ## l

goal (1 subgoal):
 1. \<And>a l s. \<lbrakk>l \<in> A\<^sup>\<star>; \<And>s. s < l \<Longrightarrow> LList2.llength s < LList2.llength l; a \<in> A; s < a ## l\<rbrakk> \<Longrightarrow> LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
l \<in> A\<^sup>\<star>
?s < l \<Longrightarrow> LList2.llength ?s < LList2.llength l
a \<in> A
s < a ## l

goal (1 subgoal):
 1. LList2.llength s < LList2.llength (a ## l)
[PROOF STEP]
by (cases s) (auto simp: llength_LCons [of _ UNIV])
[PROOF STATE]
proof (state)
this:
LList2.llength s < LList2.llength (a ## l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permut_aux_length:
  assumes "bij_betw f {..<length as} {..<length bs}"
  shows "length (permut_aux as f bs) = length as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (permut_aux as f bs) = length as
[PROOF STEP]
by (induct as arbitrary: f bs, simp_all)