[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 Max_lem1: "\<lbrakk> pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk>
    \<Longrightarrow> pc' \<le> Max (insert x (max_next_pcs bp))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> pc' \<le> Max (insert x (max_next_pcs bp))
[PROOF STEP]
apply(rule le_Max_insertI2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> finite (max_next_pcs bp)
 2. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> max_next_pcs bp \<noteq> {}
 3. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> pc' \<le> Max (max_next_pcs bp)
[PROOF STEP]
apply (simp add: finite_max_next_pcs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> max_next_pcs bp \<noteq> {}
 2. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> pc' \<le> Max (max_next_pcs bp)
[PROOF STEP]
apply(simp add: max_next_pcs_not_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pc < length bp; (pc', s') \<in> set (exec (bp ! pc) (pc, s))\<rbrakk> \<Longrightarrow> pc' \<le> Max (max_next_pcs bp)
[PROOF STEP]
apply(auto intro!: Max_lem2 simp del:exec.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fds_exp_times_fds_nth_0:
  "fds_const (exp (fds_nth f (Suc 0))) * fds_exp (f - fds_const (fds_nth f (Suc 0))) = fds_exp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_const (exp (fds_nth f (Suc 0))) * fds_exp (f - fds_const (fds_nth f (Suc 0))) = fds_exp f
[PROOF STEP]
by (rule fds_eqI) (simp add: fds_exp_def fds_nth_fds' cong: if_cong)


[STATEMENT]
lemma Brouwer_degree2_homotopic:
  assumes "homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) f g"
  shows "Brouwer_degree2 p f = Brouwer_degree2 p g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Brouwer_degree2 p f = Brouwer_degree2 p g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Brouwer_degree2 p f = Brouwer_degree2 p g
[PROOF STEP]
have "continuous_map (nsphere p) (nsphere p) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) f
[PROOF STEP]
using homotopic_with_imp_continuous_maps [OF assms]
[PROOF STATE]
proof (prove)
using this:
continuous_map (nsphere p) (nsphere p) f \<and> continuous_map (nsphere p) (nsphere p) g

goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_map (nsphere p) (nsphere p) f

goal (1 subgoal):
 1. Brouwer_degree2 p f = Brouwer_degree2 p g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Brouwer_degree2 p f = Brouwer_degree2 p g
[PROOF STEP]
using Brouwer_degree2_def assms homology_homotopy_empty
[PROOF STATE]
proof (prove)
using this:
Brouwer_degree2 ?p ?f \<equiv> SOME d. \<forall>x\<in>carrier (reduced_homology_group (int ?p) (nsphere ?p)). hom_induced (int ?p) (nsphere ?p) {} (nsphere ?p) {} ?f x = x [^]\<^bsub>reduced_homology_group (int ?p) (nsphere ?p)\<^esub> d
homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) f g
homotopic_with (\<lambda>h. True) ?X ?Y ?f ?g \<Longrightarrow> hom_induced ?p ?X {} ?Y {} ?f = hom_induced ?p ?X {} ?Y {} ?g

goal (1 subgoal):
 1. Brouwer_degree2 p f = Brouwer_degree2 p g
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Brouwer_degree2 p f = Brouwer_degree2 p g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_dependent_iff_dependent2:
  assumes "a \<in> S"
  shows "affine_dependent S \<longleftrightarrow> dependent ((\<lambda>x. -a + x) ` (S-{a}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine_dependent S = dependent ((+) (- a) ` (S - {a}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine_dependent S = dependent ((+) (- a) ` (S - {a}))
[PROOF STEP]
have "insert a (S - {a}) = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a (S - {a}) = S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> S

goal (1 subgoal):
 1. insert a (S - {a}) = S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert a (S - {a}) = S

goal (1 subgoal):
 1. affine_dependent S = dependent ((+) (- a) ` (S - {a}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insert a (S - {a}) = S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
insert a (S - {a}) = S

goal (1 subgoal):
 1. affine_dependent S = dependent ((+) (- a) ` (S - {a}))
[PROOF STEP]
using assms affine_dependent_iff_dependent[of a "S-{a}"]
[PROOF STATE]
proof (prove)
using this:
insert a (S - {a}) = S
a \<in> S
a \<notin> S - {a} \<Longrightarrow> affine_dependent (insert a (S - {a})) = dependent ((+) (- a) ` (S - {a}))

goal (1 subgoal):
 1. affine_dependent S = dependent ((+) (- a) ` (S - {a}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine_dependent S = dependent ((+) (- a) ` (S - {a}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in encoding) fully_abstract_wrt_target_relation:
  fixes RelT :: "('procT \<times> 'procT) set"
  shows "\<exists>RelS. fully_abstract RelS RelT"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
define RelS where "RelS = {(S1, S2). (\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT}"
[PROOF STATE]
proof (state)
this:
RelS = _Collect (S1, S2) ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)

goal (1 subgoal):
 1. \<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
hence "fully_abstract RelS RelT"
[PROOF STATE]
proof (prove)
using this:
RelS = _Collect (S1, S2) ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)

goal (1 subgoal):
 1. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)

goal (1 subgoal):
 1. \<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
thus "\<exists>RelS. fully_abstract RelS RelT"
[PROOF STATE]
proof (prove)
using this:
\<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)

goal (1 subgoal):
 1. \<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>RelS. \<forall>S1 S2. ((S1, S2) \<in> RelS) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> RelT)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graph_extI:
  "(\<And>x. x \<in> H \<Longrightarrow> h x = h' x) \<Longrightarrow> H \<subseteq> H'
    \<Longrightarrow> graph H h \<subseteq> graph H' h'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> H \<Longrightarrow> h x = h' x; H \<subseteq> H'\<rbrakk> \<Longrightarrow> graph H h \<subseteq> graph H' h'
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> H \<Longrightarrow> h x = h' x; H \<subseteq> H'\<rbrakk> \<Longrightarrow> {(x, h x) |x. x \<in> H} \<subseteq> {(x, h' x) |x. x \<in> H'}
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_on_power' [continuous_intros]:
  fixes f :: "_ \<Rightarrow> 'b::topological_monoid_mult"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. f x ^ g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. f x ^ g x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. (f \<longlongrightarrow> f x) (at x within A); \<forall>x\<in>A. (g \<longlongrightarrow> g x) (at x within A)\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. ((\<lambda>x. f x ^ g x) \<longlongrightarrow> f x ^ g x) (at x within A)
[PROOF STEP]
by (auto intro: tendsto_power_strong)


[STATEMENT]
lemma tendsto_snd [tendsto_intros]:
  assumes "(f \<longlongrightarrow> a) F"
  shows "((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F
[PROOF STEP]
proof (rule topological_tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
assume "open S" and "snd a \<in> S"
[PROOF STATE]
proof (state)
this:
open S
snd a \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
snd a \<in> S
[PROOF STEP]
have "open (snd -` S)" and "a \<in> snd -` S"
[PROOF STATE]
proof (prove)
using this:
open S
snd a \<in> S

goal (1 subgoal):
 1. open (snd -` S) &&& a \<in> snd -` S
[PROOF STEP]
by (simp_all add: open_vimage_snd)
[PROOF STATE]
proof (state)
this:
open (snd -` S)
a \<in> snd -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> a) F
open (snd -` S)
a \<in> snd -` S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> snd -` S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> a) F
open (snd -` S)
a \<in> snd -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> snd -` S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; snd a \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S
[PROOF STEP]
show "eventually (\<lambda>x. snd (f x) \<in> S) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> snd -` S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. snd (f x) \<in> S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. snd (f x) \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) nonzero_pow_nonzero:
  assumes "a \<in> carrier R"
  assumes "a \<noteq>\<zero>"
  shows "a[^](n::nat) \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] n \<noteq> \<zero>
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a [^] 0 \<noteq> \<zero>
 2. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. a [^] 0 \<noteq> \<zero>
 2. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] 0 \<noteq> \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a [^] 0 \<noteq> \<zero>

goal (1 subgoal):
 1. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
a [^] n \<noteq> \<zero>

goal (1 subgoal):
 1. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
fix n::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
assume IH: "a[^] n \<noteq> \<zero>"
[PROOF STATE]
proof (state)
this:
a [^] n \<noteq> \<zero>

goal (1 subgoal):
 1. \<And>n. a [^] n \<noteq> \<zero> \<Longrightarrow> a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
show "a[^] (Suc n) \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
have "a[^] (Suc n) = a[^] n \<otimes> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] Suc n = a [^] n \<otimes> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a [^] Suc n = a [^] n \<otimes> a

goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a [^] Suc n = a [^] n \<otimes> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a [^] Suc n = a [^] n \<otimes> a

goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
using assms IH
[PROOF STATE]
proof (prove)
using this:
a [^] Suc n = a [^] n \<otimes> a
a \<in> carrier R
a \<noteq> \<zero>
a [^] n \<noteq> \<zero>

goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
using IH assms(1) assms(2) local.integral
[PROOF STATE]
proof (prove)
using this:
a [^] Suc n = a [^] n \<otimes> a
a \<in> carrier R
a \<noteq> \<zero>
a [^] n \<noteq> \<zero>
a [^] n \<noteq> \<zero>
a \<in> carrier R
a \<noteq> \<zero>
\<lbrakk>?a \<otimes> ?b = \<zero>; ?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> ?a = \<zero> \<or> ?b = \<zero>

goal (1 subgoal):
 1. a [^] Suc n \<noteq> \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a [^] Suc n \<noteq> \<zero>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a [^] Suc n \<noteq> \<zero>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ord_odiff_eq:
  assumes "\<alpha> \<le> \<beta>" "Ord \<alpha>" "Ord \<beta>"
  shows "\<alpha> + odiff \<beta> \<alpha> = \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> + odiff \<beta> \<alpha> = \<beta>
[PROOF STEP]
by (simp add: assms vle_iff_le_Ord vle_imp_odiff_eq)


[STATEMENT]
lemma leading_coeff_0_iff [simp]: "coeff p (degree p) = 0 \<longleftrightarrow> p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (coeff p (degree p) = (0::'a)) = (p = 0)
[PROOF STEP]
by (cases "p = 0") (simp_all add: leading_coeff_neq_0)


[STATEMENT]
lemma sum_atMost_remove_nat:
  assumes "k \<le> (n :: nat)"
  shows "(\<Sum>i\<le>n. f i) = f k + (\<Sum>i\<in>{..n}-{k}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = f k + sum f ({..n} - {k})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. sum f {..n} = f k + sum f ({..n} - {k})
[PROOF STEP]
by (auto simp add: sum.remove[where x=k])


[STATEMENT]
lemma bangRelSubset:
  fixes Rel  :: "(ccs \<times> ccs) set"
  and   Rel' :: "(ccs \<times> ccs) set"

  assumes "(P, Q) \<in> bangRel Rel"
  and     "\<And>P Q. (P, Q) \<in> Rel \<Longrightarrow> (P, Q) \<in> Rel'"

  shows "(P, Q) \<in> bangRel Rel'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P, Q) \<in> bangRel Rel'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(P, Q) \<in> bangRel Rel
(?P, ?Q) \<in> Rel \<Longrightarrow> (?P, ?Q) \<in> Rel'

goal (1 subgoal):
 1. (P, Q) \<in> bangRel Rel'
[PROOF STEP]
by(induct rule:  bangRel.induct) (auto intro: BRBang BRPar)


[STATEMENT]
lemma Rep_Abs_mod: "Rep (Abs (m mod int CARD ('a))) = m mod int CARD ('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep (Abs (m mod int CARD('a))) = m mod int CARD('a)
[PROOF STEP]
using size0
[PROOF STATE]
proof (prove)
using this:
0 < int CARD('a)

goal (1 subgoal):
 1. Rep (Abs (m mod int CARD('a))) = m mod int CARD('a)
[PROOF STEP]
by (auto simp add: Abs_inverse)


[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 trunc_bound_euclE:
  obtains err where
  "\<bar>err\<bar> \<le> snd (trunc_bound_eucl p x)"
  "fst (trunc_bound_eucl p x) = x + err"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>err. \<lbrakk>\<bar>err\<bar> \<le> snd (trunc_bound_eucl p x); fst (trunc_bound_eucl p x) = x + err\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof atomize_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err
[PROOF STEP]
have "fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)"
    (is "_ = _ + ?err")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)
[PROOF STEP]
by (simp_all add: trunc_bound_eucl_def Let_def)
[PROOF STATE]
proof (state)
this:
fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)

goal (1 subgoal):
 1. \<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)

goal (1 subgoal):
 1. \<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err
[PROOF STEP]
have "abs ?err \<le> snd (trunc_bound_eucl p x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>eucl_truncate_down p x - x\<bar> \<le> snd (trunc_bound_eucl p x)
[PROOF STEP]
by (simp add: trunc_bound_eucl_def Let_def eucl_truncate_up)
[PROOF STATE]
proof (state)
this:
\<bar>eucl_truncate_down p x - x\<bar> \<le> snd (trunc_bound_eucl p x)

goal (1 subgoal):
 1. \<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)
\<bar>eucl_truncate_down p x - x\<bar> \<le> snd (trunc_bound_eucl p x)
[PROOF STEP]
show "\<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err"
[PROOF STATE]
proof (prove)
using this:
fst (trunc_bound_eucl p x) = x + (eucl_truncate_down p x - x)
\<bar>eucl_truncate_down p x - x\<bar> \<le> snd (trunc_bound_eucl p x)

goal (1 subgoal):
 1. \<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>err. \<bar>err\<bar> \<le> snd (trunc_bound_eucl p x) \<and> fst (trunc_bound_eucl p x) = x + err

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_mult_zero[simp]:
  fixes a :: ereal
  shows "a * 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * 0 = 0
[PROOF STEP]
by (cases a) (simp_all add: zero_ereal_def)


[STATEMENT]
lemma split_scaleC_pos_le: "(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a *\<^sub>C b"
  for b :: "'a::ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a \<and> (0::'a) \<le> b \<or> a \<le> 0 \<and> b \<le> (0::'a) \<Longrightarrow> (0::'a) \<le> a *\<^sub>C b
[PROOF STEP]
by (auto simp: scaleC_nonneg_nonneg scaleC_nonpos_nonpos)


[STATEMENT]
lemma iMin_greaterThanLessThan: "Suc m < n \<Longrightarrow> iMin {m<..<n} = Suc m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc m < n \<Longrightarrow> iMin {m<..<n} = Suc m
[PROOF STEP]
by (simp only: atLeastSucLessThan_greaterThanLessThan[symmetric] iMin_atLeastLessThan)


[STATEMENT]
lemma ge_comm0:
  assumes "A B Ge C D"
  shows "B A Ge D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B AGe D C
[PROOF STEP]
by (meson assms ge_left_comm ge_right_comm)


[STATEMENT]
lemma tw_is_semialg:
  assumes "n > 0"
  assumes "is_semialgebraic n S"
  assumes "n \<ge> i + j"
  shows "is_semialgebraic n ((tw i j)`S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic n (tw i j ` S)
[PROOF STEP]
unfolding tw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic n (permute_list (tp_1 j i) ` S)
[PROOF STEP]
using assms tp_1_permutes'[of j i "n - (j + i)"]
        permutation_is_semialgebraic[of n S]
[PROOF STATE]
proof (prove)
using this:
0 < n
is_semialgebraic n S
i + j \<le> n
tp_1 j i permutes {..<j + i + (n - (j + i))}
\<lbrakk>is_semialgebraic n S; ?\<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> is_semialgebraic n (permute_list ?\<sigma> ` S)

goal (1 subgoal):
 1. is_semialgebraic n (permute_list (tp_1 j i) ` S)
[PROOF STEP]
by (metis add.commute le_add_diff_inverse)


[STATEMENT]
lemma closed_cball [iff]: "closed (cball x e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
have "closed (dist x -` {..e})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (dist x -` {..e})
[PROOF STEP]
by (intro closed_vimage closed_atMost continuous_intros)
[PROOF STATE]
proof (state)
this:
closed (dist x -` {..e})

goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closed (dist x -` {..e})

goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
have "dist x -` {..e} = cball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x -` {..e} = cball x e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x -` {..e} = cball x e

goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed (cball x e)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed (cball x e)

goal (1 subgoal):
 1. closed (cball x e)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
closed (cball x e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in prob_space) distributed_affineI:
  fixes f :: "real \<Rightarrow> ennreal" and c :: real
  assumes f: "distributed M lborel (\<lambda>x. (X x - t) / c) (\<lambda>x. \<bar>c\<bar> * f (x * c + t))"
  assumes c: "c \<noteq> 0"
  shows "distributed M lborel X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel X f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distributed M lborel X f
[PROOF STEP]
have eq: "f x * ennreal \<bar>c\<bar> / ennreal \<bar>c\<bar> = f x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x * ennreal \<bar>c\<bar> / ennreal \<bar>c\<bar> = f x
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. f x * ennreal \<bar>c\<bar> / ennreal \<bar>c\<bar> = f x
[PROOF STEP]
by (simp add: ennreal_times_divide[symmetric])
[PROOF STATE]
proof (state)
this:
f ?x12 * ennreal \<bar>c\<bar> / ennreal \<bar>c\<bar> = f ?x12

goal (1 subgoal):
 1. distributed M lborel X f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel X f
[PROOF STEP]
using distributed_affine[OF f c, where t=t] c
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. t + c * ((X x - t) / c)) (\<lambda>x. ennreal \<bar>c\<bar> * f ((x - t) / c * c + t) / ennreal \<bar>c\<bar>)
c \<noteq> 0

goal (1 subgoal):
 1. distributed M lborel X f
[PROOF STEP]
by (simp add: field_simps eq)
[PROOF STATE]
proof (state)
this:
distributed M lborel X f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_convergent_prod_altdef:
  fixes f :: "nat \<Rightarrow> 'a :: {one,real_normed_vector}"
  shows  "abs_convergent_prod f \<longleftrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod f = convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. abs_convergent_prod f \<Longrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a)))
 2. convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a))) \<Longrightarrow> abs_convergent_prod f
[PROOF STEP]
assume "abs_convergent_prod f"
[PROOF STATE]
proof (state)
this:
abs_convergent_prod f

goal (2 subgoals):
 1. abs_convergent_prod f \<Longrightarrow> convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a)))
 2. convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a))) \<Longrightarrow> abs_convergent_prod f
[PROOF STEP]
thus "convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - 1))"
[PROOF STATE]
proof (prove)
using this:
abs_convergent_prod f

goal (1 subgoal):
 1. convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a)))
[PROOF STEP]
by (auto simp: abs_convergent_prod_def intro!: convergent_prod_imp_convergent)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a)))

goal (1 subgoal):
 1. convergent (\<lambda>n. \<Prod>i\<le>n. 1 + norm (f i - (1::'a))) \<Longrightarrow> abs_convergent_prod f
[PROOF STEP]
qed (auto intro: abs_convergent_prodI)


[STATEMENT]
lemma Fvars_instInpP[simp]:
assumes "\<phi> \<in> fmla" and \<tau>: "\<tau> \<in> ptrm n"  "Variable (Suc (Suc n)) \<notin> Fvars \<phi>"
shows "Fvars (instInpP \<phi> n \<tau>) = Fvars \<phi> - {inp} \<union> Variable ` {(Suc 0)..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fvars (instInpP \<phi> n \<tau>) = Fvars \<phi> - {inp} \<union> Variable ` {Suc 0..n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> fmla
\<tau> \<in> ptrm n
Variable (Suc (Suc n)) \<notin> Fvars \<phi>

goal (1 subgoal):
 1. Fvars (instInpP \<phi> n \<tau>) = Fvars \<phi> - {inp} \<union> Variable ` {Suc 0..n}
[PROOF STEP]
unfolding instInpP_def Let_def ptrm_def
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> fmla
\<tau> \<in> {\<sigma> \<in> fmla. Fvars \<sigma> = Variable ` {0..n} \<and> prv (exu out \<sigma>)}
Variable (Suc (Suc n)) \<notin> Fvars \<phi>

goal (1 subgoal):
 1. Fvars (exi (Variable (Suc (Suc n))) (cnj (subst \<tau> (Var (Variable (Suc (Suc n)))) out) (subst \<phi> (Var (Variable (Suc (Suc n)))) inp))) = Fvars \<phi> - {inp} \<union> Variable ` {Suc 0..n}
[PROOF STEP]
by auto


[STATEMENT]
theorem TESL_interp_unfold_stepwise_positive_atoms:
  assumes \<open>positive_atom \<phi>\<close>
    shows \<open>\<lbrakk> \<phi>::'\<tau>::linordered_field TESL_atomic \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L
            = \<Union> {Y. \<exists>n::nat. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
[PROOF STEP]
from positive_atom.elims(2)[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(\<And>uu_ uv_ uw_. \<phi> = uu_ sporadic uv_ on uw_ \<Longrightarrow> ?P) \<Longrightarrow> ?P
[PROOF STEP]
obtain u v w where \<open>\<phi> = (u sporadic v on w)\<close>
[PROOF STATE]
proof (prove)
using this:
(\<And>uu_ uv_ uw_. \<phi> = uu_ sporadic uv_ on uw_ \<Longrightarrow> ?P) \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>u v w. \<phi> = u sporadic v on w \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<phi> = u sporadic v on w

goal (1 subgoal):
 1. \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
[PROOF STEP]
with TESL_interp_unfold_stepwise_sporadicon
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk> ?K\<^sub>1 sporadic ?\<tau> on ?K\<^sub>2 \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> ?K\<^sub>1 sporadic ?\<tau> on ?K\<^sub>2 \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
\<phi> = u sporadic v on w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk> ?K\<^sub>1 sporadic ?\<tau> on ?K\<^sub>2 \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> ?K\<^sub>1 sporadic ?\<tau> on ?K\<^sub>2 \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
\<phi> = u sporadic v on w

goal (1 subgoal):
 1. \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L = \<Union> {Y. \<exists>n. Y = \<lbrakk> \<phi> \<rbrakk>\<^sub>T\<^sub>E\<^sub>S\<^sub>L\<^bsup>\<ge> n\<^esup>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_XpZ:
  shows "Complex_Matrix.unitary XpZ"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary XpZ
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.unitary XpZ
[PROOF STEP]
have "Complex_Matrix.adjoint XpZ * XpZ = (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2
[PROOF STEP]
using XpZ_inv XpZ_hermitian
[PROOF STATE]
proof (prove)
using this:
XpZ * XpZ = 1\<^sub>m 2
hermitian XpZ

goal (1 subgoal):
 1. Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
using this:
XpZ * XpZ = 1\<^sub>m 2
Complex_Matrix.adjoint XpZ = XpZ

goal (1 subgoal):
 1. Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2

goal (1 subgoal):
 1. Complex_Matrix.unitary XpZ
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2

goal (1 subgoal):
 1. Complex_Matrix.unitary XpZ
[PROOF STEP]
unfolding unitary_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint XpZ * XpZ = 1\<^sub>m 2

goal (1 subgoal):
 1. XpZ \<in> carrier_mat (dim_row XpZ) (dim_row XpZ) \<and> inverts_mat XpZ (Complex_Matrix.adjoint XpZ)
[PROOF STEP]
by (metis Complex_Matrix.adjoint_adjoint Complex_Matrix.unitary_def XpZ_carrier adjoint_dim
        carrier_matD(1) inverts_mat_def unitary_adjoint)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.unitary XpZ

goal:
No subgoals!
[PROOF STEP]
qed


[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 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 Gcd_int_eq [simp]:
  "(GCD n\<in>N. int n) = int (Gcd N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (int ` N) = int (Gcd N)
[PROOF STEP]
by (simp add: Gcd_int_def image_image)


[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 finiteG: "finite G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite G
[PROOF STEP]
using good_char good_card_imp_finite
[PROOF STATE]
proof (prove)
using this:
ordG \<noteq> (0::'f)
of_nat (card ?A) \<noteq> (0::?'a) \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite G
[PROOF STEP]
by fast


[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 specializedtoprimes1a:
  fixes p::nat
  shows "\<lbrakk>prime p; prime q; p \<noteq> q; a mod p = b mod p; a mod q = b mod q; b < p*q \<rbrakk>
    \<Longrightarrow> a mod (p*q) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; prime q; p \<noteq> q; a mod p = b mod p; a mod q = b mod q; b < p * q\<rbrakk> \<Longrightarrow> a mod (p * q) = b
[PROOF STEP]
by (simp add: specializedtoprimes1)


[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