[STATEMENT]
lemma sunflower_lower_bound:
  assumes inf: "infinite (UNIV :: 'a set)"
    and r: "r \<noteq> 0"
    and rk: "r = 1 \<Longrightarrow> k \<noteq> 0"
  shows "\<exists> F.
    card F = (r - 1)^k \<and> finite F \<and>
    (\<forall> A \<in> F. finite (A :: 'a set) \<and> card A = k) \<and>
    (\<nexists> S. S \<subseteq> F \<and> sunflower S \<and> card S \<ge> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
proof (cases "r = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. r \<noteq> 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
r \<noteq> 1

goal (2 subgoals):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. r \<noteq> 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
with r
[PROOF STATE]
proof (chain)
picking this:
r \<noteq> 0
r \<noteq> 1
[PROOF STEP]
have r: "r > 1"
[PROOF STATE]
proof (prove)
using this:
r \<noteq> 0
r \<noteq> 1

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

goal (2 subgoals):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. r \<noteq> 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
have id: "S \<subseteq> {{}} \<longleftrightarrow> (S = {} \<or> S = {{}})" for S :: "'a set set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<subseteq> {{}}) = (S = {} \<or> S = {{}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?S \<subseteq> {{}}) = (?S = {} \<or> ?S = {{}})

goal (2 subgoals):
 1. \<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
 2. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
1 < r

goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
by (intro exI[of _ "{{}}"], auto simp: id)
[PROOF STATE]
proof (state)
this:
\<exists>F. card F = (r - 1) ^ 0 \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = 0) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
obtain F where
      cardF: "card F = (r - 1) ^ k" and
      fin: "finite F" and
      AF: "\<And> A. (A :: 'a set) \<in> F \<Longrightarrow> finite A \<and> card A = k" and
      sf: "\<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)"
[PROOF STATE]
proof (prove)
using this:
\<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. (\<And>F. \<lbrakk>card F = (r - 1) ^ k; finite F; \<And>A. A \<in> F \<Longrightarrow> finite A \<and> card A = k; \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
card F = (r - 1) ^ k
finite F
?A \<in> F \<Longrightarrow> finite ?A \<and> card ?A = k
\<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
text \<open>main idea: get @{term "k-1 :: nat"} fresh elements
      and add one of these to all elements of F\<close>
[PROOF STATE]
proof (state)
this:
card F = (r - 1) ^ k
finite F
?A \<in> F \<Longrightarrow> finite ?A \<and> card ?A = k
\<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
have "finite (\<Union> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> F)
[PROOF STEP]
using fin AF
[PROOF STATE]
proof (prove)
using this:
finite F
?A \<in> F \<Longrightarrow> finite ?A \<and> card ?A = k

goal (1 subgoal):
 1. finite (\<Union> F)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (\<Union> F)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
hence "infinite (UNIV - \<Union> F)"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> F)

goal (1 subgoal):
 1. infinite (UNIV - \<Union> F)
[PROOF STEP]
using inf
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> F)
infinite UNIV

goal (1 subgoal):
 1. infinite (UNIV - \<Union> F)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
infinite (UNIV - \<Union> F)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
from infinite_arbitrarily_large[OF this, of "r - 1"]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. finite B \<and> card B = r - 1 \<and> B \<subseteq> UNIV - \<Union> F
[PROOF STEP]
obtain New where New: "finite New" "card New = r - 1"
      "New \<inter> \<Union> F = {}"
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> card B = r - 1 \<and> B \<subseteq> UNIV - \<Union> F

goal (1 subgoal):
 1. (\<And>New. \<lbrakk>finite New; card New = r - 1; New \<inter> \<Union> F = {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
define G where "G = (\<lambda> (A, a). insert a A) ` (F \<times> New)"
[PROOF STATE]
proof (state)
this:
G = (\<lambda>(A, a). insert a A) ` (F \<times> New)

goal (1 subgoal):
 1. \<And>k. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S) \<Longrightarrow> \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
proof (intro exI[of _ G] conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. card G = (r - 1) ^ Suc k
 2. finite G
 3. \<forall>A\<in>G. finite A \<and> card A = Suc k
 4. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show "finite G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite G
[PROOF STEP]
using New fin
[PROOF STATE]
proof (prove)
using this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}
finite F

goal (1 subgoal):
 1. finite G
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}
finite F

goal (1 subgoal):
 1. finite ((\<lambda>(A, a). insert a A) ` (F \<times> New))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite G

goal (3 subgoals):
 1. card G = (r - 1) ^ Suc k
 2. \<forall>A\<in>G. finite A \<and> card A = Suc k
 3. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
have "card G = card (F \<times> New)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card G = card (F \<times> New)
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>(A, a). insert a A) ` (F \<times> New)) = card (F \<times> New)
[PROOF STEP]
proof ((subst card_image; (intro refl)?), intro inj_onI, clarsimp, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
case (1 A a B b)
[PROOF STATE]
proof (state)
this:
insert a A = insert b B
A \<in> F
a \<in> New
B \<in> F
b \<in> New

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
hence ab: "a = b"
[PROOF STATE]
proof (prove)
using this:
insert a A = insert b B
A \<in> F
a \<in> New
B \<in> F
b \<in> New

goal (1 subgoal):
 1. a = b
[PROOF STEP]
using New
[PROOF STATE]
proof (prove)
using this:
insert a A = insert b B
A \<in> F
a \<in> New
B \<in> F
b \<in> New
finite New
card New = r - 1
New \<inter> \<Union> F = {}

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

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
from 1(1)
[PROOF STATE]
proof (chain)
picking this:
insert a A = insert b B
[PROOF STEP]
have "insert a A - {a} = insert b B - {a}"
[PROOF STATE]
proof (prove)
using this:
insert a A = insert b B

goal (1 subgoal):
 1. insert a A - {a} = insert b B - {a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
insert a A - {a} = insert b B - {a}

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insert a A - {a} = insert b B - {a}

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
have "insert a A - {a} = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a A - {a} = A
[PROOF STEP]
using New 1
[PROOF STATE]
proof (prove)
using this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}
insert a A = insert b B
A \<in> F
a \<in> New
B \<in> F
b \<in> New

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

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insert a A - {a} = A

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
have "insert b B - {a} = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert b B - {a} = B
[PROOF STEP]
using New 1 ab[symmetric]
[PROOF STATE]
proof (prove)
using this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}
insert a A = insert b B
A \<in> F
a \<in> New
B \<in> F
b \<in> New
b = a

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

goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>insert b a = insert ba aa; a \<in> F; b \<in> New; aa \<in> F; ba \<in> New\<rbrakk> \<Longrightarrow> a = aa \<and> b = ba
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A = B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
A = B

goal (1 subgoal):
 1. A = B \<and> a = b
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
A = B
a = b

goal (1 subgoal):
 1. A = B \<and> a = b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = B \<and> a = b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card G = card (F \<times> New)

goal (3 subgoals):
 1. card G = (r - 1) ^ Suc k
 2. \<forall>A\<in>G. finite A \<and> card A = Suc k
 3. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card G = card (F \<times> New)

goal (3 subgoals):
 1. card G = (r - 1) ^ Suc k
 2. \<forall>A\<in>G. finite A \<and> card A = Suc k
 3. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
have "\<dots> = card F * card New"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (F \<times> New) = card F * card New
[PROOF STEP]
using New fin
[PROOF STATE]
proof (prove)
using this:
finite New
card New = r - 1
New \<inter> \<Union> F = {}
finite F

goal (1 subgoal):
 1. card (F \<times> New) = card F * card New
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (F \<times> New) = card F * card New

goal (3 subgoals):
 1. card G = (r - 1) ^ Suc k
 2. \<forall>A\<in>G. finite A \<and> card A = Suc k
 3. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card G = card F * card New
[PROOF STEP]
show "card G = (r - 1) ^ Suc k"
[PROOF STATE]
proof (prove)
using this:
card G = card F * card New

goal (1 subgoal):
 1. card G = (r - 1) ^ Suc k
[PROOF STEP]
unfolding cardF New
[PROOF STATE]
proof (prove)
using this:
card G = (r - 1) ^ k * (r - 1)

goal (1 subgoal):
 1. card G = (r - 1) ^ Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card G = (r - 1) ^ Suc k

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
card G = (r - 1) ^ Suc k

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
assume "B \<in> G"
[PROOF STATE]
proof (state)
this:
B \<in> G

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> G
[PROOF STEP]
obtain a A where G: "a \<in> New" "A \<in> F" "B = insert a A"
[PROOF STATE]
proof (prove)
using this:
B \<in> G

goal (1 subgoal):
 1. (\<And>a A. \<lbrakk>a \<in> New; A \<in> F; B = insert a A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
B \<in> (\<lambda>(A, a). insert a A) ` (F \<times> New)

goal (1 subgoal):
 1. (\<And>a A. \<lbrakk>a \<in> New; A \<in> F; B = insert a A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> New
A \<in> F
B = insert a A

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
with AF[of A] New
[PROOF STATE]
proof (chain)
picking this:
A \<in> F \<Longrightarrow> finite A \<and> card A = k
finite New
card New = r - 1
New \<inter> \<Union> F = {}
a \<in> New
A \<in> F
B = insert a A
[PROOF STEP]
have "finite B" "card B = Suc k"
[PROOF STATE]
proof (prove)
using this:
A \<in> F \<Longrightarrow> finite A \<and> card A = k
finite New
card New = r - 1
New \<inter> \<Union> F = {}
a \<in> New
A \<in> F
B = insert a A

goal (1 subgoal):
 1. finite B &&& card B = Suc k
[PROOF STEP]
by (auto simp: card_insert_if)
[PROOF STATE]
proof (state)
this:
finite B
card B = Suc k

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?B2 \<in> G \<Longrightarrow> finite ?B2
?B2 \<in> G \<Longrightarrow> card ?B2 = Suc k

goal (2 subgoals):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
 2. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
thus "\<forall>A\<in>G. finite A \<and> card A = Suc k"
[PROOF STATE]
proof (prove)
using this:
?B2 \<in> G \<Longrightarrow> finite ?B2
?B2 \<in> G \<Longrightarrow> card ?B2 = Suc k

goal (1 subgoal):
 1. \<forall>A\<in>G. finite A \<and> card A = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>G. finite A \<and> card A = Suc k

goal (1 subgoal):
 1. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show "\<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)
[PROOF STEP]
proof (intro notI, elim exE conjE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume *: "S \<subseteq> G" "sunflower S" "r \<le> card S"
[PROOF STATE]
proof (state)
this:
S \<subseteq> G
sunflower S
r \<le> card S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define g where "g B = (SOME a. a \<in> New \<and> a \<in> B)" for B
[PROOF STATE]
proof (state)
this:
g ?B = (SOME a. a \<in> New \<and> a \<in> ?B)

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
g ?B = (SOME a. a \<in> New \<and> a \<in> ?B)

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "B \<in> S"
[PROOF STATE]
proof (state)
this:
B \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with \<open>S \<subseteq> G\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> G
B \<in> S
[PROOF STEP]
have "B \<in> G"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> G
B \<in> S

goal (1 subgoal):
 1. B \<in> G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> G

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "\<exists> a. a \<in> New \<and> a \<in> B"
[PROOF STATE]
proof (prove)
using this:
B \<in> G

goal (1 subgoal):
 1. \<exists>a. a \<in> New \<and> a \<in> B
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
B \<in> (\<lambda>(A, a). insert a A) ` (F \<times> New)

goal (1 subgoal):
 1. \<exists>a. a \<in> New \<and> a \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>a. a \<in> New \<and> a \<in> B

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from someI_ex[OF this, folded g_def]
[PROOF STATE]
proof (chain)
picking this:
g B \<in> New \<and> g B \<in> B
[PROOF STEP]
have "g B \<in> New" "g B \<in> B"
[PROOF STATE]
proof (prove)
using this:
g B \<in> New \<and> g B \<in> B

goal (1 subgoal):
 1. g B \<in> New &&& g B \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g B \<in> New
g B \<in> B

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?B2 \<in> S \<Longrightarrow> g ?B2 \<in> New
?B2 \<in> S \<Longrightarrow> g ?B2 \<in> ?B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
note gB = this
[PROOF STATE]
proof (state)
this:
?B2 \<in> S \<Longrightarrow> g ?B2 \<in> New
?B2 \<in> S \<Longrightarrow> g ?B2 \<in> ?B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "card (g ` S) \<le> card New"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (g ` S) \<le> card New
[PROOF STEP]
by (rule card_mono, insert New gB, auto)
[PROOF STATE]
proof (state)
this:
card (g ` S) \<le> card New

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (g ` S) \<le> card New

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<dots> < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card New < r
[PROOF STEP]
unfolding New
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r - 1 < r
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
1 < r

goal (1 subgoal):
 1. r - 1 < r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card New < r

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card New < r

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<dots> \<le> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> card S
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
r \<le> card S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (g ` S) < card S
[PROOF STEP]
have "card (g ` S) < card S"
[PROOF STATE]
proof (prove)
using this:
card (g ` S) < card S

goal (1 subgoal):
 1. card (g ` S) < card S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (g ` S) < card S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from pigeonhole[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<not> inj_on g S
[PROOF STEP]
have "\<not> inj_on g S"
[PROOF STATE]
proof (prove)
using this:
\<not> inj_on g S

goal (1 subgoal):
 1. \<not> inj_on g S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<not> inj_on g S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> inj_on g S
[PROOF STEP]
obtain B1 B2 where B12: "B1 \<in> S" "B2 \<in> S" "B1 \<noteq> B2" "g B1 = g B2"
[PROOF STATE]
proof (prove)
using this:
\<not> inj_on g S

goal (1 subgoal):
 1. (\<And>B1 B2. \<lbrakk>B1 \<in> S; B2 \<in> S; B1 \<noteq> B2; g B1 = g B2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x\<in>S. \<forall>y\<in>S. g x = g y \<longrightarrow> x = y)

goal (1 subgoal):
 1. (\<And>B1 B2. \<lbrakk>B1 \<in> S; B2 \<in> S; B1 \<noteq> B2; g B1 = g B2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define a where "a = g B2"
[PROOF STATE]
proof (state)
this:
a = g B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from B12 gB[of B1] gB[of B2]
[PROOF STATE]
proof (chain)
picking this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
B1 \<in> S \<Longrightarrow> g B1 \<in> New
B1 \<in> S \<Longrightarrow> g B1 \<in> B1
B2 \<in> S \<Longrightarrow> g B2 \<in> New
B2 \<in> S \<Longrightarrow> g B2 \<in> B2
[PROOF STEP]
have a: "a \<in> New" "a \<in> B1" "a \<in> B2"
[PROOF STATE]
proof (prove)
using this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
B1 \<in> S \<Longrightarrow> g B1 \<in> New
B1 \<in> S \<Longrightarrow> g B1 \<in> B1
B2 \<in> S \<Longrightarrow> g B2 \<in> New
B2 \<in> S \<Longrightarrow> g B2 \<in> B2

goal (1 subgoal):
 1. a \<in> New &&& a \<in> B1 &&& a \<in> B2
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
using this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
B1 \<in> S \<Longrightarrow> g B1 \<in> New
B1 \<in> S \<Longrightarrow> g B1 \<in> B1
B2 \<in> S \<Longrightarrow> g B2 \<in> New
B2 \<in> S \<Longrightarrow> g B2 \<in> B2

goal (1 subgoal):
 1. g B2 \<in> New &&& g B2 \<in> B1 &&& g B2 \<in> B2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> New
a \<in> B1
a \<in> B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with B12
[PROOF STATE]
proof (chain)
picking this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
a \<in> New
a \<in> B1
a \<in> B2
[PROOF STEP]
have "\<exists>B1 B2. B1 \<in> S \<and> B2 \<in> S \<and> B1 \<noteq> B2 \<and> a \<in> B1 \<and> a \<in> B2"
[PROOF STATE]
proof (prove)
using this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
a \<in> New
a \<in> B1
a \<in> B2

goal (1 subgoal):
 1. \<exists>B1 B2. B1 \<in> S \<and> B2 \<in> S \<and> B1 \<noteq> B2 \<and> a \<in> B1 \<and> a \<in> B2
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
using this:
B1 \<in> S
B2 \<in> S
B1 \<noteq> B2
g B1 = g B2
g B2 \<in> New
g B2 \<in> B1
g B2 \<in> B2

goal (1 subgoal):
 1. \<exists>B1 B2a. B1 \<in> S \<and> B2a \<in> S \<and> B1 \<noteq> B2a \<and> g B2 \<in> B1 \<and> g B2 \<in> B2a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>B1 B2. B1 \<in> S \<and> B2 \<in> S \<and> B1 \<noteq> B2 \<and> a \<in> B1 \<and> a \<in> B2

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from \<open>sunflower S\<close>[unfolded sunflower_def, rule_format, OF this]
[PROOF STATE]
proof (chain)
picking this:
?A \<in> S \<Longrightarrow> a \<in> ?A
[PROOF STEP]
have aS: "B \<in> S \<Longrightarrow> a \<in> B" for B
[PROOF STATE]
proof (prove)
using this:
?A \<in> S \<Longrightarrow> a \<in> ?A

goal (1 subgoal):
 1. B \<in> S \<Longrightarrow> a \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?B \<in> S \<Longrightarrow> a \<in> ?B

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define h where "h B = B - {a}" for B
[PROOF STATE]
proof (state)
this:
h ?B = ?B - {a}

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define T where "T = h ` S"
[PROOF STATE]
proof (state)
this:
T = h ` S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S
[PROOF STEP]
proof (intro exI[of _ T] conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
assume "B \<in> S"
[PROOF STATE]
proof (state)
this:
B \<in> S

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
have hB: "h B = B - {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h B = B - {a}
[PROOF STEP]
unfolding h_def T_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - {a} = B - {a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h B = B - {a}

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
from aS \<open>B \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
?B \<in> S \<Longrightarrow> a \<in> ?B
B \<in> S
[PROOF STEP]
have aB: "a \<in> B"
[PROOF STATE]
proof (prove)
using this:
?B \<in> S \<Longrightarrow> a \<in> ?B
B \<in> S

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

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
from \<open>B \<in> S\<close> \<open>S \<subseteq> G\<close>
[PROOF STATE]
proof (chain)
picking this:
B \<in> S
S \<subseteq> G
[PROOF STEP]
obtain a' A where AF: "A \<in> F"
              and B: "B = insert a' A"
              and a': "a' \<in> New"
[PROOF STATE]
proof (prove)
using this:
B \<in> S
S \<subseteq> G

goal (1 subgoal):
 1. (\<And>A a'. \<lbrakk>A \<in> F; B = insert a' A; a' \<in> New\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
B \<in> S
S \<subseteq> (\<lambda>(A, a). insert a A) ` (F \<times> New)

goal (1 subgoal):
 1. (\<And>A a'. \<lbrakk>A \<in> F; B = insert a' A; a' \<in> New\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
A \<in> F
B = insert a' A
a' \<in> New

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
from aB B a' New AF a(1) hB AF
[PROOF STATE]
proof (chain)
picking this:
a \<in> B
B = insert a' A
a' \<in> New
finite New
card New = r - 1
New \<inter> \<Union> F = {}
A \<in> F
a \<in> New
h B = B - {a}
A \<in> F
[PROOF STEP]
have "insert a (h B) = B" "h B = A"
[PROOF STATE]
proof (prove)
using this:
a \<in> B
B = insert a' A
a' \<in> New
finite New
card New = r - 1
New \<inter> \<Union> F = {}
A \<in> F
a \<in> New
h B = B - {a}
A \<in> F

goal (1 subgoal):
 1. insert a (h B) = B &&& h B = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert a (h B) = B
h B = A

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
hence "insert a (h B) = B" "h B \<in> F" "insert a (h B) \<in> S"
[PROOF STATE]
proof (prove)
using this:
insert a (h B) = B
h B = A

goal (1 subgoal):
 1. insert a (h B) = B &&& h B \<in> F &&& insert a (h B) \<in> S
[PROOF STEP]
using AF \<open>B \<in> S\<close>
[PROOF STATE]
proof (prove)
using this:
insert a (h B) = B
h B = A
A \<in> F
B \<in> S

goal (1 subgoal):
 1. insert a (h B) = B &&& h B \<in> F &&& insert a (h B) \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert a (h B) = B
h B \<in> F
insert a (h B) \<in> S

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
note main = this
[PROOF STATE]
proof (state)
this:
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
have CTS: "C \<in> T \<Longrightarrow> insert a C \<in> S" for C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> T \<Longrightarrow> insert a C \<in> S
[PROOF STEP]
using main
[PROOF STATE]
proof (prove)
using this:
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (1 subgoal):
 1. C \<in> T \<Longrightarrow> insert a C \<in> S
[PROOF STEP]
unfolding T_def
[PROOF STATE]
proof (prove)
using this:
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (1 subgoal):
 1. C \<in> h ` S \<Longrightarrow> insert a C \<in> S
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?C \<in> T \<Longrightarrow> insert a ?C \<in> S

goal (3 subgoals):
 1. T \<subseteq> F
 2. sunflower T
 3. r \<le> card T
[PROOF STEP]
show "T \<subseteq> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<subseteq> F
[PROOF STEP]
unfolding T_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h ` S \<subseteq> F
[PROOF STEP]
using main
[PROOF STATE]
proof (prove)
using this:
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (1 subgoal):
 1. h ` S \<subseteq> F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T \<subseteq> F

goal (2 subgoals):
 1. sunflower T
 2. r \<le> card T
[PROOF STEP]
have "r \<le> card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> card S
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
r \<le> card S

goal (2 subgoals):
 1. sunflower T
 2. r \<le> card T
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r \<le> card S

goal (2 subgoals):
 1. sunflower T
 2. r \<le> card T
[PROOF STEP]
have "\<dots> = card T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S = card T
[PROOF STEP]
unfolding T_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S = card (h ` S)
[PROOF STEP]
by (subst card_image, intro inj_on_inverseI[of _ "insert a"], insert main, auto)
[PROOF STATE]
proof (state)
this:
card S = card T

goal (2 subgoals):
 1. sunflower T
 2. r \<le> card T
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r \<le> card T
[PROOF STEP]
show "r \<le> card T"
[PROOF STATE]
proof (prove)
using this:
r \<le> card T

goal (1 subgoal):
 1. r \<le> card T
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
r \<le> card T

goal (1 subgoal):
 1. sunflower T
[PROOF STEP]
show "sunflower T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sunflower T
[PROOF STEP]
unfolding sunflower_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<exists>A B. A \<in> T \<and> B \<in> T \<and> A \<noteq> B \<and> x \<in> A \<and> x \<in> B) \<longrightarrow> (\<forall>A. A \<in> T \<longrightarrow> x \<in> A)
[PROOF STEP]
proof (intro allI impI, elim exE conjE, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
case (1 x C C1 C2)
[PROOF STATE]
proof (state)
this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2

goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
from CTS[OF \<open>C1 \<in> T\<close>] CTS[OF \<open>C2 \<in> T\<close>] CTS[OF \<open>C \<in> T\<close>]
[PROOF STATE]
proof (chain)
picking this:
insert a C1 \<in> S
insert a C2 \<in> S
insert a C \<in> S
[PROOF STEP]
have *: "insert a C1 \<in> S" "insert a C2 \<in> S" "insert a C \<in> S"
[PROOF STATE]
proof (prove)
using this:
insert a C1 \<in> S
insert a C2 \<in> S
insert a C \<in> S

goal (1 subgoal):
 1. insert a C1 \<in> S &&& insert a C2 \<in> S &&& insert a C \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert a C1 \<in> S
insert a C2 \<in> S
insert a C \<in> S

goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2
[PROOF STEP]
have "insert a C1 \<noteq> insert a C2"
[PROOF STATE]
proof (prove)
using this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2

goal (1 subgoal):
 1. insert a C1 \<noteq> insert a C2
[PROOF STEP]
using main
[PROOF STATE]
proof (prove)
using this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

goal (1 subgoal):
 1. insert a C1 \<noteq> insert a C2
[PROOF STEP]
unfolding T_def
[PROOF STATE]
proof (prove)
using this:
C \<in> h ` S
C1 \<in> h ` S
C2 \<in> h ` S
C1 \<noteq> C2
x \<in> C1
x \<in> C2
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) = ?B2
?B2 \<in> S \<Longrightarrow> h ?B2 \<in> F
?B2 \<in> S \<Longrightarrow> insert a (h ?B2) \<in> S

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

goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
hence "\<exists>A B. A \<in> S \<and> B \<in> S \<and> A \<noteq> B \<and> x \<in> A \<and> x \<in> B"
[PROOF STATE]
proof (prove)
using this:
insert a C1 \<noteq> insert a C2

goal (1 subgoal):
 1. \<exists>A B. A \<in> S \<and> B \<in> S \<and> A \<noteq> B \<and> x \<in> A \<and> x \<in> B
[PROOF STEP]
using * 1
[PROOF STATE]
proof (prove)
using this:
insert a C1 \<noteq> insert a C2
insert a C1 \<in> S
insert a C2 \<in> S
insert a C \<in> S
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2

goal (1 subgoal):
 1. \<exists>A B. A \<in> S \<and> B \<in> S \<and> A \<noteq> B \<and> x \<in> A \<and> x \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>A B. A \<in> S \<and> B \<in> S \<and> A \<noteq> B \<and> x \<in> A \<and> x \<in> B

goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
from \<open>sunflower S\<close>[unfolded sunflower_def, rule_format, OF this *(3)]
[PROOF STATE]
proof (chain)
picking this:
x \<in> insert a C
[PROOF STEP]
have "x \<in> insert a C"
[PROOF STATE]
proof (prove)
using this:
x \<in> insert a C

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

goal (1 subgoal):
 1. \<And>x A Aa B. \<lbrakk>A \<in> T; Aa \<in> T; B \<in> T; Aa \<noteq> B; x \<in> Aa; x \<in> B\<rbrakk> \<Longrightarrow> x \<in> A
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2
x \<in> insert a C
[PROOF STEP]
show "x \<in> C"
[PROOF STATE]
proof (prove)
using this:
C \<in> T
C1 \<in> T
C2 \<in> T
C1 \<noteq> C2
x \<in> C1
x \<in> C2
x \<in> insert a C

goal (1 subgoal):
 1. x \<in> C
[PROOF STEP]
unfolding T_def h_def
[PROOF STATE]
proof (prove)
using this:
C \<in> (\<lambda>B. B - {a}) ` S
C1 \<in> (\<lambda>B. B - {a}) ` S
C2 \<in> (\<lambda>B. B - {a}) ` S
C1 \<noteq> C2
x \<in> C1
x \<in> C2
x \<in> insert a C

goal (1 subgoal):
 1. x \<in> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> C

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>S \<subseteq> G; sunflower S; r \<le> card S\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with sf
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>S\<subseteq>G. sunflower S \<and> r \<le> card S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>F. card F = (r - 1) ^ Suc k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal (1 subgoal):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
case r: True
[PROOF STATE]
proof (state)
this:
r = 1

goal (1 subgoal):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
with rk
[PROOF STATE]
proof (chain)
picking this:
r = 1 \<Longrightarrow> k \<noteq> 0
r = 1
[PROOF STEP]
have "k \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
r = 1 \<Longrightarrow> k \<noteq> 0
r = 1

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

goal (1 subgoal):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 0
[PROOF STEP]
obtain l where k: "k = Suc l"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0

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

goal (1 subgoal):
 1. r = 1 \<Longrightarrow> \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)
[PROOF STEP]
unfolding r k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. card F = (1 - 1) ^ Suc l \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = Suc l) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> 1 \<le> card S)
[PROOF STEP]
by (intro exI[of _ "{}"], auto)
[PROOF STATE]
proof (state)
this:
\<exists>F. card F = (r - 1) ^ k \<and> finite F \<and> (\<forall>A\<in>F. finite A \<and> card A = k) \<and> \<not> (\<exists>S\<subseteq>F. sunflower S \<and> r \<le> card S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in CRR_market_viable) put_price:
  shows "fair_price Mkt
    (put_price u d init r matur K)
    (put_option matur K) matur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur
[PROOF STEP]
have "fair_price Mkt
    (\<Sum> w\<in> range (pseudo_proj_True matur). (prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur}) *
      (discounted_value r (\<lambda>m. (put_option matur K)) matur w))
    (put_option matur K) matur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w) (put_option matur K) matur
[PROOF STEP]
by (rule CRR_market_fair_price, rule put_borel)
[PROOF STATE]
proof (state)
this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w) (put_option matur K) matur

goal (1 subgoal):
 1. fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w) (put_option matur K) matur

goal (1 subgoal):
 1. fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur
[PROOF STEP]
using put_effect_compute
[PROOF STATE]
proof (prove)
using this:
fair_price Mkt (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component ((1 + r - d) / (u - d)) w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w) (put_option matur K) matur
(\<Sum>w\<in>range (pseudo_proj_True ?matur). prod (prob_component ?pr w) {0..<?matur} * discounted_value r (\<lambda>m. put_option ?matur ?K) ?matur w) = (\<Sum>y\<in>gener_bool_list ?matur. lprob_comp ?pr y * det_discount r ?matur * max (?K - lgeom_proc u d init (take ?matur y)) 0)

goal (1 subgoal):
 1. fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fair_price Mkt (put_price u d init r matur K) (put_option matur K) matur

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_differentiable_image_eq:
  fixes f :: "real^'n::{finite,wellorder} \<Rightarrow> real^'n::_"
  assumes "S \<in> sets lebesgue"
      and "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
      and "inj_on f S"
  shows "f ` S \<in> lmeasurable \<longleftrightarrow> (\<lambda>x. \<bar>det (matrix (f' x))\<bar>) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` S \<in> lmeasurable) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) integrable_on S)
[PROOF STEP]
using has_measure_differentiable_image [OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> S \<Longrightarrow> x \<in> S) \<Longrightarrow> (f ` S \<in> lmeasurable \<and> Sigma_Algebra.measure lebesgue (f ` S) = ?m) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) has_integral ?m) S

goal (1 subgoal):
 1. (f ` S \<in> lmeasurable) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) integrable_on S)
[PROOF STEP]
by blast


[STATEMENT]
lemma Nset_have_two:"j \<in>{h. h \<le> (Suc n)} \<Longrightarrow> \<exists>m \<in> {h. h \<le> (Suc n)}. j \<noteq> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> {h. h \<le> Suc n} \<Longrightarrow> \<exists>m\<in>{h. h \<le> Suc n}. j \<noteq> m
[PROOF STEP]
apply (rule contrapos_pp, simp+,
       case_tac "j = Suc n", simp,
       drule_tac a = 0 in forall_spec, simp, arith)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j \<le> Suc n; \<forall>m\<le>Suc n. j = m; j \<noteq> Suc n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (drule_tac a = "Suc n" in forall_spec, simp, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dom_children_normalize1:
  "\<lbrakk>dom_children (Node r0 {|(t1,e1)|}) T; wf_dlverts t1; max_deg t1 \<le> 1\<rbrakk>
    \<Longrightarrow> dom_children (Node r0 {|(normalize1 t1,e1)|}) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dom_children (Node r0 {|(t1, e1)|}) T; wf_dlverts t1; max_deg t1 \<le> 1\<rbrakk> \<Longrightarrow> dom_children (Node r0 {|(normalize1 t1, e1)|}) T
[PROOF STEP]
using dom_children_normalize1_aux
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>dverts ?t1.0. \<exists>v\<in>set ?r0.0 \<union> path_lverts ?t1.0 (hd x). v \<rightarrow>\<^bsub>T\<^esub> hd x; wf_dlverts ?t1.0; max_deg ?t1.0 \<le> 1; ?x \<in> dverts (normalize1 ?t1.0)\<rbrakk> \<Longrightarrow> \<exists>v\<in>set ?r0.0 \<union> path_lverts (normalize1 ?t1.0) (hd ?x). v \<rightarrow>\<^bsub>T\<^esub> hd ?x

goal (1 subgoal):
 1. \<lbrakk>dom_children (Node r0 {|(t1, e1)|}) T; wf_dlverts t1; max_deg t1 \<le> 1\<rbrakk> \<Longrightarrow> dom_children (Node r0 {|(normalize1 t1, e1)|}) T
[PROOF STEP]
by (simp add: dom_children_def)


[STATEMENT]
lemma OclOr_commute: "(X or Y) = (Y or X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X or Y) = (Y or X)
[PROOF STEP]
by(simp add: OclOr_def OclAnd_commute)


[STATEMENT]
lemma cong_Suc_0 [simp, presburger]:
  "[m = n] (mod Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [m = n] (mod Suc 0)
[PROOF STEP]
using cong_1 [of m n]
[PROOF STATE]
proof (prove)
using this:
[m = n] (mod 1)

goal (1 subgoal):
 1. [m = n] (mod Suc 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma find_sub_True_proj_list_5_length:
  assumes "find_sub_True xs = Some (ys, w, ws, z, zs)" "length xs = length xs'"
    "proj_list_5 xs' (ys, w, ws, z, zs) = (ys', w', ws', z', zs')"
  shows "length ys = length ys'" "length ws = length ws'"
    "length zs = length zs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length ys' &&& length ws = length ws' &&& length zs = length zs'
[PROOF STEP]
using find_sub_True_sound[OF assms(1)] proj_list_5_length[OF assms(3)] assms(2)
[PROOF STATE]
proof (prove)
using this:
xs = ys @ w # ws @ z # zs \<and> (z \<subseteq> w \<or> w \<subseteq> z)
length xs' = length ys + 1 + length ws + 1 + length zs \<Longrightarrow> length ys = length ys'
length xs' = length ys + 1 + length ws + 1 + length zs \<Longrightarrow> length ws = length ws'
length xs' = length ys + 1 + length ws + 1 + length zs \<Longrightarrow> length zs = length zs'
length xs = length xs'

goal (1 subgoal):
 1. length ys = length ys' &&& length ws = length ws' &&& length zs = length zs'
[PROOF STEP]
by auto


[STATEMENT]
lemma (in first_countable_topology) sequentially_imp_eventually_within:
  "(\<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow>
    eventually P (at a within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)) \<Longrightarrow> eventually P (at a within s)
[PROOF STEP]
unfolding at_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)) \<Longrightarrow> eventually P (inf (nhds a) (principal (s - {a})))
[PROOF STEP]
by (intro sequentially_imp_eventually_nhds_within) auto


[STATEMENT]
lemma unit_disc_fix_preserve_poincare_collinear [simp]:
  assumes "unit_circle_fix M" "poincare_collinear A"
  shows "poincare_collinear (moebius_pt M ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear (moebius_pt M ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
poincare_collinear A

goal (1 subgoal):
 1. poincare_collinear (moebius_pt M ` A)
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
\<exists>p. is_poincare_line p \<and> A \<subseteq> circline_set p

goal (1 subgoal):
 1. \<exists>p. is_poincare_line p \<and> moebius_pt M ` A \<subseteq> circline_set p
[PROOF STEP]
by (auto, rule_tac x="moebius_circline M p" in exI, auto)


[STATEMENT]
lemma apply_cltn2_imp_mult:
  assumes "apply_cltn2 p C = q"
  shows "\<exists> k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
have "proj2_rep p v* cltn2_rep C \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_rep p v* cltn2_rep C \<noteq> 0
[PROOF STEP]
by (rule rep_mult_rep_non_zero)
[PROOF STATE]
proof (state)
this:
proj2_rep p v* cltn2_rep C \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
from \<open>apply_cltn2 p C = q\<close>
[PROOF STATE]
proof (chain)
picking this:
apply_cltn2 p C = q
[PROOF STEP]
have "proj2_abs (proj2_rep p v* cltn2_rep C) = q"
[PROOF STATE]
proof (prove)
using this:
apply_cltn2 p C = q

goal (1 subgoal):
 1. proj2_abs (proj2_rep p v* cltn2_rep C) = q
[PROOF STEP]
by (unfold apply_cltn2_def)
[PROOF STATE]
proof (state)
this:
proj2_abs (proj2_rep p v* cltn2_rep C) = q

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
hence "proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = proj2_rep q"
[PROOF STATE]
proof (prove)
using this:
proj2_abs (proj2_rep p v* cltn2_rep C) = q

goal (1 subgoal):
 1. proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = proj2_rep q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = proj2_rep q

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
with \<open>proj2_rep p v* cltn2_rep C \<noteq> 0\<close> and proj2_rep_abs2 [of "proj2_rep p v* cltn2_rep C"]
[PROOF STATE]
proof (chain)
picking this:
proj2_rep p v* cltn2_rep C \<noteq> 0
proj2_rep p v* cltn2_rep C \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = k *\<^sub>R (proj2_rep p v* cltn2_rep C)
proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = proj2_rep q
[PROOF STEP]
have "\<exists> j. j \<noteq> 0 \<and> proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)"
[PROOF STATE]
proof (prove)
using this:
proj2_rep p v* cltn2_rep C \<noteq> 0
proj2_rep p v* cltn2_rep C \<noteq> 0 \<Longrightarrow> \<exists>k. k \<noteq> 0 \<and> proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = k *\<^sub>R (proj2_rep p v* cltn2_rep C)
proj2_rep (proj2_abs (proj2_rep p v* cltn2_rep C)) = proj2_rep q

goal (1 subgoal):
 1. \<exists>j. j \<noteq> 0 \<and> proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>j. j \<noteq> 0 \<and> proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>j. j \<noteq> 0 \<and> proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)
[PROOF STEP]
obtain j where "j \<noteq> 0"
    and "proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)"
[PROOF STATE]
proof (prove)
using this:
\<exists>j. j \<noteq> 0 \<and> proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)

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

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
hence "proj2_rep p v* cltn2_rep C = (1/j) *\<^sub>R proj2_rep q"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0
proj2_rep q = j *\<^sub>R (proj2_rep p v* cltn2_rep C)

goal (1 subgoal):
 1. proj2_rep p v* cltn2_rep C = (1 / j) *\<^sub>R proj2_rep q
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
proj2_rep p v* cltn2_rep C = (1 / j) *\<^sub>R proj2_rep q

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
with \<open>j \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> 0
proj2_rep p v* cltn2_rep C = (1 / j) *\<^sub>R proj2_rep q
[PROOF STEP]
show "\<exists> k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0
proj2_rep p v* cltn2_rep C = (1 / j) *\<^sub>R proj2_rep q

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q
[PROOF STEP]
by (simp add: exI [of _ "1/j"])
[PROOF STATE]
proof (state)
this:
\<exists>k. k \<noteq> 0 \<and> proj2_rep p v* cltn2_rep C = k *\<^sub>R proj2_rep q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_list_set_fml:
  shows "set (poly_list fml) = set_fml fml"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (poly_list fml) = set_fml fml
[PROOF STEP]
apply (induction)
[PROOF STATE]
proof (prove)
goal (8 subgoals):
 1. \<And>x1 x2. \<lbrakk>set (poly_list x1) = set_fml x1; set (poly_list x2) = set_fml x2\<rbrakk> \<Longrightarrow> set (poly_list (And x1 x2)) = set_fml (And x1 x2)
 2. \<And>x1 x2. \<lbrakk>set (poly_list x1) = set_fml x1; set (poly_list x2) = set_fml x2\<rbrakk> \<Longrightarrow> set (poly_list (Or x1 x2)) = set_fml (Or x1 x2)
 3. \<And>x. set (poly_list (fml.Gt x)) = set_fml (fml.Gt x)
 4. \<And>x. set (poly_list (Geq x)) = set_fml (Geq x)
 5. \<And>x. set (poly_list (fml.Lt x)) = set_fml (fml.Lt x)
 6. \<And>x. set (poly_list (Leq x)) = set_fml (Leq x)
 7. \<And>x. set (poly_list (fml.Eq x)) = set_fml (fml.Eq x)
 8. \<And>x. set (poly_list (Neq x)) = set_fml (Neq x)
[PROOF STEP]
by auto


[STATEMENT]
lemma discounted_sum:
  assumes "finite I"
shows "\<forall>n w. (\<Sum> i\<in> I. (discounted_value r (\<lambda>m x. f i m x)) n w) = (discounted_value r (\<lambda>m x. (\<Sum>i\<in> I. f i m x)) n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. (\<Sum>i\<in>I. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>I. f i m x) n w
[PROOF STEP]
using assms(1) subset_refl[of I]
[PROOF STATE]
proof (prove)
using this:
finite I
I \<subseteq> I

goal (1 subgoal):
 1. \<forall>n w. (\<Sum>i\<in>I. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>I. f i m x) n w
[PROOF STEP]
proof (induct rule: finite_subset_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>n w. (\<Sum>i\<in>{}. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>{}. f i m x) n w
 2. \<And>a F. \<lbrakk>finite F; a \<in> I; a \<notin> F; \<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w\<rbrakk> \<Longrightarrow> \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<forall>n w. (\<Sum>i\<in>{}. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>{}. f i m x) n w
 2. \<And>a F. \<lbrakk>finite F; a \<in> I; a \<notin> F; \<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w\<rbrakk> \<Longrightarrow> \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. (\<Sum>i\<in>{}. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>{}. f i m x) n w
[PROOF STEP]
by (simp add: discounted_value_def)
[PROOF STATE]
proof (state)
this:
\<forall>n w. (\<Sum>i\<in>{}. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>{}. f i m x) n w

goal (1 subgoal):
 1. \<And>a F. \<lbrakk>finite F; a \<in> I; a \<notin> F; \<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w\<rbrakk> \<Longrightarrow> \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a F. \<lbrakk>finite F; a \<in> I; a \<notin> F; \<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w\<rbrakk> \<Longrightarrow> \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
case (insert a F)
[PROOF STATE]
proof (state)
this:
finite F
a \<in> I
a \<notin> F
\<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w

goal (1 subgoal):
 1. \<And>a F. \<lbrakk>finite F; a \<in> I; a \<notin> F; \<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w\<rbrakk> \<Longrightarrow> \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
proof (intro allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
fix n w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
have "(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w)
[PROOF STEP]
by (simp add: insert.hyps(1) insert.hyps(3))
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w)

goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w)

goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
have "... = discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w
[PROOF STEP]
using insert.hyps(4)
[PROOF STATE]
proof (prove)
using this:
\<forall>n w. (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w

goal (1 subgoal):
 1. discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w

goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
discounted_value r (f a) n w + (\<Sum>i\<in>F. discounted_value r (f i) n w) = discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w

goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
have "... = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
by (simp add: discounted_value_def insert.hyps(1) insert.hyps(3) ring_class.ring_distribs(1))
[PROOF STATE]
proof (state)
this:
discounted_value r (f a) n w + discounted_value r (\<lambda>m x. \<Sum>i\<in>F. f i m x) n w = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w

goal (1 subgoal):
 1. \<And>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
show "(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w

goal (1 subgoal):
 1. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n w. (\<Sum>i\<in>insert a F. discounted_value r (f i) n w) = discounted_value r (\<lambda>m x. \<Sum>i\<in>insert a F. f i m x) n w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma higher_pderiv_of_int_poly [simp]:
  "(pderiv ^^ n) (of_int_poly p) = of_int_poly ((pderiv ^^ n) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ n) (of_int_poly p) = of_int_poly ((pderiv ^^ n) p)
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma th_lm_3: "(\<forall> u. c_fold (c_unfold (Suc k) u) = u)\<Longrightarrow> (\<forall> u. c_fold (c_unfold (Suc (Suc k)) u) = u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
assume A1: "\<forall> u. c_fold (c_unfold (Suc k) u) = u"
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold (Suc k) u) = u

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
let ?k1 = "Suc k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
have S1: "?k1 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Suc k

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
from S1 A1
[PROOF STATE]
proof (chain)
picking this:
0 < Suc k
\<forall>u. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
have S2: "\<forall> u. c_fold (c_unfold (Suc ?k1) u) = u"
[PROOF STATE]
proof (prove)
using this:
0 < Suc k
\<forall>u. c_fold (c_unfold (Suc k) u) = u

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
by (rule th_lm_2)
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u

goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_nat_less_add_less:
  assumes "m < n" "\<alpha> < \<gamma>" "\<beta> < \<gamma>" and ord: "Ord \<alpha>" "Ord \<beta>" "Ord \<gamma>"
    shows "\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
have "Suc m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc m \<le> n
[PROOF STEP]
using \<open>m < n\<close>
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. Suc m \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc m \<le> n

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
have "\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat (Suc m) + \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat (Suc m) + \<beta>
[PROOF STEP]
using assms mult_Suc_add_less
[PROOF STATE]
proof (prove)
using this:
m < n
\<alpha> < \<gamma>
\<beta> < \<gamma>
Ord \<alpha>
Ord \<beta>
Ord \<gamma>
\<lbrakk>?\<alpha> < ?\<gamma>; ?\<beta> < ?\<gamma>; Ord ?\<alpha>; Ord ?\<beta>; Ord ?\<gamma>\<rbrakk> \<Longrightarrow> ?\<gamma> * ord_of_nat ?m + ?\<alpha> < ?\<gamma> * ord_of_nat (Suc ?m) + ?\<beta>

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat (Suc m) + \<beta>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat (Suc m) + \<beta>

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat (Suc m) + \<beta>

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
have "\<dots> \<le> \<gamma> * ord_of_nat n + \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> * ord_of_nat (Suc m) + \<beta> \<le> \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
using Ord_mult Ord_ord_of_nat add_right_mono \<open>Suc m \<le> n\<close> ord mult_cancel_le_iff ord_of_nat_mono_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Ord ?y; Ord ?x\<rbrakk> \<Longrightarrow> Ord (?x * ?y)
Ord (ord_of_nat ?k)
\<lbrakk>?\<alpha> \<le> ?\<beta>; Ord ?\<alpha>; Ord ?\<beta>; Ord ?\<gamma>\<rbrakk> \<Longrightarrow> ?\<alpha> + ?\<gamma> \<le> ?\<beta> + ?\<gamma>
Suc m \<le> n
Ord \<alpha>
Ord \<beta>
Ord \<gamma>
\<lbrakk>Ord ?\<alpha>; Ord ?\<beta>; Ord ?\<gamma>\<rbrakk> \<Longrightarrow> (?\<alpha> * ?\<beta> \<le> ?\<alpha> * ?\<gamma>) = (?\<beta> \<le> ?\<gamma> \<or> ?\<alpha> = 0)
(ord_of_nat ?i \<le> ord_of_nat ?j) = (?i \<le> ?j)

goal (1 subgoal):
 1. \<gamma> * ord_of_nat (Suc m) + \<beta> \<le> \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<gamma> * ord_of_nat (Suc m) + \<beta> \<le> \<gamma> * ord_of_nat n + \<beta>

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>

goal (1 subgoal):
 1. \<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<gamma> * ord_of_nat m + \<alpha> < \<gamma> * ord_of_nat n + \<beta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma einterpret_mvmult_fa:
  assumes [simp]: "Dn = CARD('n::enum)" "Dm = CARD('m::enum)"
    "length A = CARD('n)*CARD('m)" "length B = CARD('m)"
  shows "einterpret (mvmult_fa Dn Dm A B) vs = (einterpret A vs::((real, 'm::enum) vec, 'n) vec) *v (einterpret B vs::(real, 'm) vec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. einterpret (mvmult_fa Dn Dm A B) vs = einterpret A vs *v einterpret B vs
[PROOF STEP]
apply (vector matrix_vector_mult_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. einterpret (mvmult_fa Dn Dm A B) vs $ i = (\<Sum>j\<in>UNIV. einterpret A vs $ i $ j * einterpret B vs $ j)
[PROOF STEP]
apply (auto simp: mvmult_fa_def vec_nth_eucl_of_list_eq2 index_Basis_list_axis2 index_Basis_list_axis1 vec_nth_eucl_of_list_eq
      concat_map_map_index length_concat o_def sum_list_distinct_conv_sum_set
      interpret_floatarith_inner_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. (\<Sum>ia<CARD('m). interpret_floatarith (A ! (index enum_class.enum i * CARD('m) + ia)) vs * interpret_floatarith (B ! ia) vs) = (\<Sum>j\<in>UNIV. interpret_floatarith (A ! (index enum_class.enum i * CARD('m) + index enum_class.enum j)) vs * interpret_floatarith (B ! index enum_class.enum j) vs)
[PROOF STEP]
apply (subst sum_index_enum_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. (\<Sum>ia<CARD('m). interpret_floatarith (A ! (index enum_class.enum i * CARD('m) + ia)) vs * interpret_floatarith (B ! ia) vs) = (\<Sum>ia<CARD('m). interpret_floatarith (A ! (index enum_class.enum i * CARD('m) + ia)) vs * interpret_floatarith (B ! ia) vs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wf_subcls1_E: "wf ((subcls1 E)\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf ((subcls1 E)\<inverse>)
[PROOF STEP]
apply (rule finite_acyclic_wf_converse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (subcls1 E)
 2. acyclic (subcls1 E)
[PROOF STEP]
apply (simp add: subcls1 del: insert_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclic (subcls1 E)
[PROOF STEP]
apply (rule acyclic_subcls1_E)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in pair_wf_digraph) pair_wf_digraph_subdivide:
  assumes props: "e \<in> parcs G" "w \<notin> pverts G"
  shows "pair_wf_digraph (subdivide G e w)" (is "pair_wf_digraph ?sG")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pair_wf_digraph (subdivide G e w)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> fst ea \<in> pverts (subdivide G e w)
 2. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> snd ea \<in> pverts (subdivide G e w)
[PROOF STEP]
obtain u v where [simp]: "e = (u,v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. e = (u, v) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases e) auto
[PROOF STATE]
proof (state)
this:
e = (u, v)

goal (2 subgoals):
 1. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> fst ea \<in> pverts (subdivide G e w)
 2. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> snd ea \<in> pverts (subdivide G e w)
[PROOF STEP]
fix e'
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> fst ea \<in> pverts (subdivide G e w)
 2. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> snd ea \<in> pverts (subdivide G e w)
[PROOF STEP]
assume "e' \<in> parcs ?sG"
[PROOF STATE]
proof (state)
this:
e' \<in> parcs (subdivide G e w)

goal (2 subgoals):
 1. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> fst ea \<in> pverts (subdivide G e w)
 2. \<And>ea. ea \<in> parcs (subdivide G e w) \<Longrightarrow> snd ea \<in> pverts (subdivide G e w)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e' \<in> parcs (subdivide G e w)
[PROOF STEP]
show "fst e' \<in> pverts ?sG" "snd e' \<in> pverts ?sG"
[PROOF STATE]
proof (prove)
using this:
e' \<in> parcs (subdivide G e w)

goal (1 subgoal):
 1. fst e' \<in> pverts (subdivide G e w) &&& snd e' \<in> pverts (subdivide G e w)
[PROOF STEP]
using props
[PROOF STATE]
proof (prove)
using this:
e' \<in> parcs (subdivide G e w)
e \<in> parcs G
w \<notin> pverts G

goal (1 subgoal):
 1. fst e' \<in> pverts (subdivide G e w) &&& snd e' \<in> pverts (subdivide G e w)
[PROOF STEP]
by (auto dest: wellformed)
[PROOF STATE]
proof (state)
this:
fst e' \<in> pverts (subdivide G e w)
snd e' \<in> pverts (subdivide G e w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sinh_minus [simp]: "sinh (- x) = -sinh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh (- x) = - sinh x
[PROOF STEP]
by (simp add: sinh_def algebra_simps)


[STATEMENT]
lemma diffeomorphism_add: "diffeomorphism k UNIV UNIV (\<lambda>x. x + c) (\<lambda>x. x - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diffeomorphism k UNIV UNIV (\<lambda>x. x + c) (\<lambda>x. x - c)
[PROOF STEP]
by (auto simp: diffeomorphism_def homeomorphism_add intro!: smooth_on_minus smooth_on_add)


[STATEMENT]
lemma list_all2_in_set_ExD:
  \<open>list_all2 R p q \<Longrightarrow> x \<in> set p \<Longrightarrow> \<exists>y \<in> set q. R x y\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 R p q; x \<in> set p\<rbrakk> \<Longrightarrow> \<exists>y\<in>set q. R x y
[PROOF STEP]
by (induction p q rule: list_all2_induct)
    auto


[STATEMENT]
lemma Gauss_Jordan_in_ij_0:
  fixes A::"'a::{field}^'m^'n::{finite, ord, wellorder}"
  assumes ex: "\<exists>n. A $ n $ j \<noteq> 0 \<and> i \<le> n" and a: "a \<noteq> i"
  shows "(Gauss_Jordan_in_ij A i j) $ a $ j = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan_in_ij A i j $ a $ j = (0::'a)
[PROOF STEP]
using ex
[PROOF STATE]
proof (prove)
using this:
\<exists>n. A $ n $ j \<noteq> (0::'a) \<and> i \<le> n

goal (1 subgoal):
 1. Gauss_Jordan_in_ij A i j $ a $ j = (0::'a)
[PROOF STEP]
apply (rule Gauss_Jordan_in_ij_unfold)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n interchange_A A'. \<lbrakk>(LEAST n. A $ n $ j \<noteq> (0::'a) \<and> i \<le> n) = n; A $ n $ j \<noteq> (0::'a); i \<le> n; interchange_A = interchange_rows A i n; A' = mult_row interchange_A i ((1::'a) / interchange_A $ i $ j); Gauss_Jordan_in_ij A i j = (\<chi>s. if s = i then A' $ s else row_add A' s i (- interchange_A $ s $ j) $ s)\<rbrakk> \<Longrightarrow> Gauss_Jordan_in_ij A i j $ a $ j = (0::'a)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<noteq> i

goal (1 subgoal):
 1. \<And>n interchange_A A'. \<lbrakk>(LEAST n. A $ n $ j \<noteq> (0::'a) \<and> i \<le> n) = n; A $ n $ j \<noteq> (0::'a); i \<le> n; interchange_A = interchange_rows A i n; A' = mult_row interchange_A i ((1::'a) / interchange_A $ i $ j); Gauss_Jordan_in_ij A i j = (\<chi>s. if s = i then A' $ s else row_add A' s i (- interchange_A $ s $ j) $ s)\<rbrakk> \<Longrightarrow> Gauss_Jordan_in_ij A i j $ a $ j = (0::'a)
[PROOF STEP]
by (simp add: mult_row_def interchange_rows_def row_add_def)


[STATEMENT]
lemma mult_poly_add_left: "(p + q) * r = p * r + q * r"
  for p q r :: "'a poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p + q) * r = p * r + q * r
[PROOF STEP]
by (induct r) (simp_all add: mult_poly_0 smult_distribs algebra_simps)


[STATEMENT]
lemma unitary11_gen_special:
  assumes "unitary11_gen M" and "mat_det M = 1"
  shows "\<exists> a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, -cnj b, -cnj a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
unitary11_gen M
mat_det M = 1
[PROOF STEP]
obtain k where *: "k \<noteq> 0" "mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, -1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, -1)"
[PROOF STATE]
proof (prove)
using this:
unitary11_gen M
mat_det M = 1

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<noteq> 0; mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding unitary11_gen_real
[PROOF STATE]
proof (prove)
using this:
\<exists>k. k \<noteq> 0 \<and> congruence M (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)
mat_det M = 1

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>k \<noteq> 0; mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k \<noteq> 0
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
hence "mat_det (mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, -1) *\<^sub>m\<^sub>m M) = -  cor k* cor k"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)

goal (1 subgoal):
 1. mat_det (mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M) = - cor k * cor k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_det (mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M) = - cor k * cor k

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
hence "mat_det (mat_adj M *\<^sub>m\<^sub>m M) = cor k* cor k"
[PROOF STATE]
proof (prove)
using this:
mat_det (mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M) = - cor k * cor k

goal (1 subgoal):
 1. mat_det (mat_adj M *\<^sub>m\<^sub>m M) = cor k * cor k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_det (mat_adj M *\<^sub>m\<^sub>m M) = cor k * cor k

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
hence "cor k* cor k = 1"
[PROOF STATE]
proof (prove)
using this:
mat_det (mat_adj M *\<^sub>m\<^sub>m M) = cor k * cor k

goal (1 subgoal):
 1. cor k * cor k = 1
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
mat_det (mat_adj M *\<^sub>m\<^sub>m M) = cor k * cor k
mat_det M = 1

goal (1 subgoal):
 1. cor k * cor k = 1
[PROOF STEP]
by (simp add: mat_det_adj)
[PROOF STATE]
proof (state)
this:
cor k * cor k = 1

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
hence "cor k = 1 \<or> cor k = -1"
[PROOF STATE]
proof (prove)
using this:
cor k * cor k = 1

goal (1 subgoal):
 1. cor k = 1 \<or> cor k = - 1
[PROOF STEP]
using square_eq_1_iff[of "cor k"]
[PROOF STATE]
proof (prove)
using this:
cor k * cor k = 1
(cor k * cor k = 1) = (cor k = 1 \<or> cor k = - 1)

goal (1 subgoal):
 1. cor k = 1 \<or> cor k = - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cor k = 1 \<or> cor k = - 1

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cor k = 1 \<or> cor k = - 1

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
have "mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, -1) = (cor k *\<^sub>s\<^sub>m (1, 0, 0, -1)) *\<^sub>m\<^sub>m mat_inv M "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)

goal (1 subgoal):
 1. mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
[PROOF STEP]
using assms mult_mm_inv_r mat_eye_r mat_eye_l
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m M = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)
unitary11_gen M
mat_det M = 1
\<lbrakk>mat_det ?B \<noteq> 0; ?A *\<^sub>m\<^sub>m ?B = ?C\<rbrakk> \<Longrightarrow> ?A = ?C *\<^sub>m\<^sub>m mat_inv ?B
?A *\<^sub>m\<^sub>m eye = ?A
eye *\<^sub>m\<^sub>m ?A = ?A

goal (1 subgoal):
 1. mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
obtain a b c d where "M = (a, b, c, d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b c d. M = (a, b, c, d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases M) auto
[PROOF STATE]
proof (state)
this:
M = (a, b, c, d)

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cor k = 1 \<or> cor k = - 1
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
M = (a, b, c, d)
[PROOF STEP]
have "M = (a, b, cnj b, cnj a) \<or> M = (a, b, -cnj b, -cnj a)"
[PROOF STATE]
proof (prove)
using this:
cor k = 1 \<or> cor k = - 1
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
M = (a, b, c, d)

goal (1 subgoal):
 1. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
cor k = 1 \<or> cor k = - 1
mat_adj M *\<^sub>m\<^sub>m (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1) *\<^sub>m\<^sub>m mat_inv M
M = (a, b, c, d)
mat_det M = 1

goal (1 subgoal):
 1. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
by (auto simp add: mat_adj_def mat_cnj_def)
[PROOF STATE]
proof (state)
this:
M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)

goal (1 subgoal):
 1. \<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>a b. M = (a, b, cnj b, cnj a) \<or> M = (a, b, - cnj b, - cnj a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma injectivity:
  assumes "(A' \<subseteq> A \<and> card A' = k) \<and> (A'' \<subseteq> A \<and> card A'' = k')"
  assumes "equiv A' R \<and> equiv A'' R'"
  assumes "R = R'"
  shows "A' = A''" "k = k'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A' = A'' &&& k = k'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A' = A''
 2. k = k'
[PROOF STEP]
from \<open>R = R'\<close> assms(2)
[PROOF STATE]
proof (chain)
picking this:
R = R'
equiv A' R \<and> equiv A'' R'
[PROOF STEP]
show "A' = A''"
[PROOF STATE]
proof (prove)
using this:
R = R'
equiv A' R \<and> equiv A'' R'

goal (1 subgoal):
 1. A' = A''
[PROOF STEP]
using equiv_inject
[PROOF STATE]
proof (prove)
using this:
R = R'
equiv A' R \<and> equiv A'' R'
\<lbrakk>equiv ?A ?R; equiv ?B ?R\<rbrakk> \<Longrightarrow> ?A = ?B

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

goal (1 subgoal):
 1. k = k'
[PROOF STEP]
from this assms(1)
[PROOF STATE]
proof (chain)
picking this:
A' = A''
(A' \<subseteq> A \<and> card A' = k) \<and> A'' \<subseteq> A \<and> card A'' = k'
[PROOF STEP]
show "k = k'"
[PROOF STATE]
proof (prove)
using this:
A' = A''
(A' \<subseteq> A \<and> card A' = k) \<and> A'' \<subseteq> A \<and> card A'' = k'

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_nth_mono:
  "sorted xs \<Longrightarrow> i \<le> j \<Longrightarrow> j < length xs \<Longrightarrow> xs!i \<le> xs!j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> xs ! i \<le> xs ! j
[PROOF STEP]
by (auto simp: sorted_iff_nth_mono)


[STATEMENT]
lemma sumhr_split_add: "\<And>n p. n < p \<Longrightarrow> sumhr (0, n, f) + sumhr (n, p, f) = sumhr (0, p, f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n p. n < p \<Longrightarrow> sumhr (0, n, f) + sumhr (n, p, f) = sumhr (0, p, f)
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n p. n < p \<Longrightarrow> (*f2* (\<lambda>m n. sum f {m..<n})) 0 n + (*f2* (\<lambda>m n. sum f {m..<n})) n p = (*f2* (\<lambda>m n. sum f {m..<n})) 0 p
[PROOF STEP]
by transfer (simp add: sum.atLeastLessThan_concat)


[STATEMENT]
lemma ball_in_max_ball':
  assumes  "U \<subseteq> carrier Q\<^sub>p"
  assumes  "U \<noteq> carrier Q\<^sub>p"
  assumes "B \<subseteq> U \<and> is_ball B"
  shows "\<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'
[PROOF STEP]
obtain c where c_def: "c \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. c \<in> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(3) c_ball_center_in is_ball_def)
[PROOF STATE]
proof (state)
this:
c \<in> B

goal (1 subgoal):
 1. \<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'
[PROOF STEP]
obtain B' where B'_def: " is_max_ball_of U B' \<and> c \<in> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B'. is_max_ball_of U B' \<and> c \<in> B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms ball_in_max_ball[of U c] c_def
[PROOF STATE]
proof (prove)
using this:
U \<subseteq> carrier Q\<^sub>p
U \<noteq> carrier Q\<^sub>p
B \<subseteq> U \<and> is_ball B
\<lbrakk>U \<subseteq> carrier Q\<^sub>p; U \<noteq> carrier Q\<^sub>p; c \<in> U; \<exists>B\<subseteq>U. is_ball B \<and> c \<in> B\<rbrakk> \<Longrightarrow> \<exists>B'. is_max_ball_of U B' \<and> c \<in> B'
c \<in> B

goal (1 subgoal):
 1. (\<And>B'. is_max_ball_of U B' \<and> c \<in> B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_max_ball_of U B' \<and> c \<in> B'

goal (1 subgoal):
 1. \<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_max_ball_of U B' \<and> c \<in> B'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_max_ball_of U B' \<and> c \<in> B'

goal (1 subgoal):
 1. \<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'
[PROOF STEP]
by (meson assms(3) c_def disjoint_iff_not_equal nested_balls'
        is_max_ball_of_def padic_integers_axioms)
[PROOF STATE]
proof (state)
this:
\<exists>B'. is_max_ball_of U B' \<and> B \<subseteq> B'

goal:
No subgoals!
[PROOF STEP]
qed