[STATEMENT]
lemma vert_connected_n_rev: "vert_connected_n u v n \<longleftrightarrow> vert_connected_n v u n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vert_connected_n u v n = vert_connected_n v u n
[PROOF STEP]
unfolding vert_connected_n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>p. connecting_path u v p \<and> walk_length p = n) = (\<exists>p. connecting_path v u p \<and> walk_length p = n)
[PROOF STEP]
using  walk_length_rev
[PROOF STATE]
proof (prove)
using this:
walk_length ?p = walk_length (rev ?p)

goal (1 subgoal):
 1. (\<exists>p. connecting_path u v p \<and> walk_length p = n) = (\<exists>p. connecting_path v u p \<and> walk_length p = n)
[PROOF STEP]
by (metis connecting_path_rev)


[STATEMENT]
lemma strict_sorted_interact_hd:
  "\<lbrakk>strict_sorted (interact cs ds); cs \<noteq> []; ds \<noteq> []; hd cs \<noteq> []; hd ds \<noteq> []\<rbrakk>
       \<Longrightarrow> hd (hd cs) < hd (hd ds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>strict_sorted (interact cs ds); cs \<noteq> []; ds \<noteq> []; hd cs \<noteq> []; hd ds \<noteq> []\<rbrakk> \<Longrightarrow> hd (hd cs) < hd (hd ds)
[PROOF STEP]
by (metis append_is_Nil_conv hd_append2 hd_in_set interact.simps(3) list.exhaust_sel sorted_wrt_append)


[STATEMENT]
lemma ceiling_neg_numeral [simp]: "\<lceil>- numeral v\<rceil> = - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>- numeral v\<rceil> = - numeral v
[PROOF STEP]
using ceiling_of_int [of "- numeral v"]
[PROOF STATE]
proof (prove)
using this:
\<lceil>of_int (- numeral v)\<rceil> = - numeral v

goal (1 subgoal):
 1. \<lceil>- numeral v\<rceil> = - numeral v
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_prod_fun:
  fixes f1 f2 :: "'a :: monoid_add \<Rightarrow> 'b :: semiring_0"
  assumes fin1: "finite {l. f1 l \<noteq> 0}"
  and fin2: "finite {q. f2 q \<noteq> 0}"
  shows "finite {k. prod_fun f1 f2 k \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
have *: "finite {k. (\<exists>l. f1 l \<noteq> 0 \<and> (\<exists>q. f2 q \<noteq> 0 \<and> k = l + q))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite {l. f1 l \<noteq> (0::'b)}
finite {q. f2 q \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
fix k l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
have "{q. (f2 q when k = l + q) \<noteq> 0} \<subseteq> {q. f2 q \<noteq> 0 \<and> k = l + q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q. (f2 q when k = l + q) \<noteq> (0::'b)} \<subseteq> {q. f2 q \<noteq> (0::'b) \<and> k = l + q}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{q. (f2 q when k = l + q) \<noteq> (0::'b)} \<subseteq> {q. f2 q \<noteq> (0::'b) \<and> k = l + q}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
with fin2
[PROOF STATE]
proof (chain)
picking this:
finite {q. f2 q \<noteq> (0::'b)}
{q. (f2 q when k = l + q) \<noteq> (0::'b)} \<subseteq> {q. f2 q \<noteq> (0::'b) \<and> k = l + q}
[PROOF STEP]
have "sum f2 {q. f2 q \<noteq> 0 \<and> k = l + q} = (\<Sum>q. (f2 q when k = l + q))"
[PROOF STATE]
proof (prove)
using this:
finite {q. f2 q \<noteq> (0::'b)}
{q. (f2 q when k = l + q) \<noteq> (0::'b)} \<subseteq> {q. f2 q \<noteq> (0::'b) \<and> k = l + q}

goal (1 subgoal):
 1. sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} = (\<Sum>q. f2 q when k = l + q)
[PROOF STEP]
by (simp add: Sum_any.expand_superset [of "{q. f2 q \<noteq> 0 \<and> k = l + q}"])
[PROOF STATE]
proof (state)
this:
sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} = (\<Sum>q. f2 q when k = l + q)

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
sum f2 {q. f2 q \<noteq> (0::'b) \<and> ?k2 = ?l2 + q} = (\<Sum>q. f2 q when ?k2 = ?l2 + q)

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
note aux = this
[PROOF STATE]
proof (state)
this:
sum f2 {q. f2 q \<noteq> (0::'b) \<and> ?k2 = ?l2 + q} = (\<Sum>q. f2 q when ?k2 = ?l2 + q)

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
have "{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> 0 \<and> k = l + q}) \<noteq> 0}
    \<subseteq> {k. (\<exists>l. f1 l * sum f2 {q. f2 q \<noteq> 0 \<and> k = l + q} \<noteq> 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}
[PROOF STEP]
by (auto elim!: Sum_any.not_neutral_obtains_not_neutral)
[PROOF STATE]
proof (state)
this:
{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
have "\<dots> \<subseteq> {k. (\<exists>l. f1 l \<noteq> 0 \<and> sum f2 {q. f2 q \<noteq> 0 \<and> k = l + q} \<noteq> 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}
[PROOF STEP]
by (auto dest: mult_not_zero)
[PROOF STATE]
proof (state)
this:
{k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{k. \<exists>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
have "\<dots> \<subseteq> {k. (\<exists>l. f1 l \<noteq> 0 \<and> (\<exists>q. f2 q \<noteq> 0 \<and> k = l + q))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}
[PROOF STEP]
by (auto elim!: sum.not_neutral_contains_not_neutral)
[PROOF STATE]
proof (state)
this:
{k. \<exists>l. f1 l \<noteq> (0::'b) \<and> sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q} \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}
[PROOF STEP]
have "finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> 0 \<and> k = l + q}) \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}

goal (1 subgoal):
 1. finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)}
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
{k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)} \<subseteq> {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}
finite {k. \<exists>l. f1 l \<noteq> (0::'b) \<and> (\<exists>q. f2 q \<noteq> (0::'b) \<and> k = l + q)}

goal (1 subgoal):
 1. finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
with aux
[PROOF STATE]
proof (chain)
picking this:
sum f2 {q. f2 q \<noteq> (0::'b) \<and> ?k2 = ?l2 + q} = (\<Sum>q. f2 q when ?k2 = ?l2 + q)
finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)}
[PROOF STEP]
have "finite {k. (\<Sum>l. f1 l * (\<Sum>q. (f2 q when k = l + q))) \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
sum f2 {q. f2 q \<noteq> (0::'b) \<and> ?k2 = ?l2 + q} = (\<Sum>q. f2 q when ?k2 = ?l2 + q)
finite {k. (\<Sum>l. f1 l * sum f2 {q. f2 q \<noteq> (0::'b) \<and> k = l + q}) \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. (\<Sum>l. f1 l * (\<Sum>q. f2 q when k = l + q)) \<noteq> (0::'b)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {k. (\<Sum>l. f1 l * (\<Sum>q. f2 q when k = l + q)) \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
with fin2
[PROOF STATE]
proof (chain)
picking this:
finite {q. f2 q \<noteq> (0::'b)}
finite {k. (\<Sum>l. f1 l * (\<Sum>q. f2 q when k = l + q)) \<noteq> (0::'b)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {q. f2 q \<noteq> (0::'b)}
finite {k. (\<Sum>l. f1 l * (\<Sum>q. f2 q when k = l + q)) \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}
[PROOF STEP]
by (simp add: prod_fun_def)
[PROOF STATE]
proof (state)
this:
finite {k. prod_fun f1 f2 k \<noteq> (0::'b)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cone_mono_2:
  assumes "U1 \<subseteq> U2"
  shows "cone (h, U1) \<subseteq> cone (h, U2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cone (h, U1) \<subseteq> cone (h, U2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
U1 \<subseteq> U2
[PROOF STEP]
have "P[U1] \<subseteq> P[U2]"
[PROOF STATE]
proof (prove)
using this:
U1 \<subseteq> U2

goal (1 subgoal):
 1. P[U1] \<subseteq> P[U2]
[PROOF STEP]
by (rule Polys_mono)
[PROOF STATE]
proof (state)
this:
P[U1] \<subseteq> P[U2]

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
assume "p \<in> cone (h, U1)"
[PROOF STATE]
proof (state)
this:
p \<in> cone (h, U1)

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> cone (h, U1)
[PROOF STEP]
obtain a where "a \<in> P[U1]" and "p = a * h"
[PROOF STATE]
proof (prove)
using this:
p \<in> cone (h, U1)

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> P[U1]; p = a * h\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule coneE)
[PROOF STATE]
proof (state)
this:
a \<in> P[U1]
p = a * h

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
note this(2)
[PROOF STATE]
proof (state)
this:
p = a * h

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p = a * h

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
from \<open>a \<in> P[U1]\<close> \<open>P[U1] \<subseteq> P[U2]\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> P[U1]
P[U1] \<subseteq> P[U2]
[PROOF STEP]
have "a \<in> P[U2]"
[PROOF STATE]
proof (prove)
using this:
a \<in> P[U1]
P[U1] \<subseteq> P[U2]

goal (1 subgoal):
 1. a \<in> P[U2]
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a \<in> P[U2]

goal (1 subgoal):
 1. \<And>x. x \<in> cone (h, U1) \<Longrightarrow> x \<in> cone (h, U2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p = a * h
a \<in> P[U2]
[PROOF STEP]
show "p \<in> cone (h, U2)"
[PROOF STATE]
proof (prove)
using this:
p = a * h
a \<in> P[U2]

goal (1 subgoal):
 1. p \<in> cone (h, U2)
[PROOF STEP]
by (rule coneI)
[PROOF STATE]
proof (state)
this:
p \<in> cone (h, U2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rats_eq_int_div_int: "\<rat> = {real_of_int i / real_of_int j | i j. j \<noteq> 0}"  (is "_ = ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> = {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
 2. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
show "\<rat> \<subseteq> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
assume "x \<in> \<rat>"
[PROOF STATE]
proof (state)
this:
x \<in> \<rat>

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<rat>
[PROOF STEP]
obtain r where "x = of_rat r"
[PROOF STATE]
proof (prove)
using this:
x \<in> \<rat>

goal (1 subgoal):
 1. (\<And>r. x = real_of_rat r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Rats_def
[PROOF STATE]
proof (prove)
using this:
x \<in> range real_of_rat

goal (1 subgoal):
 1. (\<And>r. x = real_of_rat r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x = real_of_rat r

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
have "of_rat r \<in> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
by (cases r) (auto simp add: of_rat_rat)
[PROOF STATE]
proof (state)
this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
show "x \<in> ?S"
[PROOF STATE]
proof (prove)
using this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
using \<open>x = of_rat r\<close>
[PROOF STATE]
proof (prove)
using this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
x = real_of_rat r

goal (1 subgoal):
 1. x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
show "?S \<subseteq> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
proof (auto simp: Rats_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
fix i j :: int
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
assume "j \<noteq> 0"
[PROOF STATE]
proof (state)
this:
j \<noteq> 0

goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> 0
[PROOF STEP]
have "real_of_int i / real_of_int j = of_rat (Fract i j)"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0

goal (1 subgoal):
 1. real_of_int i / real_of_int j = real_of_rat (Fract i j)
[PROOF STEP]
by (simp add: of_rat_rat)
[PROOF STATE]
proof (state)
this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)

goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)
[PROOF STEP]
show "real_of_int i / real_of_int j \<in> range of_rat"
[PROOF STATE]
proof (prove)
using this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)

goal (1 subgoal):
 1. real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_int i / real_of_int j \<in> range real_of_rat

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poincare_distance_satisfies_pred [simp]:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc"
  shows "poincare_distance_pred u v (poincare_distance u v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance_pred u v (poincare_distance u v)
[PROOF STEP]
using distance_unique[OF assms] theI'[of "poincare_distance_pred u v"]
[PROOF STATE]
proof (prove)
using this:
\<exists>!d. poincare_distance_pred u v d
\<exists>!x. poincare_distance_pred u v x \<Longrightarrow> poincare_distance_pred u v (THE x. poincare_distance_pred u v x)

goal (1 subgoal):
 1. poincare_distance_pred u v (poincare_distance u v)
[PROOF STEP]
unfolding poincare_distance_def
[PROOF STATE]
proof (prove)
using this:
\<exists>!d. poincare_distance_pred u v d
\<exists>!x. poincare_distance_pred u v x \<Longrightarrow> poincare_distance_pred u v (THE x. poincare_distance_pred u v x)

goal (1 subgoal):
 1. poincare_distance_pred u v (The (poincare_distance_pred u v))
[PROOF STEP]
by blast


[STATEMENT]
lemma Lambert_W_neg_ln_over_self:
  assumes "x \<in> {exp (-1)..exp 1}"
  shows   "Lambert_W (-ln x / x) = -ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
have "0 < (exp (-1) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < exp (- 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < exp (- 1)

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < exp (- 1)

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- 1) \<le> x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> {exp (- 1)..exp 1}

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

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
from \<open>x > 0\<close> assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
x \<in> {exp (- 1)..exp 1}
[PROOF STEP]
have "ln x \<le> ln (exp 1)"
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<in> {exp (- 1)..exp 1}

goal (1 subgoal):
 1. ln x \<le> ln (exp 1)
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln x \<le> ln (exp 1)

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln x \<le> ln (exp 1)

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
have "ln (exp 1) = (1 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (exp 1) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (exp 1) = 1

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln x \<le> 1
[PROOF STEP]
have "ln x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
ln x \<le> 1

goal (1 subgoal):
 1. ln x \<le> 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln x \<le> 1

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
using assms \<open>x > 0\<close> \<open>ln x \<le> 1\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> {exp (- 1)..exp 1}
0 < x
ln x \<le> 1

goal (1 subgoal):
 1. Lambert_W (- ln x / x) = - ln x
[PROOF STEP]
by (intro Lambert_W_eqI) (auto simp: exp_minus field_simps)
[PROOF STATE]
proof (state)
this:
Lambert_W (- ln x / x) = - ln x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_less_one:
  assumes "n > 0" "x \<ge> 0" "x < 1"
  shows   "x ^ n < (1::'a::linordered_semidom)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n < (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ n < (1::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
(0::'a) \<le> x
x < (1::'a)
[PROOF STEP]
consider "x > 0" | "x = 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
(0::'a) \<le> x
x < (1::'a)

goal (1 subgoal):
 1. \<lbrakk>(0::'a) < x \<Longrightarrow> thesis; x = (0::'a) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<lbrakk>(0::'a) < x \<Longrightarrow> ?thesis; x = (0::'a) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. x ^ n < (1::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::'a) < x \<Longrightarrow> ?thesis; x = (0::'a) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. x ^ n < (1::'a)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0::'a) < x \<Longrightarrow> x ^ n < (1::'a)
 2. x = (0::'a) \<Longrightarrow> x ^ n < (1::'a)
[PROOF STEP]
assume "x > 0"
[PROOF STATE]
proof (state)
this:
(0::'a) < x

goal (2 subgoals):
 1. (0::'a) < x \<Longrightarrow> x ^ n < (1::'a)
 2. x = (0::'a) \<Longrightarrow> x ^ n < (1::'a)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
(0::'a) \<le> x
x < (1::'a)
(0::'a) < x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
(0::'a) \<le> x
x < (1::'a)
(0::'a) < x

goal (1 subgoal):
 1. x ^ n < (1::'a)
[PROOF STEP]
by (cases n) (simp, hypsubst, rule power_Suc_less_one)
[PROOF STATE]
proof (state)
this:
x ^ n < (1::'a)

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> x ^ n < (1::'a)
[PROOF STEP]
qed (insert assms, cases n, simp_all)
[PROOF STATE]
proof (state)
this:
x ^ n < (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_eq_Sum:
  assumes "inj_on f A"
  shows "(\<Sum>x\<in>A. f x) = (\<Sum> {f x |x. x \<in> A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
have "(\<Sum> {f x |x. x \<in> A}) = (\<Sum> (f ` A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {f x |x. x \<in> A} = \<Sum> (f ` A)
[PROOF STEP]
apply(auto simp: image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {f x |x. x \<in> A} = \<Sum> {y. \<exists>x\<in>A. y = f x}
[PROOF STEP]
by (rule_tac f=Sum in arg_cong, auto)
[PROOF STATE]
proof (state)
this:
\<Sum> {f x |x. x \<in> A} = \<Sum> (f ` A)

goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum> {f x |x. x \<in> A} = \<Sum> (f ` A)

goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
have "... = (\<Sum>x\<in>A. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> (f ` A) = sum f A
[PROOF STEP]
by (subst sum.image_eq[OF assms], simp)
[PROOF STATE]
proof (state)
this:
\<Sum> (f ` A) = sum f A

goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sum> {f x |x. x \<in> A} = sum f A
[PROOF STEP]
show "(\<Sum>x\<in>A. f x) = (\<Sum> {f x |x. x \<in> A})"
[PROOF STATE]
proof (prove)
using this:
\<Sum> {f x |x. x \<in> A} = sum f A

goal (1 subgoal):
 1. sum f A = \<Sum> {f x |x. x \<in> A}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f A = \<Sum> {f x |x. x \<in> A}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fae_vimage_singleton: "finite (f -` {x}) \<longleftrightarrow> finite (g -` {x})" if "finite {n. f n \<noteq> g n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (f -` {x}) = finite (g -` {x})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
 2. finite (g -` {x}) \<Longrightarrow> finite (f -` {x})
[PROOF STEP]
assume *: "finite (g -` {x})"
[PROOF STATE]
proof (state)
this:
finite (g -` {x})

goal (2 subgoals):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
 2. finite (g -` {x}) \<Longrightarrow> finite (f -` {x})
[PROOF STEP]
have "f -` {x} \<subseteq> g -` {x} \<union> {n. f n \<noteq> g n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` {x} \<subseteq> g -` {x} \<union> {n. f n \<noteq> g n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f -` {x} \<subseteq> g -` {x} \<union> {n. f n \<noteq> g n}

goal (2 subgoals):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
 2. finite (g -` {x}) \<Longrightarrow> finite (f -` {x})
[PROOF STEP]
thus "finite (f -` {x})"
[PROOF STATE]
proof (prove)
using this:
f -` {x} \<subseteq> g -` {x} \<union> {n. f n \<noteq> g n}

goal (1 subgoal):
 1. finite (f -` {x})
[PROOF STEP]
by(rule finite_subset)(use that * in auto)
[PROOF STATE]
proof (state)
this:
finite (f -` {x})

goal (1 subgoal):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
[PROOF STEP]
assume *: "finite (f -` {x})"
[PROOF STATE]
proof (state)
this:
finite (f -` {x})

goal (1 subgoal):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
[PROOF STEP]
have "g -` {x} \<subseteq> f -` {x} \<union> {n. f n \<noteq> g n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g -` {x} \<subseteq> f -` {x} \<union> {n. f n \<noteq> g n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g -` {x} \<subseteq> f -` {x} \<union> {n. f n \<noteq> g n}

goal (1 subgoal):
 1. finite (f -` {x}) \<Longrightarrow> finite (g -` {x})
[PROOF STEP]
thus "finite (g -` {x})"
[PROOF STATE]
proof (prove)
using this:
g -` {x} \<subseteq> f -` {x} \<union> {n. f n \<noteq> g n}

goal (1 subgoal):
 1. finite (g -` {x})
[PROOF STEP]
by(rule finite_subset)(use that * in auto)
[PROOF STATE]
proof (state)
this:
finite (g -` {x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcs_leq_fun:
  assumes "s \<le> u" and "t \<le> (u::'a \<Rightarrow> 'b::add_linorder)"
  shows "(lcs s t) \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcs s t \<le> u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<le> u
t \<le> u

goal (1 subgoal):
 1. lcs s t \<le> u
[PROOF STEP]
by (simp add: lcs_fun_def le_fun_def)


[STATEMENT]
lemma rtrancl3p_trans [trans]:
  assumes one: "rtrancl3p r a bs a'"
  and two: "rtrancl3p r a' bs' a''"
  shows "rtrancl3p r a (bs @ bs') a''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rtrancl3p r a (bs @ bs') a''
[PROOF STEP]
using two one
[PROOF STATE]
proof (prove)
using this:
rtrancl3p r a' bs' a''
rtrancl3p r a bs a'

goal (1 subgoal):
 1. rtrancl3p r a (bs @ bs') a''
[PROOF STEP]
proof(induct rule: rtrancl3p.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>aa. rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ []) aa
 2. \<And>aa bsa a' b a''. \<lbrakk>rtrancl3p r aa bsa a'; rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ bsa) a'; r a' b a''; rtrancl3p r a bs aa\<rbrakk> \<Longrightarrow> rtrancl3p r a (bs @ bsa @ [b]) a''
[PROOF STEP]
case rtrancl3p_refl
[PROOF STATE]
proof (state)
this:
rtrancl3p r a bs a_

goal (2 subgoals):
 1. \<And>aa. rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ []) aa
 2. \<And>aa bsa a' b a''. \<lbrakk>rtrancl3p r aa bsa a'; rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ bsa) a'; r a' b a''; rtrancl3p r a bs aa\<rbrakk> \<Longrightarrow> rtrancl3p r a (bs @ bsa @ [b]) a''
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
rtrancl3p r a bs a_

goal (1 subgoal):
 1. rtrancl3p r a (bs @ []) a_
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rtrancl3p r a (bs @ []) a_

goal (1 subgoal):
 1. \<And>aa bsa a' b a''. \<lbrakk>rtrancl3p r aa bsa a'; rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ bsa) a'; r a' b a''; rtrancl3p r a bs aa\<rbrakk> \<Longrightarrow> rtrancl3p r a (bs @ bsa @ [b]) a''
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa bsa a' b a''. \<lbrakk>rtrancl3p r aa bsa a'; rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ bsa) a'; r a' b a''; rtrancl3p r a bs aa\<rbrakk> \<Longrightarrow> rtrancl3p r a (bs @ bsa @ [b]) a''
[PROOF STEP]
case rtrancl3p_step
[PROOF STATE]
proof (state)
this:
rtrancl3p r a_ bs_ a'_
rtrancl3p r a bs a_ \<Longrightarrow> rtrancl3p r a (bs @ bs_) a'_
r a'_ b_ a''_
rtrancl3p r a bs a_

goal (1 subgoal):
 1. \<And>aa bsa a' b a''. \<lbrakk>rtrancl3p r aa bsa a'; rtrancl3p r a bs aa \<Longrightarrow> rtrancl3p r a (bs @ bsa) a'; r a' b a''; rtrancl3p r a bs aa\<rbrakk> \<Longrightarrow> rtrancl3p r a (bs @ bsa @ [b]) a''
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
rtrancl3p r a_ bs_ a'_
rtrancl3p r a bs a_ \<Longrightarrow> rtrancl3p r a (bs @ bs_) a'_
r a'_ b_ a''_
rtrancl3p r a bs a_

goal (1 subgoal):
 1. rtrancl3p r a (bs @ bs_ @ [b_]) a''_
[PROOF STEP]
by(auto simp only: append_assoc[symmetric] intro: rtrancl3p.rtrancl3p_step)
[PROOF STATE]
proof (state)
this:
rtrancl3p r a (bs @ bs_ @ [b_]) a''_

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cancel_suffix:
  assumes "a @ c = b @ d"
  assumes "length c \<le> length d"
  shows "a = b @ (take (length d - length c) d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b @ take (length d - length c) d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = b @ take (length d - length c) d
[PROOF STEP]
have "a @ c = (b @ take (length d - length c) d) @ drop (length d - length c) d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a @ c = (b @ take (length d - length c) d) @ drop (length d - length c) d
[PROOF STEP]
by (metis append_assoc append_take_drop_id assms(1))
[PROOF STATE]
proof (state)
this:
a @ c = (b @ take (length d - length c) d) @ drop (length d - length c) d

goal (1 subgoal):
 1. a = b @ take (length d - length c) d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a @ c = (b @ take (length d - length c) d) @ drop (length d - length c) d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a @ c = (b @ take (length d - length c) d) @ drop (length d - length c) d

goal (1 subgoal):
 1. a = b @ take (length d - length c) d
[PROOF STEP]
by (metis append_eq_append_conv assms(2) diff_diff_cancel length_drop)
[PROOF STATE]
proof (state)
this:
a = b @ take (length d - length c) d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_cruel: "s \<noteq> [] \<Longrightarrow> set(cruel A (s,is) n) \<subseteq> set s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<noteq> [] \<Longrightarrow> set (cruel A (s, is) n) \<subseteq> set s
[PROOF STEP]
apply(induction n arbitrary: s "is")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s is. s \<noteq> [] \<Longrightarrow> set (cruel A (s, is) 0) \<subseteq> set s
 2. \<And>n s is. \<lbrakk>\<And>s is. s \<noteq> [] \<Longrightarrow> set (cruel A (s, is) n) \<subseteq> set s; s \<noteq> []\<rbrakk> \<Longrightarrow> set (cruel A (s, is) (Suc n)) \<subseteq> set s
[PROOF STEP]
apply(auto simp: step_def Step_def split: prod.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n s is a b x2 x. \<lbrakk>\<And>s is. s \<noteq> [] \<Longrightarrow> set (cruel A (s, is) n) \<subseteq> set s; s \<noteq> []; snd A (s, is) (last s) = ((a, b), x2); x \<in> set (cruel A (mtf2 a (last s) (swaps b s), x2) n)\<rbrakk> \<Longrightarrow> x \<in> set s
[PROOF STEP]
by (metis empty_iff swaps_inv last_in_set list.set(1) rev_subsetD set_mtf2)


[STATEMENT]
lemma list_rel_range[relator_props]:
  assumes A: "Range R = UNIV"
  shows "Range (\<langle>R\<rangle>list_rel) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range (\<langle>R\<rangle>list_rel) = UNIV
[PROOF STEP]
proof (clarsimp simp: eq_UNIV_iff)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> Range (\<langle>R\<rangle>list_rel)
[PROOF STEP]
fix l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> Range (\<langle>R\<rangle>list_rel)
[PROOF STEP]
show "l\<in>Range (\<langle>R\<rangle>list_rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> Range (\<langle>R\<rangle>list_rel)
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [] \<in> Range (\<langle>R\<rangle>list_rel)
 2. \<And>a l. l \<in> Range (\<langle>R\<rangle>list_rel) \<Longrightarrow> a # l \<in> Range (\<langle>R\<rangle>list_rel)
[PROOF STEP]
using A[unfolded eq_UNIV_iff]
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> Range R

goal (2 subgoals):
 1. [] \<in> Range (\<langle>R\<rangle>list_rel)
 2. \<And>a l. l \<in> Range (\<langle>R\<rangle>list_rel) \<Longrightarrow> a # l \<in> Range (\<langle>R\<rangle>list_rel)
[PROOF STEP]
by (auto simp: Range_iff intro: list_relI)
[PROOF STATE]
proof (state)
this:
l \<in> Range (\<langle>R\<rangle>list_rel)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutation_insert_delete:
  assumes p: "p permutes {0..<Suc n}"
      and i: "i < Suc n"
  shows "permutation_insert i (p i) (permutation_delete p i) = p"
    (is "?l = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) = p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. permutation_insert i (p i) (permutation_delete p i) x = p x
[PROOF STEP]
fix i'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. permutation_insert i (p i) (permutation_delete p i) x = p x
[PROOF STEP]
show "?l i' = p i'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
proof (cases rule: linorder_cases[of "i'" "i"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. i' < i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
i' < i

goal (3 subgoals):
 1. i' < i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
note i'i = this
[PROOF STATE]
proof (state)
this:
i' < i

goal (3 subgoals):
 1. i' < i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
proof (cases "p i = p i'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p i = p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p i = p i'

goal (2 subgoals):
 1. p i = p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence "i = i'"
[PROOF STATE]
proof (prove)
using this:
p i = p i'

goal (1 subgoal):
 1. i = i'
[PROOF STEP]
using permutes_inj[OF p] injD
[PROOF STATE]
proof (prove)
using this:
p i = p i'
inj p
\<lbrakk>inj ?f; ?f ?x = ?f ?y\<rbrakk> \<Longrightarrow> ?x = ?y

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

goal (2 subgoals):
 1. p i = p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
i = i'

goal (1 subgoal):
 1. False
[PROOF STEP]
using i'i
[PROOF STATE]
proof (prove)
using this:
i = i'
i' < i

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

goal (2 subgoals):
 1. p i = p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal (1 subgoal):
 1. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p i \<noteq> p i'

goal (1 subgoal):
 1. p i \<noteq> p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p i \<noteq> p i'

goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
unfolding permutation_insert_expand permutation_delete_expand
[PROOF STATE]
proof (prove)
using this:
p i \<noteq> p i'

goal (1 subgoal):
 1. (if i' < i then if (if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0) < p i then if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0 else Suc (if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0) else if i' = i then p i else if (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) < p i then if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0 else Suc (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0)) = p i'
[PROOF STEP]
using i'i
[PROOF STATE]
proof (prove)
using this:
p i \<noteq> p i'
i' < i

goal (1 subgoal):
 1. (if i' < i then if (if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0) < p i then if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0 else Suc (if p (if i' < i then i' else Suc i') < p i then p (if i' < i then i' else Suc i') else p (if i' < i then i' else Suc i') - Suc 0) else if i' = i then p i else if (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) < p i then if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0 else Suc (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0)) = p i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal (2 subgoals):
 1. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case equal
[PROOF STATE]
proof (state)
this:
i' = i

goal (2 subgoals):
 1. i' = i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i' = i

goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
unfolding permutation_insert_expand
[PROOF STATE]
proof (prove)
using this:
i' = i

goal (1 subgoal):
 1. (if i' < i then if permutation_delete p i i' < p i then permutation_delete p i i' else Suc (permutation_delete p i i') else if i' = i then p i else if permutation_delete p i (i' - 1) < p i then permutation_delete p i (i' - 1) else Suc (permutation_delete p i (i' - 1))) = p i'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal (1 subgoal):
 1. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
i < i'

goal (1 subgoal):
 1. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence i'i: "i' > i"
[PROOF STATE]
proof (prove)
using this:
i < i'

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

goal (1 subgoal):
 1. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence cond: "\<not> i' - 1 < i"
[PROOF STATE]
proof (prove)
using this:
i < i'

goal (1 subgoal):
 1. \<not> i' - 1 < i
[PROOF STEP]
using i'i
[PROOF STATE]
proof (prove)
using this:
i < i'
i < i'

goal (1 subgoal):
 1. \<not> i' - 1 < i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> i' - 1 < i

goal (1 subgoal):
 1. i < i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
proof (cases rule: linorder_cases[of "p i'" "p i"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. p i' < p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
p i' < p i

goal (3 subgoals):
 1. p i' < p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence pd: "permutation_delete p i (i'-1) = p i'"
[PROOF STATE]
proof (prove)
using this:
p i' < p i

goal (1 subgoal):
 1. permutation_delete p i (i' - 1) = p i'
[PROOF STEP]
unfolding permutation_delete_expand
[PROOF STATE]
proof (prove)
using this:
p i' < p i

goal (1 subgoal):
 1. (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) = p i'
[PROOF STEP]
using i'i cond
[PROOF STATE]
proof (prove)
using this:
p i' < p i
i < i'
\<not> i' - 1 < i

goal (1 subgoal):
 1. (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) = p i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_delete p i (i' - 1) = p i'

goal (3 subgoals):
 1. p i' < p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 3. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
unfolding permutation_insert_expand pd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i' < i then if permutation_delete p i i' < p i then permutation_delete p i i' else Suc (permutation_delete p i i') else if i' = i then p i else if p i' < p i then p i' else Suc (p i')) = p i'
[PROOF STEP]
using i'i less
[PROOF STATE]
proof (prove)
using this:
i < i'
p i' < p i

goal (1 subgoal):
 1. (if i' < i then if permutation_delete p i i' < p i then permutation_delete p i i' else Suc (permutation_delete p i i') else if i' = i then p i else if p i' < p i then p i' else Suc (p i')) = p i'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal (2 subgoals):
 1. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case equal
[PROOF STATE]
proof (state)
this:
p i' = p i

goal (2 subgoals):
 1. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence "i = i'"
[PROOF STATE]
proof (prove)
using this:
p i' = p i

goal (1 subgoal):
 1. i = i'
[PROOF STEP]
using permutes_inj[OF p] injD
[PROOF STATE]
proof (prove)
using this:
p i' = p i
inj p
\<lbrakk>inj ?f; ?f ?x = ?f ?y\<rbrakk> \<Longrightarrow> ?x = ?y

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

goal (2 subgoals):
 1. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
i = i'

goal (1 subgoal):
 1. False
[PROOF STEP]
using i'i
[PROOF STATE]
proof (prove)
using this:
i = i'
i < i'

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

goal (2 subgoals):
 1. p i' = p i \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
 2. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal (1 subgoal):
 1. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
p i < p i'

goal (1 subgoal):
 1. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
hence pd: "permutation_delete p i (i'-1) = p i' - 1"
[PROOF STATE]
proof (prove)
using this:
p i < p i'

goal (1 subgoal):
 1. permutation_delete p i (i' - 1) = p i' - 1
[PROOF STEP]
unfolding permutation_delete_expand
[PROOF STATE]
proof (prove)
using this:
p i < p i'

goal (1 subgoal):
 1. (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) = p i' - 1
[PROOF STEP]
using i'i cond
[PROOF STATE]
proof (prove)
using this:
p i < p i'
i < i'
\<not> i' - 1 < i

goal (1 subgoal):
 1. (if p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) < p i then p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) else p (if i' - 1 < i then i' - 1 else Suc (i' - 1)) - Suc 0) = p i' - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permutation_delete p i (i' - 1) = p i' - 1

goal (1 subgoal):
 1. p i < p i' \<Longrightarrow> permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i (p i) (permutation_delete p i) i' = p i'
[PROOF STEP]
unfolding permutation_insert_expand pd
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i' < i then if permutation_delete p i i' < p i then permutation_delete p i i' else Suc (permutation_delete p i i') else if i' = i then p i else if p i' - 1 < p i then p i' - 1 else Suc (p i' - 1)) = p i'
[PROOF STEP]
using i'i greater
[PROOF STATE]
proof (prove)
using this:
i < i'
p i < p i'

goal (1 subgoal):
 1. (if i' < i then if permutation_delete p i i' < p i then permutation_delete p i i' else Suc (permutation_delete p i i') else if i' = i then p i else if p i' - 1 < p i then p i' - 1 else Suc (p i' - 1)) = p i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permutation_insert i (p i) (permutation_delete p i) i' = p i'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma undir_unique_awalk: "\<lbrakk>undirected_tree G; v \<in> verts G\<rbrakk> \<Longrightarrow> \<exists>!p. G.apath root p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>undirected_tree G; v \<in> verts G\<rbrakk> \<Longrightarrow> \<exists>!p. G.apath root p v
[PROOF STEP]
using undir_path_in_dir apath_if_in_verts awalk_G_T_root Suc_card_if_graph
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>undirected_tree G; G.apath root ?p ?v\<rbrakk> \<Longrightarrow> set ?p \<subseteq> arcs T
\<lbrakk>graph G; Digraph_Component.connected G; ?v \<in> verts G\<rbrakk> \<Longrightarrow> \<exists>p. G.apath root p ?v
set ?p \<subseteq> arcs T \<Longrightarrow> G.awalk root ?p = awalk root ?p
graph G \<Longrightarrow> \<exists>n. Suc n = card (verts G)

goal (1 subgoal):
 1. \<lbrakk>undirected_tree G; v \<in> verts G\<rbrakk> \<Longrightarrow> \<exists>!p. G.apath root p v
[PROOF STEP]
by (metis G.awalkI_apath unique_awalk_All undirected_tree.axioms(1) undirected_tree.connected)


[STATEMENT]
lemma foldl_insert: "foldl (\<lambda>A x. insert (f x) A) A xs = A \<union> (f ` set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<lambda>A x. insert (f x) A) A xs = A \<union> f ` set xs
[PROOF STEP]
by(induction xs arbitrary: A) simp_all


[STATEMENT]
lemma padic_mult_comm:
assumes "prime p"
assumes "x \<in> carrier (padic_int p)"
assumes "y \<in> carrier (padic_int p)"
shows "x \<otimes>\<^bsub>padic_int p\<^esub> y = y \<otimes>\<^bsub>padic_int p\<^esub> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes>\<^bsub>padic_int p\<^esub> y = y \<otimes>\<^bsub>padic_int p\<^esub> x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (x \<otimes>\<^bsub>padic_int p\<^esub> y) xa = (y \<otimes>\<^bsub>padic_int p\<^esub> x) xa
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (x \<otimes>\<^bsub>padic_int p\<^esub> y) xa = (y \<otimes>\<^bsub>padic_int p\<^esub> x) xa
[PROOF STEP]
have Ax: "(x n) \<in> carrier (residue_ring (p^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using padic_set_def assms(2) padic_int_simps
[PROOF STATE]
proof (prove)
using this:
padic_set ?p = {f. (\<forall>m. f m \<in> carrier (residue_ring (?p ^ m))) \<and> (\<forall>n m. m < n \<longrightarrow> residue (?p ^ m) (f n) = f m)}
x \<in> carrier (padic_int p)
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. \<And>xa. (x \<otimes>\<^bsub>padic_int p\<^esub> y) xa = (y \<otimes>\<^bsub>padic_int p\<^esub> x) xa
[PROOF STEP]
have Ay: "(y n) \<in>carrier (residue_ring (p^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using padic_set_def assms(3) padic_set_res_closed padic_int_simps
[PROOF STATE]
proof (prove)
using this:
padic_set ?p = {f. (\<forall>m. f m \<in> carrier (residue_ring (?p ^ m))) \<and> (\<forall>n m. m < n \<longrightarrow> residue (?p ^ m) (f n) = f m)}
y \<in> carrier (padic_int p)
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. y n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. \<And>xa. (x \<otimes>\<^bsub>padic_int p\<^esub> y) xa = (y \<otimes>\<^bsub>padic_int p\<^esub> x) xa
[PROOF STEP]
show "(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
proof(cases "n=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
 2. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
 2. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
by (metis padic_int_simps(4,5) assms(1) assms(2) assms(3) padic_set_zero_res padic_simps(3))
[PROOF STATE]
proof (state)
this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have LHS0: "(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (x n) \<otimes>\<^bsub>residue_ring (p^n)\<^esub> (y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> y n
[PROOF STEP]
by (simp add: padic_int_def padic_mult_res)
[PROOF STATE]
proof (state)
this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> y n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have RHS0: "(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = (y n) \<otimes>\<^bsub>residue_ring (p^n)\<^esub> (x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> x n
[PROOF STEP]
by (simp add: padic_int_def padic_mult_res)
[PROOF STATE]
proof (state)
this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> x n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have Ex: "(x n) \<in> carrier (residue_ring (p^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using Ax padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
x n \<in> carrier (residue_ring (p ^ n))
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have Ey: "(y n) \<in> carrier (residue_ring (p^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using Ay padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
y n \<in> carrier (residue_ring (p ^ n))
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. y n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have LHS1: "(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = ((x n) *(y n)) mod (p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n * y n mod p ^ n
[PROOF STEP]
using LHS0
[PROOF STATE]
proof (prove)
using this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> y n

goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n * y n mod p ^ n
[PROOF STEP]
by (simp add: residue_ring_def)
[PROOF STATE]
proof (state)
this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n * y n mod p ^ n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
have RHS1: "(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = ((y n) *(x n)) mod (p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n
[PROOF STEP]
using RHS0
[PROOF STATE]
proof (prove)
using this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> x n

goal (1 subgoal):
 1. (y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n
[PROOF STEP]
by (simp add: residue_ring_def)
[PROOF STATE]
proof (state)
this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n

goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
using LHS1 RHS1
[PROOF STATE]
proof (prove)
using this:
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = x n * y n mod p ^ n
(y \<otimes>\<^bsub>padic_int p\<^esub> x) n = y n * x n mod p ^ n

goal (1 subgoal):
 1. (x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x \<otimes>\<^bsub>padic_int p\<^esub> y) n = (y \<otimes>\<^bsub>padic_int p\<^esub> x) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_real_float_equiv: "(fact n :: float) = (fact n :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (fact n) = fact n
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma iMOD_inter: "
  \<lbrakk> r \<le> r'; r mod m = r' mod m \<rbrakk> \<Longrightarrow>
  [r, mod m] \<inter> [r', mod m] = [r', mod m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<le> r'; r mod m = r' mod m\<rbrakk> \<Longrightarrow> [ r, mod m ] \<inter> [ r', mod m ] = [ r', mod m ]
[PROOF STEP]
by (fastforce simp: iT_iff)


[STATEMENT]
lemma distinct_pos_imaginary_parts_3: "distinct (map real_of_3 (pos_imaginary_parts_3 p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map real_of_3 (pos_imaginary_parts_3 p))
[PROOF STEP]
unfolding pos_imaginary_parts_3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map real_of_3 (Complex_Algebraic_Numbers.remdups_gen equal_3 (filter (\<lambda>x. sgn_3 x = 1) (concat (map roots_of_3 (root_poly_Im p))))))
[PROOF STEP]
by (rule distinct_remdups_equal_3)


[STATEMENT]
lemma emeasure_density_add:
  assumes X: "X \<in> sets M"
  assumes Mf[measurable]: "f \<in> borel_measurable M"
  assumes Mg[measurable]: "g \<in> borel_measurable M"
  shows "emeasure (density M f) X + emeasure (density M g) X =
           emeasure (density M (\<lambda>x. f x + g x)) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (density M f) X + emeasure (density M g) X = emeasure (density M (\<lambda>x. f x + g x)) X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X \<in> sets M
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (1 subgoal):
 1. emeasure (density M f) X + emeasure (density M g) X = emeasure (density M (\<lambda>x. f x + g x)) X
[PROOF STEP]
apply (subst (1 2 3) emeasure_density, simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> sets M \<Longrightarrow> \<integral>\<^sup>+ x. f x * indicator X x \<partial>M + \<integral>\<^sup>+ x. g x * indicator X x \<partial>M = \<integral>\<^sup>+ x. (f x + g x) * indicator X x \<partial>M
[PROOF STEP]
apply (subst nn_integral_add[symmetric], simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> sets M \<Longrightarrow> \<integral>\<^sup>+ x. f x * indicator X x + g x * indicator X x \<partial>M = \<integral>\<^sup>+ x. (f x + g x) * indicator X x \<partial>M
[PROOF STEP]
apply (intro nn_integral_cong, simp split: split_indicator)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma keys_mult_monomial:
  \<open>keys (monomial (n :: int) k * mapping_of a) = (if n = 0 then {} else ((+) k) ` keys (mapping_of a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (monomial n k * mapping_of a) = (if n = 0 then {} else (+) k ` keys (mapping_of a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. keys (monomial n k * mapping_of a) = (if n = 0 then {} else (+) k ` keys (mapping_of a))
[PROOF STEP]
have [simp]: \<open>(\<Sum>aa. (if k = aa then n else 0) *
               (\<Sum>q. lookup (mapping_of a) q when k + xa = aa + q)) =
        (\<Sum>aa. (if k = aa then n * (\<Sum>q. lookup (mapping_of a) q when k + xa = aa + q) else 0))\<close>
      for xa
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>aa. (if k = aa then n else 0) * (\<Sum>q. lookup (mapping_of a) q when k + xa = aa + q)) = (\<Sum>aa. if k = aa then n * (\<Sum>q. lookup (mapping_of a) q when k + xa = aa + q) else 0)
[PROOF STEP]
by (smt (verit) Sum_any.cong mult_not_zero)
[PROOF STATE]
proof (state)
this:
(\<Sum>aa. (if k = aa then n else 0) * (\<Sum>q. lookup (mapping_of a) q when k + ?xa = aa + q)) = (\<Sum>aa. if k = aa then n * (\<Sum>q. lookup (mapping_of a) q when k + ?xa = aa + q) else 0)

goal (1 subgoal):
 1. keys (monomial n k * mapping_of a) = (if n = 0 then {} else (+) k ` keys (mapping_of a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (monomial n k * mapping_of a) = (if n = 0 then {} else (+) k ` keys (mapping_of a))
[PROOF STEP]
apply (auto simp: vars_def times_mpoly.rep_eq Const.rep_eq times_poly_mapping.rep_eq
      Const\<^sub>0_def elim!: in_keys_timesE split: if_splits)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>n \<noteq> 0; xa \<in> keys (mapping_of a)\<rbrakk> \<Longrightarrow> k + xa \<in> keys (monomial n k * mapping_of a)
[PROOF STEP]
apply (auto simp: lookup_monomial_If prod_fun_def
      keys_def times_poly_mapping.rep_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
keys (monomial n k * mapping_of a) = (if n = 0 then {} else (+) k ` keys (mapping_of a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma succ_ok_imp_permutes:
    assumes "succ_ok"
    shows "edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
succ_ok
[PROOF STEP]
have "\<forall>a \<in> arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)"
[PROOF STATE]
proof (prove)
using this:
succ_ok

goal (1 subgoal):
 1. \<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)
[PROOF STEP]
using succ_perm
[PROOF STATE]
proof (prove)
using this:
succ_ok
is_map_succ_perm_inv iG iM succ_i succ_ok
is_map_final iG succ_i succ_ok

goal (1 subgoal):
 1. \<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)
[PROOF STEP]
unfolding is_map_succ_perm_inv_def is_map_final_def
[PROOF STATE]
proof (prove)
using this:
succ_ok
succ_ok = (\<forall>i<succ_i. im_succ iM i < length (snd iG) \<and> ig_tail iG (im_succ iM i) = ig_tail iG i \<and> im_pred iM (im_succ iM i) = i)
(succ_ok \<longrightarrow> succ_i = length (snd iG)) \<and> succ_i \<le> length (snd iG)

goal (1 subgoal):
 1. \<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)
[PROOF STEP]
by (auto simp: mkg_simps mkm_simps arcs_mkg perm_restrict_def)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)

goal (1 subgoal):
 1. edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)
[PROOF STEP]
with succ_ok_imp_pred[OF assms]
[PROOF STATE]
proof (chain)
picking this:
?i < length (snd iG) \<Longrightarrow> im_pred iM (im_succ iM ?i) = ?i
\<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < length (snd iG) \<Longrightarrow> im_pred iM (im_succ iM ?i) = ?i
\<forall>a\<in>arcs (mk_graph iG). edge_succ (mk_map (mk_graph iG) iM) a \<in> arcs (mk_graph iG)

goal (1 subgoal):
 1. edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)
[PROOF STEP]
by - (rule permutesI_finite_dom[where g="im_pred iM"], auto simp: perm_restrict_simps mkm_simps arcs_mkg)
[PROOF STATE]
proof (state)
this:
edge_succ (mk_map (mk_graph iG) iM) permutes arcs (mk_graph iG)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma union_subseteq_elim [elim]: "\<lbrakk>A \<union> B \<subseteq> C; \<lbrakk>A \<subseteq> C; B \<subseteq> C\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<union> B \<subseteq> C; \<lbrakk>A \<subseteq> C; B \<subseteq> C\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_closed_quotient_map:
     "\<lbrakk>continuous_map X X' f; closed_map X X' f\<rbrakk> \<Longrightarrow> quotient_map X X' f \<longleftrightarrow> f ` (topspace X) = topspace X'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X X' f; closed_map X X' f\<rbrakk> \<Longrightarrow> quotient_map X X' f = (f ` topspace X = topspace X')
[PROOF STEP]
by (meson continuous_closed_imp_quotient_map quotient_map_def)


[STATEMENT]
lemma compactS: "compact S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S
[PROOF STEP]
using boundedS closedS
[PROOF STATE]
proof (prove)
using this:
bounded S
closed S

goal (1 subgoal):
 1. compact S
[PROOF STEP]
by (simp add: compact_eq_bounded_closed)


[STATEMENT]
lemma suc_n_union_of_union:"{xs. set xs \<subseteq> F \<and> length xs = Suc n} = (UN x:F. UN xs : {xs. set xs \<le> F \<and> length xs = n}. {x#xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. set xs \<subseteq> F \<and> length xs = Suc n} = (\<Union>x\<in>F. \<Union>xs\<in>{xs. set xs \<subseteq> F \<and> length xs = n}. {x # xs})
[PROOF STEP]
by (auto simp:length_Suc_conv)


[STATEMENT]
lemma compute_floor_fl[code]:
  "floor_fl (Float m e) = (if 0 \<le> e then Float m e else Float (m div (2 ^ (nat (-e)))) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. floor_fl (Float m e) = (if 0 \<le> e then Float m e else Float (m div 2 ^ nat (- e)) 0)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. real_of_int \<lfloor>real_of_int m * 2 powr real_of_int e\<rfloor> = (if 0 \<le> e then real_of_int m * 2 powr real_of_int e else real_of_int (m div 2 ^ nat (- e)) * 2 powr real_of_int 0)
[PROOF STEP]
apply (simp add: powr_int floor_divide_of_int_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<not> 0 \<le> e \<longrightarrow> \<lfloor>real_of_int m / 2 ^ nat (- e)\<rfloor> = m div 2 ^ nat (- e)
[PROOF STEP]
apply (metis (no_types, opaque_lifting)floor_divide_of_int_eq of_int_numeral of_int_power of_int_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_sel_symm_if_finite: "\<lbrakk>finite X; finite Y; sel_symm f\<rbrakk> \<Longrightarrow> set_sel f X Y = set_sel f Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; finite Y; sel_symm f\<rbrakk> \<Longrightarrow> set_sel f X Y = set_sel f Y X
[PROOF STEP]
using finite_distinct_list list_sel_symm list_sel_eq_set_sel
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs
sel_symm ?f \<Longrightarrow> list_sel ?f ?x ?y = list_sel ?f ?y ?x
\<lbrakk>distinct ?xs; distinct ?ys\<rbrakk> \<Longrightarrow> list_sel ?f ?xs ?ys = set_sel ?f (set ?xs) (set ?ys)

goal (1 subgoal):
 1. \<lbrakk>finite X; finite Y; sel_symm f\<rbrakk> \<Longrightarrow> set_sel f X Y = set_sel f Y X
[PROOF STEP]
by metis


[STATEMENT]
lemma multiplicity_gt_0_iff:
  assumes "d \<in> carrier G" "irreducible G d" "a \<in> carrier G"
  shows "multiplicity G d a > 0 \<longleftrightarrow> d divides a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < multiplicity G d a) = d divides a
[PROOF STEP]
using multiplicity_ge_iff[OF assms(1,2,3), where k="1"] assms
[PROOF STATE]
proof (prove)
using this:
(1 \<le> multiplicity G d a) = d [^] 1 divides a
d \<in> carrier G
irreducible G d
a \<in> carrier G

goal (1 subgoal):
 1. (0 < multiplicity G d a) = d divides a
[PROOF STEP]
by auto


[STATEMENT]
lemma qq_eq_0[simp]: "(of_nat CARD('q) * of_nat CARD('q) :: 'pq mod_ring) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat CARD('q) * of_nat CARD('q) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat CARD('q) * of_nat CARD('q) = 0
[PROOF STEP]
have "(of_nat (q * q) :: 'pq mod_ring) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (q * q) = 0
[PROOF STEP]
by (rule of_nat_zero, auto simp: p_dvd_q)
[PROOF STATE]
proof (state)
this:
of_nat (q * q) = 0

goal (1 subgoal):
 1. of_nat CARD('q) * of_nat CARD('q) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_nat (q * q) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_nat (q * q) = 0

goal (1 subgoal):
 1. of_nat CARD('q) * of_nat CARD('q) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat CARD('q) * of_nat CARD('q) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_r_ar_cos_ker:"\<lbrakk>Ring A; Ring R; f \<in> rHom A R \<rbrakk> \<Longrightarrow>
                     set_rcs (b_ag A) (ker\<^bsub>A,R\<^esub> f) = set_ar_cos A (ker\<^bsub>A,R\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; f \<in> rHom A R\<rbrakk> \<Longrightarrow> set_rcs (b_ag A) (ker\<^bsub>A,R\<^esub> f) = set_ar_cos A (ker\<^bsub>A,R\<^esub> f)
[PROOF STEP]
apply (frule ker_ideal[of "A" "R" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; f \<in> rHom A R; ideal A (ker\<^bsub>A,R\<^esub> f)\<rbrakk> \<Longrightarrow> set_rcs (b_ag A) (ker\<^bsub>A,R\<^esub> f) = set_ar_cos A (ker\<^bsub>A,R\<^esub> f)
[PROOF STEP]
apply (simp add:Ring.carrier_qring[THEN sym],
        simp add:Ring.carrier_qring1[THEN sym])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ex_lemma:"
  \<lbrakk>primerec rf (Suc (length xs));
   primerec rt (length xs)\<rbrakk>
\<Longrightarrow> (rec_exec (rec_ex rt rf) xs =
    (if (\<exists> x \<le> (rec_exec rt xs). 0 <rec_exec rf (xs @ [x])) then 1
     else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>primerec rf (Suc (length xs)); primerec rt (length xs)\<rbrakk> \<Longrightarrow> rec_exec (rec_ex rt rf) xs = (if \<exists>x\<le>rec_exec rt xs. 0 < rec_exec rf (xs @ [x]) then 1 else 0)
[PROOF STEP]
apply(auto simp: rec_exec.simps get_fstn_args_take split: if_splits)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>primerec rf (Suc (length xs)); primerec rt (length xs); rec_exec (rec_sigma rf) (xs @ [rec_exec rt xs]) = 0; x \<le> rec_exec rt xs\<rbrakk> \<Longrightarrow> rec_exec rf (xs @ [x]) = 0
 2. \<lbrakk>primerec rf (Suc (length xs)); primerec rt (length xs); 0 < rec_exec (rec_sigma rf) (xs @ [rec_exec rt xs])\<rbrakk> \<Longrightarrow> \<exists>x\<le>rec_exec rt xs. 0 < rec_exec rf (xs @ [x])
[PROOF STEP]
apply(drule_tac x = "rec_exec rt xs" in rec_sigma_ex, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>primerec rf (Suc (length xs)); primerec rt (length xs); 0 < rec_exec (rec_sigma rf) (xs @ [rec_exec rt xs])\<rbrakk> \<Longrightarrow> \<exists>x\<le>rec_exec rt xs. 0 < rec_exec rf (xs @ [x])
[PROOF STEP]
apply(drule_tac x = "rec_exec rt xs" in rec_sigma_ex, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ordinal_times_left_cancel_le [simp]:
"0 < w \<Longrightarrow> (w * x \<le> w * y) = (x \<le> (y::ordinal))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < w \<Longrightarrow> (w * x \<le> w * y) = (x \<le> y)
[PROOF STEP]
by (rule normal.cancel_le[OF normal_times])


[STATEMENT]
lemma [simp]: "\<lfloor>A\<rfloor> \<squnion> \<lfloor>B\<rfloor> = \<lfloor>A \<union> B\<rfloor> \<and> \<lfloor>A\<rfloor> \<ominus> a = \<lfloor>A - {a}\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>A\<rfloor> \<squnion> \<lfloor>B\<rfloor> = \<lfloor>A \<union> B\<rfloor> \<and> \<lfloor>A\<rfloor> \<ominus> a = \<lfloor>A - {a}\<rfloor>
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>A\<rfloor> \<squnion> \<lfloor>B\<rfloor> = \<lfloor>A \<union> B\<rfloor> \<and> \<lfloor>A\<rfloor> \<ominus> a = \<lfloor>A - {a}\<rfloor>
[PROOF STEP]
by(simp add:hyperset_defs)


[STATEMENT]
lemma BfunE:
  assumes "Bfun f F"
  obtains B where "0 < B" and "eventually (\<lambda>x. norm (f x) \<le> B) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Bfun f F

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Bfun_def
[PROOF STATE]
proof (prove)
using this:
\<exists>K>0. \<forall>\<^sub>F x in F. norm (f x) \<le> K

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma timpl_closure_set_idem:
  "timpl_closure_set (timpl_closure_set M TI) TI = timpl_closure_set M TI"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. timpl_closure_set (timpl_closure_set M TI) TI = timpl_closure_set M TI
[PROOF STEP]
using timpl_closure_idem[of _ TI]
[PROOF STATE]
proof (prove)
using this:
timpl_closure_set (timpl_closure ?t TI) TI = timpl_closure ?t TI

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

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


[STATEMENT]
lemma sum_mset_mono:
  assumes "\<And>x. x \<in># A \<Longrightarrow> f x \<le> (g x :: 'a :: {ordered_ab_semigroup_add,comm_monoid_add})"
  shows   "(\<Sum>x\<in>#A. f x) \<le> (\<Sum>x\<in>#A. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># A \<Longrightarrow> f ?x \<le> g ?x

goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
by (induction A) (auto intro!: add_mono)


[STATEMENT]
lemma transpose_mat_append_cols:
 assumes A: "A \<in> carrier_mat n a" and B: "B \<in> carrier_mat n b"
 shows "(A @\<^sub>c B)\<^sup>T = A\<^sup>T @\<^sub>r B\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>c B)\<^sup>T = A\<^sup>T @\<^sub>r B\<^sup>T
[PROOF STEP]
by (metis Matrix.transpose_transpose A B carrier_matD(1) carrier_mat_triv
      index_transpose_mat(3) transpose_mat_append_rows)


[STATEMENT]
lemma Im_sum[simp]: "Im (sum f s) = (\<Sum>x\<in>s. Im(f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (sum f s) = (\<Sum>x\<in>s. Im (f x))
[PROOF STEP]
by (induct s rule: infinite_finite_induct) auto


[STATEMENT]
lemma mset_empty_count[simp]: "(\<forall>p. count M p = 0) = (M={#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>p. count M p = 0) = (M = {#})
[PROOF STEP]
by (auto simp add: multiset_eq_iff)


[STATEMENT]
lemma scale_spmf_le_1:
  "(\<integral>\<^sup>+ x. min (inverse (weight_spmf p)) (max 0 r) * spmf p x \<partial>count_space UNIV) \<le> 1" (is "?lhs \<le> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
have "?lhs = min (inverse (weight_spmf p)) (max 0 r) * \<integral>\<^sup>+ x. spmf p x \<partial>count_space UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV = ennreal (min (inverse (weight_spmf p)) (max 0 r)) * \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV
[PROOF STEP]
by(subst nn_integral_cmult[symmetric])(simp_all add: weight_spmf_nonneg max_def min_def ennreal_mult)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV = ennreal (min (inverse (weight_spmf p)) (max 0 r)) * \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV = ennreal (min (inverse (weight_spmf p)) (max 0 r)) * \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
have "\<dots> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (min (inverse (weight_spmf p)) (max 0 r)) * \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
unfolding weight_spmf_eq_nn_integral_spmf[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (min (inverse (weight_spmf p)) (max 0 r)) * ennreal (weight_spmf p) \<le> 1
[PROOF STEP]
by(simp add: min_def max_def weight_spmf_nonneg order.strict_iff_order field_simps ennreal_mult[symmetric])
[PROOF STATE]
proof (state)
this:
ennreal (min (inverse (weight_spmf p)) (max 0 r)) * \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV \<le> 1

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (min (inverse (weight_spmf p)) (max 0 r) * spmf p x) \<partial>count_space UNIV \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_INDUCT:
  "\<forall>P::'A list \<Rightarrow> bool. P [] \<and> (\<forall>a0 a1. P a1 \<longrightarrow> P (a0 # a1)) \<longrightarrow> (\<forall>x. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. P [] \<and> (\<forall>a0 a1. P a1 \<longrightarrow> P (a0 # a1)) \<longrightarrow> (\<forall>x. P x)
[PROOF STEP]
using list.induct
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P []; \<And>x1 x2. ?P x2 \<Longrightarrow> ?P (x1 # x2)\<rbrakk> \<Longrightarrow> ?P ?list

goal (1 subgoal):
 1. \<forall>P. P [] \<and> (\<forall>a0 a1. P a1 \<longrightarrow> P (a0 # a1)) \<longrightarrow> (\<forall>x. P x)
[PROOF STEP]
by auto


[STATEMENT]
lemma ordinal_of_nat_plus [simp]:
"ordinal_of_nat x + ordinal_of_nat y = ordinal_of_nat (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_nat x + ordinal_of_nat y = ordinal_of_nat (x + y)
[PROOF STEP]
by (induct y) simp_all


[STATEMENT]
lemma mat_exp_law: "mat_mul (mat_pow n M) (mat_pow m M) = mat_pow (n+m) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mul (mat_pow n M) (mat_pow m M) = mat_pow (n + m) M
[PROOF STEP]
apply (induction n, auto)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>n. mat (mat_11 (mat_pow n M) * mat_11 (mat_pow m M) + mat_12 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_11 (mat_pow n M) * mat_12 (mat_pow m M) + mat_12 (mat_pow n M) * mat_22 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_11 (mat_pow m M) + mat_22 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_12 (mat_pow m M) + mat_22 (mat_pow n M) * mat_22 (mat_pow m M)) = mat_pow (n + m) M \<Longrightarrow> (mat_11 M * mat_11 (mat_pow n M) + mat_12 M * mat_21 (mat_pow n M)) * mat_11 (mat_pow m M) + (mat_11 M * mat_12 (mat_pow n M) + mat_12 M * mat_22 (mat_pow n M)) * mat_21 (mat_pow m M) = mat_11 M * mat_11 (mat_pow (n + m) M) + mat_12 M * mat_21 (mat_pow (n + m) M)
 2. \<And>n. mat (mat_11 (mat_pow n M) * mat_11 (mat_pow m M) + mat_12 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_11 (mat_pow n M) * mat_12 (mat_pow m M) + mat_12 (mat_pow n M) * mat_22 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_11 (mat_pow m M) + mat_22 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_12 (mat_pow m M) + mat_22 (mat_pow n M) * mat_22 (mat_pow m M)) = mat_pow (n + m) M \<Longrightarrow> (mat_11 M * mat_11 (mat_pow n M) + mat_12 M * mat_21 (mat_pow n M)) * mat_12 (mat_pow m M) + (mat_11 M * mat_12 (mat_pow n M) + mat_12 M * mat_22 (mat_pow n M)) * mat_22 (mat_pow m M) = mat_11 M * mat_12 (mat_pow (n + m) M) + mat_12 M * mat_22 (mat_pow (n + m) M)
 3. \<And>n. mat (mat_11 (mat_pow n M) * mat_11 (mat_pow m M) + mat_12 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_11 (mat_pow n M) * mat_12 (mat_pow m M) + mat_12 (mat_pow n M) * mat_22 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_11 (mat_pow m M) + mat_22 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_12 (mat_pow m M) + mat_22 (mat_pow n M) * mat_22 (mat_pow m M)) = mat_pow (n + m) M \<Longrightarrow> (mat_21 M * mat_11 (mat_pow n M) + mat_22 M * mat_21 (mat_pow n M)) * mat_11 (mat_pow m M) + (mat_21 M * mat_12 (mat_pow n M) + mat_22 M * mat_22 (mat_pow n M)) * mat_21 (mat_pow m M) = mat_21 M * mat_11 (mat_pow (n + m) M) + mat_22 M * mat_21 (mat_pow (n + m) M)
 4. \<And>n. mat (mat_11 (mat_pow n M) * mat_11 (mat_pow m M) + mat_12 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_11 (mat_pow n M) * mat_12 (mat_pow m M) + mat_12 (mat_pow n M) * mat_22 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_11 (mat_pow m M) + mat_22 (mat_pow n M) * mat_21 (mat_pow m M)) (mat_21 (mat_pow n M) * mat_12 (mat_pow m M) + mat_22 (mat_pow n M) * mat_22 (mat_pow m M)) = mat_pow (n + m) M \<Longrightarrow> (mat_21 M * mat_11 (mat_pow n M) + mat_22 M * mat_21 (mat_pow n M)) * mat_12 (mat_pow m M) + (mat_21 M * mat_12 (mat_pow n M) + mat_22 M * mat_22 (mat_pow n M)) * mat_22 (mat_pow m M) = mat_21 M * mat_12 (mat_pow (n + m) M) + mat_22 M * mat_22 (mat_pow (n + m) M)
[PROOF STEP]
by (metis mat2.sel(1,2) mat_associativity mat_mul.simps)+