[STATEMENT]
lemma (in wf_digraph) cycle_conv:
  "cycle p \<longleftrightarrow> (\<exists>u. awalk u p u \<and> distinct (tl (awalk_verts u p)) \<and> distinct p \<and> p \<noteq> [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cycle p = (\<exists>u. awalk u p u \<and> distinct (tl (awalk_verts u p)) \<and> distinct p \<and> p \<noteq> [])
[PROOF STEP]
unfolding cycle_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>u. awalk u p u \<and> distinct (tl (awalk_verts u p)) \<and> p \<noteq> []) = (\<exists>u. awalk u p u \<and> distinct (tl (awalk_verts u p)) \<and> distinct p \<and> p \<noteq> [])
[PROOF STEP]
by (auto intro: distinct_tl_verts_imp_distinct)


[STATEMENT]
lemma (in topological_space) at_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> at a within S = at a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; open S\<rbrakk> \<Longrightarrow> at a within S = at a
[PROOF STEP]
unfolding filter_eq_iff eventually_at_topological
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; open S\<rbrakk> \<Longrightarrow> \<forall>P. (\<exists>Sa. open Sa \<and> a \<in> Sa \<and> (\<forall>x\<in>Sa. x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> P x)) = (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. x \<noteq> a \<longrightarrow> x \<in> UNIV \<longrightarrow> P x))
[PROOF STEP]
by (metis open_Int Int_iff UNIV_I)


[STATEMENT]
lemma binomial_pmf_altdef':
  fixes A :: "'a set"
  assumes "finite A" and "card A = n" and p: "p \<in> {0..1}"
  shows   "binomial_pmf n p =
             map_pmf (\<lambda>f. card {x\<in>A. f x}) (Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
card A = n
p \<in> {0..1}
[PROOF STEP]
have "?lhs = binomial_pmf (card A) p"
[PROOF STATE]
proof (prove)
using this:
finite A
card A = n
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf n p = binomial_pmf (card A) p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = binomial_pmf (card A) p

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = binomial_pmf (card A) p

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
proof (induction rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf.Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf.Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
p \<in> {0..1}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf.Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (simp add: binomial_pmf_0)
[PROOF STATE]
proof (state)
this:
binomial_pmf (card {}) p = map_pmf (\<lambda>f. card {x \<in> {}. f x}) (Pi_pmf.Pi_pmf {} dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
from insert.hyps
[PROOF STATE]
proof (chain)
picking this:
finite A
x \<notin> A
[PROOF STEP]
have "card (insert x A) = Suc (card A)"
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. card (insert x A) = Suc (card A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert x A) = Suc (card A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert x A) = Suc (card A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "binomial_pmf \<dots> p = do {
                                     b \<leftarrow> bernoulli_pmf p;
                                     f \<leftarrow> Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p);
                                     return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})
                                   }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))
[PROOF STEP]
by (simp add: binomial_pmf_Suc insert.IH bind_map_pmf)
[PROOF STATE]
proof (state)
this:
binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
binomial_pmf (Suc (card A)) p = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = do {
                      b \<leftarrow> bernoulli_pmf p;
                      f \<leftarrow> Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p);
                      return_pmf (card {y \<in> insert x A. (f(x := b)) y})
                    }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))
[PROOF STEP]
proof (intro bind_pmf_cong refl, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
case (1 b f)
[PROOF STATE]
proof (state)
this:
b \<in> set_pmf (bernoulli_pmf p)
f \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
have "(if b then 1 else 0) + card {y\<in>A. f y} = card ((if b then {x} else {}) \<union> {y\<in>A. f y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. (if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if b then 1 else 0) + card {y \<in> A. f y} = card ((if b then {x} else {}) \<union> {y \<in> A. f y})

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
have "(if b then {x} else {}) \<union> {y\<in>A. f y} = {y\<in>insert x A. (f(x := b)) y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. (if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if b then {x} else {}) \<union> {y \<in> A. f y} = {y \<in> insert x A. (f(x := b)) y}

goal (1 subgoal):
 1. \<And>xa xaa. \<lbrakk>xa \<in> set_pmf (bernoulli_pmf p); xaa \<in> set_pmf (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> return_pmf ((if xa then 1 else 0) + card {y \<in> A. xaa y}) = return_pmf (card {y \<in> insert x A. (xaa(x := xa)) y})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(if b then 1 else 0) + card {y \<in> A. f y} = card {y \<in> insert x A. (f(x := b)) y}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(if b then 1 else 0) + card {y \<in> A. f y} = card {y \<in> insert x A. (f(x := b)) y}

goal (1 subgoal):
 1. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}) = return_pmf (card {y \<in> insert x A. (f(x := b)) y})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}) = return_pmf (card {y \<in> insert x A. (f(x := b)) y})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf ((if b then 1 else 0) + card {y \<in> A. f y}))) = bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y})))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
have "\<dots> = map_pmf (\<lambda>f. card {y\<in>insert x A. f y})
                      (Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (subst Pi_pmf_insert) (simp_all add: pair_pmf_def map_bind_pmf)
[PROOF STATE]
proof (state)
this:
bernoulli_pmf p \<bind> (\<lambda>b. Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p) \<bind> (\<lambda>f. return_pmf (card {y \<in> insert x A. (f(x := b)) y}))) = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; binomial_pmf (card F) p = map_pmf (\<lambda>f. card {x \<in> F. f x}) (Pi_pmf.Pi_pmf F dflt (\<lambda>_. bernoulli_pmf p))\<rbrakk> \<Longrightarrow> binomial_pmf (card (insert x F)) p = map_pmf (\<lambda>f. card {xa \<in> insert x F. f xa}) (Pi_pmf.Pi_pmf (insert x F) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {y \<in> insert x A. f y}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {xa \<in> insert x A. f xa}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
binomial_pmf (card (insert x A)) p = map_pmf (\<lambda>f. card {xa \<in> insert x A. f xa}) (Pi_pmf.Pi_pmf (insert x A) dflt (\<lambda>_. bernoulli_pmf p))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
binomial_pmf (card A) p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = map_pmf (\<lambda>f. card {x \<in> A. f x}) (Pi_pmf.Pi_pmf A dflt (\<lambda>_. bernoulli_pmf p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_transfer_operator_foT_g:
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" "integrable M (\<lambda>x. f (T x) * g x)"
  shows "AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x
[PROOF STEP]
have *: "(\<integral>x. indicator A x * (f x * real_transfer_operator g x) \<partial>M) = (\<integral>x. indicator A (T x) * (f (T x) * g x) \<partial>M)"
    if [measurable]: "A \<in> sets M" for A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. indicat_real A x * (f x * real_transfer_operator g x) = LINT x|M. indicat_real A (T x) * (f (T x) * g x)
[PROOF STEP]
apply (simp add: mult.assoc[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. indicat_real A x * f x * real_transfer_operator g x = LINT x|M. indicat_real A (T x) * f (T x) * g x
[PROOF STEP]
apply (subst real_transfer_operator_intg)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. integrable M (\<lambda>x. indicat_real A (T x) * f (T x) * g x)
 2. (\<lambda>x. indicat_real A x * f x) \<in> borel_measurable M
 3. g \<in> borel_measurable M
 4. LINT x|M. indicat_real A (T x) * f (T x) * g x = LINT x|M. indicat_real A (T x) * f (T x) * g x
[PROOF STEP]
apply (rule Bochner_Integration.integrable_bound[of _ "(\<lambda>x. f (T x) * g x)"])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. integrable M (\<lambda>x. f (T x) * g x)
 2. (\<lambda>x. indicat_real A (T x) * f (T x) * g x) \<in> borel_measurable M
 3. AE x in M. norm (indicat_real A (T x) * f (T x) * g x) \<le> norm (f (T x) * g x)
 4. (\<lambda>x. indicat_real A x * f x) \<in> borel_measurable M
 5. g \<in> borel_measurable M
 6. LINT x|M. indicat_real A (T x) * f (T x) * g x = LINT x|M. indicat_real A (T x) * f (T x) * g x
[PROOF STEP]
by (auto simp add: assms indicator_def)
[PROOF STATE]
proof (state)
this:
?A3 \<in> sets M \<Longrightarrow> LINT x|M. indicat_real ?A3 x * (f x * real_transfer_operator g x) = LINT x|M. indicat_real ?A3 (T x) * (f (T x) * g x)

goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x
[PROOF STEP]
by (rule real_transfer_operator_charact) (auto simp add: assms * intro!: real_transfer_operator_intg)
[PROOF STATE]
proof (state)
this:
AE x in M. real_transfer_operator (\<lambda>x. f (T x) * g x) x = f x * real_transfer_operator g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_on_f_imageI:
  assumes "inj_on f S" "\<And>t. t \<in> T \<Longrightarrow> t \<subseteq> S"
  shows "inj_on ((`) f) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((`) f) T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f S
?t \<in> T \<Longrightarrow> ?t \<subseteq> S

goal (1 subgoal):
 1. inj_on ((`) f) T
[PROOF STEP]
by (auto simp: inj_on_image_eq_iff intro: inj_onI)


[STATEMENT]
lemma gen_kleene_chain_conv:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  assumes C: "cont f"
  shows "(SUP i. (f^^i) m) = (SUP i. ((\<lambda>x. sup m (f x))^^i) bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. (f ^^ i) m) = (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (SUP i. (f ^^ i) m) = (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
let ?f' = "\<lambda>x. sup m (f x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (SUP i. (f ^^ i) m) = (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. (f ^^ i) m) = (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
proof (intro antisym SUP_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
 2. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
from C
[PROOF STATE]
proof (chain)
picking this:
cont f
[PROOF STEP]
have C': "cont ?f'"
[PROOF STATE]
proof (prove)
using this:
cont f

goal (1 subgoal):
 1. cont (\<lambda>x. sup m (f x))
[PROOF STEP]
unfolding cont_def
[PROOF STATE]
proof (prove)
using this:
\<forall>C. C \<noteq> {} \<longrightarrow> f (Sup C) = Sup (f ` C)

goal (1 subgoal):
 1. \<forall>C. C \<noteq> {} \<longrightarrow> sup m (f (Sup C)) = (SUP x\<in>C. sup m (f x))
[PROOF STEP]
by (simp add: SUP_sup_distrib[symmetric])
[PROOF STATE]
proof (state)
this:
cont (\<lambda>x. sup m (f x))

goal (2 subgoals):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
 2. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
 2. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
show "(f ^^ i) m \<le> (SUP i. (?f' ^^ i) bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
proof (induction i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (f ^^ 0) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
 2. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (f ^^ 0) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
 2. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ 0) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
by (rule order_trans[OF _ SUP_upper[where i=1]]) auto
[PROOF STATE]
proof (state)
this:
(f ^^ 0) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
(f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
from cont_is_mono[OF C, THEN monoD, OF Suc]
[PROOF STATE]
proof (chain)
picking this:
f ((f ^^ i) m) \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
have "(f ^^ (Suc i)) m \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)"
[PROOF STATE]
proof (prove)
using this:
f ((f ^^ i) m) \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. (f ^^ Suc i) m \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f ^^ Suc i) m \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f ^^ Suc i) m \<le> f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
have "\<dots> \<le> sup m \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<le> sup m (f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<le> sup m (f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot))

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<le> sup m (f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot))

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
note SUP_funpow_contracting[OF C']
[PROOF STATE]
proof (state)
this:
sup m (f (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) ?m)) \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) ?m)

goal (1 subgoal):
 1. \<And>i. (f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot) \<Longrightarrow> (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. (f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f ^^ Suc i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f ^^ i) m \<le> (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
show "(?f'^^i) bot \<le> (SUP i. (f^^i) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
proof (induction i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. sup m (f x)) ^^ 0) bot \<le> (SUP i. (f ^^ i) m)
 2. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ((\<lambda>x. sup m (f x)) ^^ 0) bot \<le> (SUP i. (f ^^ i) m)
 2. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sup m (f x)) ^^ 0) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ 0) bot \<le> (SUP i. (f ^^ i) m)

goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)

goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
from monoD[OF cont_is_mono[OF C] Suc]
[PROOF STATE]
proof (chain)
picking this:
f (((\<lambda>x. sup m (f x)) ^^ i) bot) \<le> f (SUP i. (f ^^ i) m)
[PROOF STEP]
have "(?f'^^Suc i) bot \<le> sup m (f (SUP i. (f ^^ i) m))"
[PROOF STATE]
proof (prove)
using this:
f (((\<lambda>x. sup m (f x)) ^^ i) bot) \<le> f (SUP i. (f ^^ i) m)

goal (1 subgoal):
 1. ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> sup m (f (SUP i. (f ^^ i) m))
[PROOF STEP]
by (simp add: le_supI2)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> sup m (f (SUP i. (f ^^ i) m))

goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> sup m (f (SUP i. (f ^^ i) m))

goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
have "\<dots> \<le> (SUP i. (f ^^ i) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup m (f (SUP i. (f ^^ i) m)) \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
apply (rule sup_least)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. m \<le> (SUP i. (f ^^ i) m)
 2. f (SUP i. (f ^^ i) m) \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
apply (rule order_trans[OF _ SUP_upper[where i=0]], simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (SUP i. (f ^^ i) m) \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
apply (rule SUP_funpow_contracting[OF C])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sup m (f (SUP i. (f ^^ i) m)) \<le> (SUP i. (f ^^ i) m)

goal (1 subgoal):
 1. \<And>i. ((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m) \<Longrightarrow> ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)

goal (1 subgoal):
 1. ((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ Suc i) bot \<le> (SUP i. (f ^^ i) m)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sup m (f x)) ^^ i) bot \<le> (SUP i. (f ^^ i) m)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(SUP i. (f ^^ i) m) = (SUP i. ((\<lambda>x. sup m (f x)) ^^ i) bot)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Qp_nat_int_pow_pow:
  fixes n::nat
  fixes m::int
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "(a[^](n*m)) = ((a[^]n)[^]m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] (int n * m) = (a [^] n) [^] m
[PROOF STEP]
by (simp add: Qp_int_pow_pow assms int_pow_int)


[STATEMENT]
lemma mon_pl_unconc: "!!b. mon_pl (a@b) = mon_pl a \<union> mon_pl b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. mon_pl (a @ b) = mon_pl a \<union> mon_pl b
[PROOF STEP]
by (induct a) auto


[STATEMENT]
lemma Units_eq: "Units = {x. x dvd 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Units = {x. is_unit x}
[PROOF STEP]
unfolding Units_def dvd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>k. (1::'a) = x * k} = {x. \<exists>k. (1::'a) = x * k}
[PROOF STEP]
..


[STATEMENT]
lemma steps_append: "length qs = length as \<Longrightarrow> steps s (qs@qs') (as@as') = steps (steps s qs as) qs' as'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length qs = length as \<Longrightarrow> steps s (qs @ qs') (as @ as') = steps (steps s qs as) qs' as'
[PROOF STEP]
apply(induct qs as arbitrary: s rule: list_induct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. steps s ([] @ qs') ([] @ as') = steps (steps s [] []) qs' as'
 2. \<And>x xs y ys s. \<lbrakk>length xs = length ys; \<And>s. steps s (xs @ qs') (ys @ as') = steps (steps s xs ys) qs' as'\<rbrakk> \<Longrightarrow> steps s ((x # xs) @ qs') ((y # ys) @ as') = steps (steps s (x # xs) (y # ys)) qs' as'
[PROOF STEP]
by simp_all


[STATEMENT]
lemma X2_X_polynomial_bool_mult_in:
  \<open>Var (x1) * (Var (x1) * p) -  Var (x1) * p \<in> More_Modules.ideal polynomial_bool\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Var x1 * (Var x1 * p) - Var x1 * p \<in> More_Modules.ideal polynomial_bool
[PROOF STEP]
using ideal_mult_right_in[OF  X2_X_in_pac_ideal[of x1 \<open>{}\<close>, unfolded pac_ideal_def], of p]
[PROOF STATE]
proof (prove)
using this:
((Var x1)\<^sup>2 - Var x1) * p \<in> More_Modules.ideal ({} \<union> polynomial_bool)

goal (1 subgoal):
 1. Var x1 * (Var x1 * p) - Var x1 * p \<in> More_Modules.ideal polynomial_bool
[PROOF STEP]
by (auto simp: right_diff_distrib ac_simps power2_eq_square)


[STATEMENT]
lemma simplex_likeD_iso:
  "simplex_like P \<Longrightarrow>
    \<exists>f A::nat set. OrderingSetIso less_eq less (\<subseteq>) (\<subset>) P f \<and> f`P = Pow A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simplex_like P \<Longrightarrow> \<exists>f A. OrderingSetIso (\<^bold>\<le>) (\<^bold><) (\<subseteq>) (\<subset>) P f \<and> f ` P = Pow A
[PROOF STEP]
using simplex_like_def
[PROOF STATE]
proof (prove)
using this:
simplex_like ?P \<equiv> finite ?P \<and> (\<exists>f A. OrderingSetIso (\<^bold>\<le>) (\<^bold><) (\<subseteq>) (\<subset>) ?P f \<and> f ` ?P = Pow A)

goal (1 subgoal):
 1. simplex_like P \<Longrightarrow> \<exists>f A. OrderingSetIso (\<^bold>\<le>) (\<^bold><) (\<subseteq>) (\<subset>) P f \<and> f ` P = Pow A
[PROOF STEP]
by simp


[STATEMENT]
lemma Sigma_Suc2:
  "m = n + 2 \<Longrightarrow>
    A \<times> below m = (A \<times> {n}) \<union> (A \<times> {n + 1}) \<union> (A \<times> below n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n + 2 \<Longrightarrow> A \<times> below m = A \<times> {n} \<union> A \<times> {n + 1} \<union> A \<times> below n
[PROOF STEP]
by (auto simp add: below_def)


[STATEMENT]
lemma gbinomial_minus': "(a + of_nat b) gchoose b = (- 1) ^ b * (- (a + 1) gchoose b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + of_nat b gchoose b = (- (1::'a)) ^ b * (- (a + (1::'a)) gchoose b)
[PROOF STEP]
by (subst gbinomial_minus) (simp add: power_mult_distrib [symmetric])


[STATEMENT]
lemma USUP_as_Inf_image: "(\<Squnion> P \<in> \<P> \<bullet> f(P)) = \<Squnion> (f ` \<P>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> P \<in> \<P> \<bullet> f P) = \<Squnion>(f ` \<P>)
[PROOF STEP]
apply (simp add: upred_defs bop.rep_eq lit.rep_eq Inf_uexpr_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> P \<in> \<P> \<bullet> f P) = mk\<^sub>e (\<lambda>A. \<Squnion>x\<in>\<P>. \<lbrakk>f x\<rbrakk>\<^sub>e A)
[PROOF STEP]
apply (pred_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<Squnion>{uu_. \<exists>x. uu_ = \<lbrakk>f x\<rbrakk>\<^sub>e b \<and> x \<in> \<P>} = (\<Squnion>x\<in>\<P>. \<lbrakk>f x\<rbrakk>\<^sub>e b)
[PROOF STEP]
apply (rule cong[of "Inf"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. Inf = Inf
 2. \<And>b. {uu_. \<exists>x. uu_ = \<lbrakk>f x\<rbrakk>\<^sub>e b \<and> x \<in> \<P>} = (\<lambda>x. \<lbrakk>f x\<rbrakk>\<^sub>e b) ` \<P>
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vector_derivative_at_within_ivl_diff:
  "finite s \<and> a < b \<and> (x::real) \<in> {a..b} - s \<and> (f has_vector_derivative f') (at x) \<Longrightarrow>
     vector_derivative f (at x within {a..b} - s) = f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<and> a < b \<and> x \<in> {a..b} - s \<and> (f has_vector_derivative f') (at x) \<Longrightarrow> vector_derivative f (at x within {a..b} - s) = f'
[PROOF STEP]
using vector_derivative_at_within_non_trivial_limit ivl_not_trivial_limit_within
[PROOF STATE]
proof (prove)
using this:
at ?x within ?s \<noteq> bot \<and> (?f has_vector_derivative ?f') (at ?x) \<Longrightarrow> vector_derivative ?f (at ?x within ?s) = ?f'
\<lbrakk>finite ?s; ?a < ?b; ?x \<in> {?a..?b} - ?s\<rbrakk> \<Longrightarrow> at ?x within {?a..?b} - ?s \<noteq> bot

goal (1 subgoal):
 1. finite s \<and> a < b \<and> x \<in> {a..b} - s \<and> (f has_vector_derivative f') (at x) \<Longrightarrow> vector_derivative f (at x within {a..b} - s) = f'
[PROOF STEP]
by fastforce


[STATEMENT]
lemma singleton_eq_iff [iff]: "set {a} = set {b} \<longleftrightarrow> a=b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set {a} = set {b}) = (a = b)
[PROOF STEP]
by simp


[STATEMENT]
lemma ngba_g_E_rtrancl: "(g_E (ngba_g A))\<^sup>* = {(p, q). q \<in> reachable A p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g_E (ngba_g A))\<^sup>* = {(p, q). q \<in> reachable A p}
[PROOF STEP]
unfolding ngba_g_def graph_rec.simps E_of_succ_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(u, v). v \<in> successors A u}\<^sup>* = {(p, q). q \<in> reachable A p}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (a, b) \<in> {(u, v). v \<in> successors A u}\<^sup>* \<Longrightarrow> b \<in> reachable A a
 2. \<And>a b. b \<in> reachable A a \<Longrightarrow> (a, b) \<in> {(u, v). v \<in> successors A u}\<^sup>*
[PROOF STEP]
show "(p, q) \<in> {(p, q). q \<in> successors A p}\<^sup>*" if "q \<in> reachable A p" for p q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p, q) \<in> {(p, q). q \<in> successors A p}\<^sup>*
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
q \<in> reachable A p

goal (1 subgoal):
 1. (p, q) \<in> {(p, q). q \<in> successors A p}\<^sup>*
[PROOF STEP]
by (induct) (auto intro: rtrancl_into_rtrancl)
[PROOF STATE]
proof (state)
this:
?q \<in> reachable A ?p \<Longrightarrow> (?p, ?q) \<in> {(p, q). q \<in> successors A p}\<^sup>*

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> {(u, v). v \<in> successors A u}\<^sup>* \<Longrightarrow> b \<in> reachable A a
[PROOF STEP]
show "q \<in> reachable A p" if "(p, q) \<in> {(p, q). q \<in> successors A p}\<^sup>*" for p q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<in> reachable A p
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
(p, q) \<in> {(p, q). q \<in> successors A p}\<^sup>*

goal (1 subgoal):
 1. q \<in> reachable A p
[PROOF STEP]
by induct auto
[PROOF STATE]
proof (state)
this:
(?p, ?q) \<in> {(p, q). q \<in> successors A p}\<^sup>* \<Longrightarrow> ?q \<in> reachable A ?p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Longest_common_prefix_eq_Cons: assumes "L \<noteq> {}" "[] \<notin> L"  "\<forall>xs\<in>L. hd xs = x"
shows "Longest_common_prefix L = x # Longest_common_prefix {ys. x#ys \<in> L}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Longest_common_prefix L = x # Longest_common_prefix {ys. x # ys \<in> L}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Longest_common_prefix L = x # Longest_common_prefix {ys. x # ys \<in> L}
[PROOF STEP]
have "L = (#) x ` {ys. x#ys \<in> L}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L = (#) x ` {ys. x # ys \<in> L}
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
[] \<notin> L
\<forall>xs\<in>L. hd xs = x

goal (1 subgoal):
 1. L = (#) x ` {ys. x # ys \<in> L}
[PROOF STEP]
by (auto simp: image_def)(metis hd_Cons_tl)
[PROOF STATE]
proof (state)
this:
L = (#) x ` {ys. x # ys \<in> L}

goal (1 subgoal):
 1. Longest_common_prefix L = x # Longest_common_prefix {ys. x # ys \<in> L}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
L = (#) x ` {ys. x # ys \<in> L}

goal (1 subgoal):
 1. Longest_common_prefix L = x # Longest_common_prefix {ys. x # ys \<in> L}
[PROOF STEP]
by (metis Longest_common_prefix_image_Cons image_is_empty assms(1))
[PROOF STATE]
proof (state)
this:
Longest_common_prefix L = x # Longest_common_prefix {ys. x # ys \<in> L}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coplanar_perm_7:
  assumes "Coplanar A B C D"
  shows "Coplanar B A D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar B A D C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar B A D C
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B A D C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B A D C
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar B A D C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar B A D C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_conjugate [simp]:
  shows "inv conjugate = conjugate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv conjugate = conjugate
[PROOF STEP]
using inv_unique_comp[of conjugate conjugate]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>conjugate \<circ> conjugate = id; conjugate \<circ> conjugate = id\<rbrakk> \<Longrightarrow> inv conjugate = conjugate

goal (1 subgoal):
 1. inv conjugate = conjugate
[PROOF STEP]
by simp


[STATEMENT]
lemma rbl_mult_app2: "length blb \<ge> length bla \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length bla \<le> length blb \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb
[PROOF STEP]
apply (induct bla arbitrary: blb)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>blb. length [] \<le> length blb \<Longrightarrow> rbl_mult [] (blb @ blc) = rbl_mult [] blb
 2. \<And>a bla blb. \<lbrakk>\<And>blb. length bla \<le> length blb \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb; length (a # bla) \<le> length blb\<rbrakk> \<Longrightarrow> rbl_mult (a # bla) (blb @ blc) = rbl_mult (a # bla) blb
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a bla blb. \<lbrakk>\<And>blb. length bla \<le> length blb \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb; length (a # bla) \<le> length blb\<rbrakk> \<Longrightarrow> rbl_mult (a # bla) (blb @ blc) = rbl_mult (a # bla) blb
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a bla blb. \<lbrakk>\<And>blb. length bla \<le> length blb \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb; Suc (length bla) \<le> length blb\<rbrakk> \<Longrightarrow> (let ws = False # rbl_mult bla blb in if a then rbl_add ws (blb @ blc) else ws) = (let ws = False # rbl_mult bla blb in if a then rbl_add ws blb else ws)
[PROOF STEP]
apply (case_tac blb, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a bla blb aa list. \<lbrakk>\<And>blb. length bla \<le> length blb \<Longrightarrow> rbl_mult bla (blb @ blc) = rbl_mult bla blb; Suc (length bla) \<le> length blb; blb = aa # list\<rbrakk> \<Longrightarrow> (let ws = False # rbl_mult bla blb in if a then rbl_add ws (blb @ blc) else ws) = (let ws = False # rbl_mult bla blb in if a then rbl_add ws blb else ws)
[PROOF STEP]
apply (clarsimp simp: Let_def rbl_add_app2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mat_col_eqI: assumes cols: "\<And> i. i < dim_col B \<Longrightarrow> col A i = col B i"
  and dims: "dim_row A = dim_row B" "dim_col A = dim_col B"
shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
by(subst transpose_mat_eq[symmetric], rule eq_rowI,insert assms,auto)


[STATEMENT]
lemma word_mult_less_mono1:
  fixes i :: "'a :: len word"
  assumes ij: "i < j"
  and    knz: "0 < k"
  and    ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)"
  shows  "i * k < j * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i * k < j * k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i * k < j * k
[PROOF STEP]
from ij ujk knz
[PROOF STATE]
proof (chain)
picking this:
i < j
unat j * unat k < 2 ^ LENGTH('a)
0 < k
[PROOF STEP]
have jk: "unat i * unat k < 2 ^ len_of TYPE ('a)"
[PROOF STATE]
proof (prove)
using this:
i < j
unat j * unat k < 2 ^ LENGTH('a)
0 < k

goal (1 subgoal):
 1. unat i * unat k < 2 ^ LENGTH('a)
[PROOF STEP]
by (auto intro: order_less_subst2 simp: word_less_nat_alt elim: mult_less_mono1)
[PROOF STATE]
proof (state)
this:
unat i * unat k < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. i * k < j * k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
unat i * unat k < 2 ^ LENGTH('a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
unat i * unat k < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. i * k < j * k
[PROOF STEP]
using ujk knz ij
[PROOF STATE]
proof (prove)
using this:
unat i * unat k < 2 ^ LENGTH('a)
unat j * unat k < 2 ^ LENGTH('a)
0 < k
i < j

goal (1 subgoal):
 1. i * k < j * k
[PROOF STEP]
by (auto simp: word_less_nat_alt iffD1 [OF unat_mult_lem])
[PROOF STATE]
proof (state)
this:
i * k < j * k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_nth[simp]: "\<lbrakk>i < length l; j<length l; k<length l\<rbrakk> \<Longrightarrow>
  swap l i j!k = (
    if k=i then l!j
    else if k=j then l!i
    else l!k
  )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l; k < length l\<rbrakk> \<Longrightarrow> swap l i j ! k = (if k = i then l ! j else if k = j then l ! i else l ! k)
[PROOF STEP]
unfolding swap_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l; k < length l\<rbrakk> \<Longrightarrow> l[i := l ! j, j := l ! i] ! k = (if k = i then l ! j else if k = j then l ! i else l ! k)
[PROOF STEP]
by auto


[STATEMENT]
lemma free_group_over_one_gen: "\<exists>h. h \<in> iso \<F>\<^bsub>{()}\<^esub> int_group"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
interpret int: group int_group
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group int_group
[PROOF STEP]
using int.a_group
[PROOF STATE]
proof (prove)
using this:
Group.group \<lparr>carrier = UNIV, monoid.mult = (+), one = 0, \<dots> = undefined\<rparr>

goal (1 subgoal):
 1. Group.group int_group
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
define f :: "unit \<Rightarrow> int" where "f x = 1" for x
[PROOF STATE]
proof (state)
this:
f ?x = 1

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have "f \<in> {()} \<rightarrow> carrier int_group"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {()} \<rightarrow> carrier int_group
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> {()} \<rightarrow> carrier int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
hence "int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group"
[PROOF STATE]
proof (prove)
using this:
f \<in> {()} \<rightarrow> carrier int_group

goal (1 subgoal):
 1. int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
by (rule int.lift_is_hom)
[PROOF STATE]
proof (state)
this:
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
interpret hom: group_hom "\<F>\<^bsub>{()}\<^esub>" int_group "int.lift f"
[PROOF STATE]
proof (prove)
using this:
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. group_hom \<F>\<^bsub>{()}\<^esub> int_group (int.lift f)
[PROOF STEP]
unfolding group_hom_def group_hom_axioms_def
[PROOF STATE]
proof (prove)
using this:
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. Group.group \<F>\<^bsub>{()}\<^esub> \<and> Group.group int_group \<and> int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
using int.a_group
[PROOF STATE]
proof (prove)
using this:
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
Group.group \<lparr>carrier = UNIV, monoid.mult = (+), one = 0, \<dots> = undefined\<rparr>

goal (1 subgoal):
 1. Group.group \<F>\<^bsub>{()}\<^esub> \<and> Group.group int_group \<and> int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
by(auto intro: free_group_is_group)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
(* This shows injectiveness of the given map *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
assume "x \<in> carrier \<F>\<^bsub>{()}\<^esub>"
[PROOF STATE]
proof (state)
this:
x \<in> carrier \<F>\<^bsub>{()}\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
hence "canceled x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier \<F>\<^bsub>{()}\<^esub>

goal (1 subgoal):
 1. canceled x
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
canceled x

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
assume "int.lift f x = (0::int)"
[PROOF STATE]
proof (state)
this:
int.lift f x = 0

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have "x = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = []
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
assume "x \<noteq> []"
[PROOF STATE]
proof (state)
this:
x \<noteq> []

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> []
[PROOF STEP]
obtain a and xs where "x = a # xs"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> []

goal (1 subgoal):
 1. (\<And>a xs. x = a # xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases x, auto)
[PROOF STATE]
proof (state)
this:
x = a # xs

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "length (takeWhile (\<lambda>y. y = a) x) > 0"
[PROOF STATE]
proof (prove)
using this:
x = a # xs

goal (1 subgoal):
 1. 0 < length (takeWhile (\<lambda>y. y = a) x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < length (takeWhile (\<lambda>y. y = a) x)

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < length (takeWhile (\<lambda>y. y = a) x)
[PROOF STEP]
obtain i where i: "length (takeWhile (\<lambda>y. y = a) x) = Suc i"
[PROOF STATE]
proof (prove)
using this:
0 < length (takeWhile (\<lambda>y. y = a) x)

goal (1 subgoal):
 1. (\<And>i. length (takeWhile (\<lambda>y. y = a) x) = Suc i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "length (takeWhile (\<lambda>y. y = a) x)", auto)
[PROOF STATE]
proof (state)
this:
length (takeWhile (\<lambda>y. y = a) x) = Suc i

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
have "Suc i \<ge> length x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length x \<le> Suc i
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
assume "\<not> length x \<le> Suc i"
[PROOF STATE]
proof (state)
this:
\<not> length x \<le> Suc i

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "length (takeWhile (\<lambda>y. y = a) x) < length x"
[PROOF STATE]
proof (prove)
using this:
\<not> length x \<le> Suc i

goal (1 subgoal):
 1. length (takeWhile (\<lambda>y. y = a) x) < length x
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
\<not> length x \<le> Suc i
length (takeWhile (\<lambda>y. y = a) x) = Suc i

goal (1 subgoal):
 1. length (takeWhile (\<lambda>y. y = a) x) < length x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (takeWhile (\<lambda>y. y = a) x) < length x

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "\<not> (\<lambda>y. y = a) (x ! length (takeWhile (\<lambda>y. y = a) x))"
[PROOF STATE]
proof (prove)
using this:
length (takeWhile (\<lambda>y. y = a) x) < length x

goal (1 subgoal):
 1. x ! length (takeWhile (\<lambda>y. y = a) x) \<noteq> a
[PROOF STEP]
by (rule nth_length_takeWhile)
[PROOF STATE]
proof (state)
this:
x ! length (takeWhile (\<lambda>y. y = a) x) \<noteq> a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "\<not> (\<lambda>y. y = a) (x ! Suc i)"
[PROOF STATE]
proof (prove)
using this:
x ! length (takeWhile (\<lambda>y. y = a) x) \<noteq> a

goal (1 subgoal):
 1. x ! Suc i \<noteq> a
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
x ! length (takeWhile (\<lambda>y. y = a) x) \<noteq> a
length (takeWhile (\<lambda>y. y = a) x) = Suc i

goal (1 subgoal):
 1. x ! Suc i \<noteq> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x ! Suc i \<noteq> a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "fst (x ! Suc i) \<noteq> fst a"
[PROOF STATE]
proof (prove)
using this:
x ! Suc i \<noteq> a

goal (1 subgoal):
 1. fst (x ! Suc i) \<noteq> fst a
[PROOF STEP]
by (cases "x ! Suc i", cases "a", auto)
[PROOF STATE]
proof (state)
this:
fst (x ! Suc i) \<noteq> fst a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fst (x ! Suc i) \<noteq> fst a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
fst (x ! Suc i) \<noteq> fst a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
have "takeWhile (\<lambda>y. y = a) x ! i = x ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. takeWhile (\<lambda>y. y = a) x ! i = x ! i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
length (takeWhile (\<lambda>y. y = a) x) = Suc i

goal (1 subgoal):
 1. takeWhile (\<lambda>y. y = a) x ! i = x ! i
[PROOF STEP]
by (auto intro: takeWhile_nth)
[PROOF STATE]
proof (state)
this:
takeWhile (\<lambda>y. y = a) x ! i = x ! i

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
takeWhile (\<lambda>y. y = a) x ! i = x ! i

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
have "(takeWhile (\<lambda>y. y = a) x) ! i \<in> set (takeWhile (\<lambda>y. y = a) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. takeWhile (\<lambda>y. y = a) x ! i \<in> set (takeWhile (\<lambda>y. y = a) x)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
length (takeWhile (\<lambda>y. y = a) x) = Suc i

goal (1 subgoal):
 1. takeWhile (\<lambda>y. y = a) x ! i \<in> set (takeWhile (\<lambda>y. y = a) x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
takeWhile (\<lambda>y. y = a) x ! i \<in> set (takeWhile (\<lambda>y. y = a) x)

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
takeWhile (\<lambda>y. y = a) x ! i = x ! i
takeWhile (\<lambda>y. y = a) x ! i \<in> set (takeWhile (\<lambda>y. y = a) x)
[PROOF STEP]
have "(\<lambda>y. y = a) (x ! i)"
[PROOF STATE]
proof (prove)
using this:
takeWhile (\<lambda>y. y = a) x ! i = x ! i
takeWhile (\<lambda>y. y = a) x ! i \<in> set (takeWhile (\<lambda>y. y = a) x)

goal (1 subgoal):
 1. x ! i = a
[PROOF STEP]
by (auto dest:set_takeWhileD)
[PROOF STATE]
proof (state)
this:
x ! i = a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x ! i = a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "fst (x ! i) = fst a"
[PROOF STATE]
proof (prove)
using this:
x ! i = a

goal (1 subgoal):
 1. fst (x ! i) = fst a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst (x ! i) = fst a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fst (x ! i) = fst a

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
have "snd (x ! i) = snd (x ! Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (x ! i) = snd (x ! Suc i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
snd (x ! i) = snd (x ! Suc i)

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fst (x ! Suc i) \<noteq> fst a
fst (x ! i) = fst a
snd (x ! i) = snd (x ! Suc i)
[PROOF STEP]
have "canceling (x ! i) (x ! Suc i)"
[PROOF STATE]
proof (prove)
using this:
fst (x ! Suc i) \<noteq> fst a
fst (x ! i) = fst a
snd (x ! i) = snd (x ! Suc i)

goal (1 subgoal):
 1. canceling (x ! i) (x ! Suc i)
[PROOF STEP]
unfolding canceling_def
[PROOF STATE]
proof (prove)
using this:
fst (x ! Suc i) \<noteq> fst a
fst (x ! i) = fst a
snd (x ! i) = snd (x ! Suc i)

goal (1 subgoal):
 1. snd (x ! i) = snd (x ! Suc i) \<and> fst (x ! i) \<noteq> fst (x ! Suc i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
canceling (x ! i) (x ! Suc i)

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "cancels_to_1_at i x (cancel_at i x)"
[PROOF STATE]
proof (prove)
using this:
canceling (x ! i) (x ! Suc i)

goal (1 subgoal):
 1. cancels_to_1_at i x (cancel_at i x)
[PROOF STEP]
using \<open>\<not> length x \<le> Suc i\<close>
[PROOF STATE]
proof (prove)
using this:
canceling (x ! i) (x ! Suc i)
\<not> length x \<le> Suc i

goal (1 subgoal):
 1. cancels_to_1_at i x (cancel_at i x)
[PROOF STEP]
unfolding cancels_to_1_at_def
[PROOF STATE]
proof (prove)
using this:
canceling (x ! i) (x ! Suc i)
\<not> length x \<le> Suc i

goal (1 subgoal):
 1. 0 \<le> i \<and> 1 + i < length x \<and> canceling (x ! i) (x ! (1 + i)) \<and> cancel_at i x = cancel_at i x
[PROOF STEP]
by (auto simp add:length_takeWhile_le)
[PROOF STATE]
proof (state)
this:
cancels_to_1_at i x (cancel_at i x)

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "cancels_to_1 x (cancel_at i x)"
[PROOF STATE]
proof (prove)
using this:
cancels_to_1_at i x (cancel_at i x)

goal (1 subgoal):
 1. cancels_to_1 x (cancel_at i x)
[PROOF STEP]
unfolding cancels_to_1_def
[PROOF STATE]
proof (prove)
using this:
cancels_to_1_at i x (cancel_at i x)

goal (1 subgoal):
 1. \<exists>ia. cancels_to_1_at ia x (cancel_at i x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cancels_to_1 x (cancel_at i x)

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
hence "\<not> canceled x"
[PROOF STATE]
proof (prove)
using this:
cancels_to_1 x (cancel_at i x)

goal (1 subgoal):
 1. \<not> canceled x
[PROOF STEP]
unfolding canceled_def
[PROOF STATE]
proof (prove)
using this:
cancels_to_1 x (cancel_at i x)

goal (1 subgoal):
 1. \<not> \<not> Domainp cancels_to_1 x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> canceled x

goal (1 subgoal):
 1. \<not> length x \<le> Suc i \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
\<not> canceled x

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>canceled x\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> canceled x
canceled x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length x \<le> Suc i

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "length (takeWhile (\<lambda>y. y = a) x) = length x"
[PROOF STATE]
proof (prove)
using this:
length x \<le> Suc i

goal (1 subgoal):
 1. length (takeWhile (\<lambda>y. y = a) x) = length x
[PROOF STEP]
using i[THEN sym]
[PROOF STATE]
proof (prove)
using this:
length x \<le> Suc i
Suc i = length (takeWhile (\<lambda>y. y = a) x)

goal (1 subgoal):
 1. length (takeWhile (\<lambda>y. y = a) x) = length x
[PROOF STEP]
by (auto dest:le_antisym simp add:length_takeWhile_le)
[PROOF STATE]
proof (state)
this:
length (takeWhile (\<lambda>y. y = a) x) = length x

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "takeWhile (\<lambda>y. y = a) x = x"
[PROOF STATE]
proof (prove)
using this:
length (takeWhile (\<lambda>y. y = a) x) = length x

goal (1 subgoal):
 1. takeWhile (\<lambda>y. y = a) x = x
[PROOF STEP]
by (subst takeWhile_eq_take, simp)
[PROOF STATE]
proof (state)
this:
takeWhile (\<lambda>y. y = a) x = x

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
takeWhile (\<lambda>y. y = a) x = x

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
have "\<forall>y \<in> set (takeWhile (\<lambda>y. y = a) x). y = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>set (takeWhile (\<lambda>y. y = a) x). y = a
[PROOF STEP]
by (auto dest: set_takeWhileD)
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>set (takeWhile (\<lambda>y. y = a) x). y = a

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
takeWhile (\<lambda>y. y = a) x = x
\<forall>y\<in>set (takeWhile (\<lambda>y. y = a) x). y = a
[PROOF STEP]
have "\<forall>y \<in> set x. y = a"
[PROOF STATE]
proof (prove)
using this:
takeWhile (\<lambda>y. y = a) x = x
\<forall>y\<in>set (takeWhile (\<lambda>y. y = a) x). y = a

goal (1 subgoal):
 1. \<forall>y\<in>set x. y = a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>set x. y = a

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "x = replicate (length x) a"
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>set x. y = a

goal (1 subgoal):
 1. x = replicate (length x) a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = replicate (length x) a

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "int.lift f x = int.lift f (replicate (length x) a)"
[PROOF STATE]
proof (prove)
using this:
x = replicate (length x) a

goal (1 subgoal):
 1. int.lift f x = int.lift f (replicate (length x) a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int.lift f x = int.lift f (replicate (length x) a)

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int.lift f x = int.lift f (replicate (length x) a)

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
have "... = pow int_group (int.lift_gi f a) (length x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int.lift f (replicate (length x) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x
[PROOF STEP]
apply (induct x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. int.lift f (replicate (length []) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length []
 2. \<And>aa x. int.lift f (replicate (length x) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x \<Longrightarrow> int.lift f (replicate (length (aa # x)) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length (aa # x)
[PROOF STEP]
using local.int.nat_pow_Suc local.int.nat_pow_0
[PROOF STATE]
proof (prove)
using this:
?x [^]\<^bsub>int_group\<^esub> Suc ?n = ?x [^]\<^bsub>int_group\<^esub> ?n \<otimes>\<^bsub>int_group\<^esub> ?x
?x [^]\<^bsub>int_group\<^esub> 0 = \<one>\<^bsub>int_group\<^esub>

goal (2 subgoals):
 1. int.lift f (replicate (length []) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length []
 2. \<And>aa x. int.lift f (replicate (length x) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x \<Longrightarrow> int.lift f (replicate (length (aa # x)) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length (aa # x)
[PROOF STEP]
apply (auto simp: int.lift_def [simplified])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
int.lift f (replicate (length x) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int.lift f (replicate (length x) a) = int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
have "... = (int.lift_gi f a) * int (length x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x = int.lift_gi f a * int (length x)
[PROOF STEP]
apply (induct x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. int.lift_gi f a [^]\<^bsub>int_group\<^esub> length [] = int.lift_gi f a * int (length [])
 2. \<And>aa x. int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x = int.lift_gi f a * int (length x) \<Longrightarrow> int.lift_gi f a [^]\<^bsub>int_group\<^esub> length (aa # x) = int.lift_gi f a * int (length (aa # x))
[PROOF STEP]
using local.int.nat_pow_Suc local.int.nat_pow_0
[PROOF STATE]
proof (prove)
using this:
?x [^]\<^bsub>int_group\<^esub> Suc ?n = ?x [^]\<^bsub>int_group\<^esub> ?n \<otimes>\<^bsub>int_group\<^esub> ?x
?x [^]\<^bsub>int_group\<^esub> 0 = \<one>\<^bsub>int_group\<^esub>

goal (2 subgoals):
 1. int.lift_gi f a [^]\<^bsub>int_group\<^esub> length [] = int.lift_gi f a * int (length [])
 2. \<And>aa x. int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x = int.lift_gi f a * int (length x) \<Longrightarrow> int.lift_gi f a [^]\<^bsub>int_group\<^esub> length (aa # x) = int.lift_gi f a * int (length (aa # x))
[PROOF STEP]
by (auto simp: int_distrib)
[PROOF STATE]
proof (state)
this:
int.lift_gi f a [^]\<^bsub>int_group\<^esub> length x = int.lift_gi f a * int (length x)

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int.lift f x = int.lift_gi f a * int (length x)
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
using this:
int.lift f x = int.lift_gi f a * int (length x)

goal (1 subgoal):
 1. int.lift_gi f a * int (length x) = 0
[PROOF STEP]
using \<open>int.lift f x = 0\<close>
[PROOF STATE]
proof (prove)
using this:
int.lift f x = int.lift_gi f a * int (length x)
int.lift f x = 0

goal (1 subgoal):
 1. int.lift_gi f a * int (length x) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int.lift_gi f a * int (length x) = 0

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "nat (abs (group.lift_gi int_group f a * int (length x))) = 0"
[PROOF STATE]
proof (prove)
using this:
int.lift_gi f a * int (length x) = 0

goal (1 subgoal):
 1. nat \<bar>int.lift_gi f a * int (length x)\<bar> = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat \<bar>int.lift_gi f a * int (length x)\<bar> = 0

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "nat (abs (group.lift_gi int_group f a)) * length x = 0"
[PROOF STATE]
proof (prove)
using this:
nat \<bar>int.lift_gi f a * int (length x)\<bar> = 0

goal (1 subgoal):
 1. nat \<bar>int.lift_gi f a\<bar> * length x = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat \<bar>int.lift_gi f a\<bar> * length x = 0

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "nat (abs (group.lift_gi int_group f a)) = 0"
[PROOF STATE]
proof (prove)
using this:
nat \<bar>int.lift_gi f a\<bar> * length x = 0

goal (1 subgoal):
 1. nat \<bar>int.lift_gi f a\<bar> = 0
[PROOF STEP]
using \<open>x \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
nat \<bar>int.lift_gi f a\<bar> * length x = 0
x \<noteq> []

goal (1 subgoal):
 1. nat \<bar>int.lift_gi f a\<bar> = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat \<bar>int.lift_gi f a\<bar> = 0

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nat \<bar>int.lift_gi f a\<bar> = 0

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
have "inv\<^bsub>int_group\<^esub> 1 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^bsub>int_group\<^esub> 1 = - 1
[PROOF STEP]
using int.inv_equality
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<otimes>\<^bsub>int_group\<^esub> ?x = \<one>\<^bsub>int_group\<^esub>; ?x \<in> carrier int_group; ?y \<in> carrier int_group\<rbrakk> \<Longrightarrow> inv\<^bsub>int_group\<^esub> ?x = ?y

goal (1 subgoal):
 1. inv\<^bsub>int_group\<^esub> 1 = - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv\<^bsub>int_group\<^esub> 1 = - 1

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
hence "abs (group.lift_gi int_group f a) = 1"
[PROOF STATE]
proof (prove)
using this:
inv\<^bsub>int_group\<^esub> 1 = - 1

goal (1 subgoal):
 1. \<bar>int.lift_gi f a\<bar> = 1
[PROOF STEP]
using int.is_group
[PROOF STATE]
proof (prove)
using this:
inv\<^bsub>int_group\<^esub> 1 = - 1
Group.group int_group

goal (1 subgoal):
 1. \<bar>int.lift_gi f a\<bar> = 1
[PROOF STEP]
by(auto simp add: group.lift_gi_def f_def)
[PROOF STATE]
proof (state)
this:
\<bar>int.lift_gi f a\<bar> = 1

goal (1 subgoal):
 1. x \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
nat \<bar>int.lift_gi f a\<bar> = 0
\<bar>int.lift_gi f a\<bar> = 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
nat \<bar>int.lift_gi f a\<bar> = 0
\<bar>int.lift_gi f a\<bar> = 1

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = []

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x3 \<in> carrier \<F>\<^bsub>{()}\<^esub>; int.lift f ?x3 = 0\<rbrakk> \<Longrightarrow> ?x3 = []

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
hence "\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3 \<in> carrier \<F>\<^bsub>{()}\<^esub>; int.lift f ?x3 = 0\<rbrakk> \<Longrightarrow> ?x3 = []

goal (1 subgoal):
 1. \<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
[PROOF STEP]
by (auto simp add:free_group_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have "carrier \<F>\<^bsub>{()}\<^esub> = \<langle>insert`{()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier \<F>\<^bsub>{()}\<^esub> = \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
[PROOF STEP]
by (rule gens_span_free_group[THEN sym])
[PROOF STATE]
proof (state)
this:
carrier \<F>\<^bsub>{()}\<^esub> = \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
carrier \<F>\<^bsub>{()}\<^esub> = \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have "carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>
[PROOF STEP]
by (rule int_group_gen_by_one[THEN sym])
[PROOF STATE]
proof (state)
this:
carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have "int.lift f ` insert ` {()} = {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int.lift f ` \<iota> ` {()} = {1}
[PROOF STEP]
by (auto simp add: int.lift_def [simplified] insert_def f_def int.lift_gi_def [simplified])
[PROOF STATE]
proof (state)
this:
int.lift f ` \<iota> ` {()} = {1}

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int.lift f ` \<iota> ` {()} = {1}

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
have  "int.lift f ` \<langle>insert`{()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> = \<langle>int.lift f ` (insert `{()})\<rangle>\<^bsub>int_group\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int.lift f ` \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> = \<langle>int.lift f ` \<iota> ` {()}\<rangle>\<^bsub>int_group\<^esub>
[PROOF STEP]
by (rule hom.hom_span, auto intro:insert_closed)
[PROOF STATE]
proof (state)
this:
int.lift f ` \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> = \<langle>int.lift f ` \<iota> ` {()}\<rangle>\<^bsub>int_group\<^esub>

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
carrier \<F>\<^bsub>{()}\<^esub> = \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>
int.lift f ` \<iota> ` {()} = {1}
int.lift f ` \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> = \<langle>int.lift f ` \<iota> ` {()}\<rangle>\<^bsub>int_group\<^esub>
[PROOF STEP]
have "int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group"
[PROOF STATE]
proof (prove)
using this:
carrier \<F>\<^bsub>{()}\<^esub> = \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
carrier int_group = \<langle>{1}\<rangle>\<^bsub>int_group\<^esub>
int.lift f ` \<iota> ` {()} = {1}
int.lift f ` \<langle>\<iota> ` {()}\<rangle>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> = \<langle>int.lift f ` \<iota> ` {()}\<rangle>\<^bsub>int_group\<^esub>

goal (1 subgoal):
 1. int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group
[PROOF STEP]
have "int.lift f \<in> iso \<F>\<^bsub>{()}\<^esub> int_group"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group

goal (1 subgoal):
 1. int.lift f \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
using \<open>int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. int.lift f \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
using hom.hom_mult int.is_group
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>carrier \<F>\<^bsub>{()}\<^esub>. int.lift f x = \<one>\<^bsub>int_group\<^esub> \<longrightarrow> x = \<one>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub>
int.lift f ` carrier \<F>\<^bsub>{()}\<^esub> = carrier int_group
int.lift f \<in> hom \<F>\<^bsub>{()}\<^esub> int_group
\<lbrakk>?x \<in> carrier \<F>\<^bsub>{()}\<^esub>; ?y \<in> carrier \<F>\<^bsub>{()}\<^esub>\<rbrakk> \<Longrightarrow> int.lift f (?x \<otimes>\<^bsub>\<F>\<^bsub>{()}\<^esub>\<^esub> ?y) = int.lift f ?x \<otimes>\<^bsub>int_group\<^esub> int.lift f ?y
Group.group int_group

goal (1 subgoal):
 1. int.lift f \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
by (auto intro:group_isoI simp add: free_group_is_group)
[PROOF STATE]
proof (state)
this:
int.lift f \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
int.lift f \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group

goal (1 subgoal):
 1. \<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>h. h \<in> Group.iso \<F>\<^bsub>{()}\<^esub> int_group

goal:
No subgoals!
[PROOF STEP]
qed