[STATEMENT]
lemma homeomorphic_interiors_same_dimension:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" and dimeq: "DIM('a) = DIM('b)"
  shows "(interior S) homeomorphic (interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S homeomorphic interior T
[PROOF STEP]
using assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
DIM('a) = DIM('b)

goal (1 subgoal):
 1. interior S homeomorphic interior T
[PROOF STEP]
unfolding homeomorphic_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
DIM('a) = DIM('b)

goal (1 subgoal):
 1. \<exists>f g. homeomorphism (interior S) (interior T) f g
[PROOF STEP]
proof (clarify elim!: ex_forward)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
fix f g
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
assume S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
     and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g
[PROOF STEP]
have fST: "f ` S = T" and gTS: "g ` T = S" and "inj_on f S" "inj_on g T"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. f ` S = T &&& g ` T = S &&& inj_on f S &&& inj_on g T
[PROOF STEP]
by (auto simp: inj_on_def intro: rev_image_eqI) metis+
[PROOF STATE]
proof (state)
this:
f ` S = T
g ` T = S
inj_on f S
inj_on g T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
have fim: "f ` interior S \<subseteq> interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T
[PROOF STEP]
using continuous_image_subset_interior [OF contf \<open>inj_on f S\<close>] dimeq fST
[PROOF STATE]
proof (prove)
using this:
DIM('b) \<le> DIM('a) \<Longrightarrow> f ` interior S \<subseteq> interior (f ` S)
DIM('a) = DIM('b)
f ` S = T

goal (1 subgoal):
 1. f ` interior S \<subseteq> interior T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f ` interior S \<subseteq> interior T

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
have gim: "g ` interior T \<subseteq> interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S
[PROOF STEP]
using continuous_image_subset_interior [OF contg \<open>inj_on g T\<close>] dimeq gTS
[PROOF STATE]
proof (prove)
using this:
DIM('a) \<le> DIM('b) \<Longrightarrow> g ` interior T \<subseteq> interior (g ` T)
DIM('a) = DIM('b)
g ` T = S

goal (1 subgoal):
 1. g ` interior T \<subseteq> interior S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g ` interior T \<subseteq> interior S

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>DIM('a) = DIM('b); \<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> homeomorphism (interior S) (interior T) f g
[PROOF STEP]
show "homeomorphism (interior S) (interior T) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism (interior S) (interior T) f g
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>interior S. g (f x) = x) \<and> f ` interior S = interior T \<and> continuous_on (interior S) f \<and> (\<forall>y\<in>interior T. f (g y) = y) \<and> g ` interior T = interior S \<and> continuous_on (interior T) g
[PROOF STEP]
proof (intro conjI ballI)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>x. x \<in> interior S \<Longrightarrow> g (f x) = x
 2. f ` interior S = interior T
 3. continuous_on (interior S) f
 4. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
 5. g ` interior T = interior S
 6. continuous_on (interior T) g
[PROOF STEP]
show "\<And>x. x \<in> interior S \<Longrightarrow> g (f x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> interior S \<Longrightarrow> g (f x) = x
[PROOF STEP]
by (meson \<open>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x\<close> subsetD interior_subset)
[PROOF STATE]
proof (state)
this:
?x \<in> interior S \<Longrightarrow> g (f ?x) = ?x

goal (5 subgoals):
 1. f ` interior S = interior T
 2. continuous_on (interior S) f
 3. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
 4. g ` interior T = interior S
 5. continuous_on (interior T) g
[PROOF STEP]
have "interior T \<subseteq> f ` interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior T \<subseteq> f ` interior S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior T \<Longrightarrow> x \<in> f ` interior S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior T \<Longrightarrow> x \<in> f ` interior S
[PROOF STEP]
assume "x \<in> interior T"
[PROOF STATE]
proof (state)
this:
x \<in> interior T

goal (1 subgoal):
 1. \<And>x. x \<in> interior T \<Longrightarrow> x \<in> f ` interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> interior T
[PROOF STEP]
have "g x \<in> interior S"
[PROOF STATE]
proof (prove)
using this:
x \<in> interior T

goal (1 subgoal):
 1. g x \<in> interior S
[PROOF STEP]
using gim
[PROOF STATE]
proof (prove)
using this:
x \<in> interior T
g ` interior T \<subseteq> interior S

goal (1 subgoal):
 1. g x \<in> interior S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g x \<in> interior S

goal (1 subgoal):
 1. \<And>x. x \<in> interior T \<Longrightarrow> x \<in> f ` interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g x \<in> interior S
[PROOF STEP]
show "x \<in> f ` interior S"
[PROOF STATE]
proof (prove)
using this:
g x \<in> interior S

goal (1 subgoal):
 1. x \<in> f ` interior S
[PROOF STEP]
by (metis T \<open>x \<in> interior T\<close> image_iff interior_subset subsetCE)
[PROOF STATE]
proof (state)
this:
x \<in> f ` interior S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
interior T \<subseteq> f ` interior S

goal (5 subgoals):
 1. f ` interior S = interior T
 2. continuous_on (interior S) f
 3. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
 4. g ` interior T = interior S
 5. continuous_on (interior T) g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interior T \<subseteq> f ` interior S
[PROOF STEP]
show "f ` interior S = interior T"
[PROOF STATE]
proof (prove)
using this:
interior T \<subseteq> f ` interior S

goal (1 subgoal):
 1. f ` interior S = interior T
[PROOF STEP]
using fim
[PROOF STATE]
proof (prove)
using this:
interior T \<subseteq> f ` interior S
f ` interior S \<subseteq> interior T

goal (1 subgoal):
 1. f ` interior S = interior T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` interior S = interior T

goal (4 subgoals):
 1. continuous_on (interior S) f
 2. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
 3. g ` interior T = interior S
 4. continuous_on (interior T) g
[PROOF STEP]
show "continuous_on (interior S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (interior S) f
[PROOF STEP]
by (metis interior_subset continuous_on_subset contf)
[PROOF STATE]
proof (state)
this:
continuous_on (interior S) f

goal (3 subgoals):
 1. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
 2. g ` interior T = interior S
 3. continuous_on (interior T) g
[PROOF STEP]
show "\<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> interior T \<Longrightarrow> f (g y) = y
[PROOF STEP]
by (meson T subsetD interior_subset)
[PROOF STATE]
proof (state)
this:
?y \<in> interior T \<Longrightarrow> f (g ?y) = ?y

goal (2 subgoals):
 1. g ` interior T = interior S
 2. continuous_on (interior T) g
[PROOF STEP]
have "interior S \<subseteq> g ` interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S \<subseteq> g ` interior T
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior S \<Longrightarrow> x \<in> g ` interior T
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior S \<Longrightarrow> x \<in> g ` interior T
[PROOF STEP]
assume "x \<in> interior S"
[PROOF STATE]
proof (state)
this:
x \<in> interior S

goal (1 subgoal):
 1. \<And>x. x \<in> interior S \<Longrightarrow> x \<in> g ` interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> interior S
[PROOF STEP]
have "f x \<in> interior T"
[PROOF STATE]
proof (prove)
using this:
x \<in> interior S

goal (1 subgoal):
 1. f x \<in> interior T
[PROOF STEP]
using fim
[PROOF STATE]
proof (prove)
using this:
x \<in> interior S
f ` interior S \<subseteq> interior T

goal (1 subgoal):
 1. f x \<in> interior T
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f x \<in> interior T

goal (1 subgoal):
 1. \<And>x. x \<in> interior S \<Longrightarrow> x \<in> g ` interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x \<in> interior T
[PROOF STEP]
show "x \<in> g ` interior T"
[PROOF STATE]
proof (prove)
using this:
f x \<in> interior T

goal (1 subgoal):
 1. x \<in> g ` interior T
[PROOF STEP]
by (metis S \<open>x \<in> interior S\<close> image_iff interior_subset subsetCE)
[PROOF STATE]
proof (state)
this:
x \<in> g ` interior T

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
interior S \<subseteq> g ` interior T

goal (2 subgoals):
 1. g ` interior T = interior S
 2. continuous_on (interior T) g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interior S \<subseteq> g ` interior T
[PROOF STEP]
show "g ` interior T = interior S"
[PROOF STATE]
proof (prove)
using this:
interior S \<subseteq> g ` interior T

goal (1 subgoal):
 1. g ` interior T = interior S
[PROOF STEP]
using gim
[PROOF STATE]
proof (prove)
using this:
interior S \<subseteq> g ` interior T
g ` interior T \<subseteq> interior S

goal (1 subgoal):
 1. g ` interior T = interior S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g ` interior T = interior S

goal (1 subgoal):
 1. continuous_on (interior T) g
[PROOF STEP]
show "continuous_on (interior T) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (interior T) g
[PROOF STEP]
by (metis interior_subset continuous_on_subset contg)
[PROOF STATE]
proof (state)
this:
continuous_on (interior T) g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
homeomorphism (interior S) (interior T) f g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_proj_prop: "\<forall>x\<in>fst_proj {(A,B)| A B. P A \<and> R A B}. P(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>fst_proj {(A, B) |A B. P A \<and> R A B}. P x
[PROOF STEP]
unfolding fst_proj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{A. \<exists>B. (A, B) \<in> {(A, B) |A B. P A \<and> R A B}}. P x
[PROOF STEP]
by auto


[STATEMENT]
lemma in_q64_code: "x mod 64 \<in> q64 \<longleftrightarrow> IArray.sub q64_array (x mod 64)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x mod 64 \<in> q64) = q64_array !! (x mod 64)
[PROOF STEP]
by (subst sub_q64_array) auto


[STATEMENT]
lemma gpair_context1:
  assumes "length ts = length us"
  shows "gpair (GFun f ts) (GFun f us) = GFun (Some f, Some f) (map (case_prod gpair) (zip ts us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gpair (GFun f ts) (GFun f us) = GFun (Some f, Some f) (map2 gpair ts us)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length ts = length us

goal (1 subgoal):
 1. gpair (GFun f ts) (GFun f us) = GFun (Some f, Some f) (map2 gpair ts us)
[PROOF STEP]
unfolding gpair_code
[PROOF STATE]
proof (prove)
using this:
length ts = length us

goal (1 subgoal):
 1. gpair_impl (Some (GFun f ts)) (Some (GFun f us)) = GFun (Some f, Some f) (map2 (\<lambda>s t. gpair_impl (Some s) (Some t)) ts us)
[PROOF STEP]
by (auto intro!: nth_equalityI simp: zip_fill_def)


[STATEMENT]
lemma norm_mult_numeral2 [simp]: "norm (a * numeral w) = norm a * numeral w"
  for a b :: "'a::{real_normed_field,field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a * numeral w) = norm a * numeral w
[PROOF STEP]
by (simp add: norm_mult)


[STATEMENT]
lemma OPT_Suc:
  "OPT (Suc i) W = (
    if W < w (Suc i)
    then OPT i W
    else max(v (Suc i) + OPT i (W - w (Suc i))) (OPT i W)
  )" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
have OPT_in: "OPT n W \<in> {\<Sum> i \<in> S. v i | S. S \<subseteq> {1..n} \<and> (\<Sum> i \<in> S. w i) \<le> W}" for n W
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT n W \<in> {sum v S |S. S \<subseteq> {1..n} \<and> sum w S \<le> W}
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {sum v S |S. S \<subseteq> {1..n} \<and> sum w S \<le> W} \<in> {sum v S |S. S \<subseteq> {1..n} \<and> sum w S \<le> W}
[PROOF STEP]
by - (rule Max_in; force)
[PROOF STATE]
proof (state)
this:
local.OPT ?n ?W \<in> {sum v S |S. S \<subseteq> {1..?n} \<and> sum w S \<le> ?W}

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
from OPT_in[of "Suc i" W]
[PROOF STATE]
proof (chain)
picking this:
local.OPT (Suc i) W \<in> {sum v S |S. S \<subseteq> {1..Suc i} \<and> sum w S \<le> W}
[PROOF STEP]
obtain S where S:
    "S \<subseteq> {1..Suc i}" "sum w S \<le> W" and [simp]: "OPT (Suc i) W = sum v S"
[PROOF STATE]
proof (prove)
using this:
local.OPT (Suc i) W \<in> {sum v S |S. S \<subseteq> {1..Suc i} \<and> sum w S \<le> W}

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>S \<subseteq> {1..Suc i}; sum w S \<le> W; local.OPT (Suc i) W = sum v S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> {1..Suc i}
sum w S \<le> W
local.OPT (Suc i) W = sum v S

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
have "OPT i W \<le> OPT (Suc i) W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT i W \<le> local.OPT (Suc i) W
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {sum v S |S. S \<subseteq> {1..i} \<and> sum w S \<le> W} \<le> Max {sum v S |S. S \<subseteq> {1..Suc i} \<and> sum w S \<le> W}
[PROOF STEP]
by (force intro: Max_mono)
[PROOF STATE]
proof (state)
this:
local.OPT i W \<le> local.OPT (Suc i) W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.OPT i W \<le> local.OPT (Suc i) W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
have "v (Suc i) + OPT i (W - w (Suc i)) \<le> OPT (Suc i) W" if "w (Suc i) \<le> W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W
[PROOF STEP]
have *: "
      v (Suc i) + sum v S = sum v (S \<union> {Suc i}) \<and> (S \<union> {Suc i}) \<subseteq> {1..Suc i}
      \<and> sum w (S \<union> {Suc i}) \<le> W" if "S \<subseteq> {1..i}" "sum w S \<le> W - w (Suc i)" for S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v (Suc i) + sum v S = sum v (S \<union> {Suc i}) \<and> S \<union> {Suc i} \<subseteq> {1..Suc i} \<and> sum w (S \<union> {Suc i}) \<le> W
[PROOF STEP]
using that \<open>w (Suc i) \<le> W\<close>
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {1..i}
sum w S \<le> W - w (Suc i)
w (Suc i) \<le> W

goal (1 subgoal):
 1. v (Suc i) + sum v S = sum v (S \<union> {Suc i}) \<and> S \<union> {Suc i} \<subseteq> {1..Suc i} \<and> sum w (S \<union> {Suc i}) \<le> W
[PROOF STEP]
by (subst sum.insert_if | auto intro: finite_subset[OF _ finite_atLeastAtMost])+
[PROOF STATE]
proof (state)
this:
\<lbrakk>?S \<subseteq> {1..i}; sum w ?S \<le> W - w (Suc i)\<rbrakk> \<Longrightarrow> v (Suc i) + sum v ?S = sum v (?S \<union> {Suc i}) \<and> ?S \<union> {Suc i} \<subseteq> {1..Suc i} \<and> sum w (?S \<union> {Suc i}) \<le> W

goal (1 subgoal):
 1. v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v (Suc i) + Max {sum v S |S. S \<subseteq> {1..i} \<and> sum w S \<le> W - w (Suc i)} \<le> Max {sum v S |S. S \<subseteq> {1..Suc i} \<and> sum w S \<le> W}
[PROOF STEP]
by (subst Max_add_left;
          fastforce intro: Max_mono finite_subset[OF _ finite_atLeastAtMost] dest: *
         )
[PROOF STATE]
proof (state)
this:
v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w (Suc i) \<le> W \<Longrightarrow> v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.OPT i W \<le> local.OPT (Suc i) W
w (Suc i) \<le> W \<Longrightarrow> v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W
[PROOF STEP]
have "?lhs \<ge> ?rhs"
[PROOF STATE]
proof (prove)
using this:
local.OPT i W \<le> local.OPT (Suc i) W
w (Suc i) \<le> W \<Longrightarrow> v (Suc i) + local.OPT i (W - w (Suc i)) \<le> local.OPT (Suc i) W

goal (1 subgoal):
 1. (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)) \<le> local.OPT (Suc i) W
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)) \<le> local.OPT (Suc i) W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
from S
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> {1..Suc i}
sum w S \<le> W
[PROOF STEP]
have *: "sum v S \<le> OPT i W" if "Suc i \<notin> S"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {1..Suc i}
sum w S \<le> W

goal (1 subgoal):
 1. sum v S \<le> local.OPT i W
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {1..Suc i}
sum w S \<le> W
Suc i \<notin> S

goal (1 subgoal):
 1. sum v S \<le> local.OPT i W
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {1..Suc i}
sum w S \<le> W
Suc i \<notin> S

goal (1 subgoal):
 1. sum v S \<le> Max {sum v S |S. S \<subseteq> {1..i} \<and> sum w S \<le> W}
[PROOF STEP]
by (auto simp: atLeastAtMostSuc_conv intro!: Max_ge)
[PROOF STATE]
proof (state)
this:
Suc i \<notin> S \<Longrightarrow> sum v S \<le> local.OPT i W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
have "sum v S \<le> OPT i W" if "W < w (Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum v S \<le> local.OPT i W
[PROOF STEP]
proof (rule *, rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc i \<in> S \<Longrightarrow> False
[PROOF STEP]
assume "Suc i \<in> S"
[PROOF STATE]
proof (state)
this:
Suc i \<in> S

goal (1 subgoal):
 1. Suc i \<in> S \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc i \<in> S
[PROOF STEP]
have "sum w S \<ge> w (Suc i)"
[PROOF STATE]
proof (prove)
using this:
Suc i \<in> S

goal (1 subgoal):
 1. w (Suc i) \<le> sum w S
[PROOF STEP]
using S(1)
[PROOF STATE]
proof (prove)
using this:
Suc i \<in> S
S \<subseteq> {1..Suc i}

goal (1 subgoal):
 1. w (Suc i) \<le> sum w S
[PROOF STEP]
by (subst sum.remove) (auto intro: finite_subset[OF _ finite_atLeastAtMost])
[PROOF STATE]
proof (state)
this:
w (Suc i) \<le> sum w S

goal (1 subgoal):
 1. Suc i \<in> S \<Longrightarrow> False
[PROOF STEP]
with \<open>W < _\<close> \<open>_ \<le> W\<close>
[PROOF STATE]
proof (chain)
picking this:
W < w (Suc i)
sum w S \<le> W
w (Suc i) \<le> sum w S
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
W < w (Suc i)
sum w S \<le> W
w (Suc i) \<le> sum w S

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
W < w (Suc i) \<Longrightarrow> sum v S \<le> local.OPT i W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
W < w (Suc i) \<Longrightarrow> sum v S \<le> local.OPT i W

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
have
    "OPT (Suc i) W \<le> max(v (Suc i) + OPT i (W - w (Suc i))) (OPT i W)" if "w (Suc i) \<le> W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
proof (cases "Suc i \<in> S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc i \<in> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
 2. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Suc i \<in> S

goal (2 subgoals):
 1. Suc i \<in> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
 2. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc i \<in> S
[PROOF STEP]
have [simp]:
      "sum v S = v (Suc i) + sum v (S - {Suc i})" "sum w S = w (Suc i) + sum w (S - {Suc i})"
[PROOF STATE]
proof (prove)
using this:
Suc i \<in> S

goal (1 subgoal):
 1. sum v S = v (Suc i) + sum v (S - {Suc i}) &&& sum w S = w (Suc i) + sum w (S - {Suc i})
[PROOF STEP]
using S(1)
[PROOF STATE]
proof (prove)
using this:
Suc i \<in> S
S \<subseteq> {1..Suc i}

goal (1 subgoal):
 1. sum v S = v (Suc i) + sum v (S - {Suc i}) &&& sum w S = w (Suc i) + sum w (S - {Suc i})
[PROOF STEP]
by (auto intro: finite_subset[OF _ finite_atLeastAtMost] sum.remove)
[PROOF STATE]
proof (state)
this:
sum v S = v (Suc i) + sum v (S - {Suc i})
sum w S = w (Suc i) + sum w (S - {Suc i})

goal (2 subgoals):
 1. Suc i \<in> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
 2. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
have "OPT i (W - w (Suc i)) \<ge> sum v (S - {Suc i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum v (S - {Suc i}) \<le> local.OPT i (W - w (Suc i))
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum v (S - {Suc i}) \<le> Max {sum v S |S. S \<subseteq> {1..i} \<and> sum w S \<le> W - w (Suc i)}
[PROOF STEP]
using S
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {1..Suc i}
sum w S \<le> W

goal (1 subgoal):
 1. sum v (S - {Suc i}) \<le> Max {sum v S |S. S \<subseteq> {1..i} \<and> sum w S \<le> W - w (Suc i)}
[PROOF STEP]
by (fastforce intro!: Max_ge)
[PROOF STATE]
proof (state)
this:
sum v (S - {Suc i}) \<le> local.OPT i (W - w (Suc i))

goal (2 subgoals):
 1. Suc i \<in> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
 2. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum v (S - {Suc i}) \<le> local.OPT i (W - w (Suc i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum v (S - {Suc i}) \<le> local.OPT i (W - w (Suc i))

goal (1 subgoal):
 1. local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)

goal (1 subgoal):
 1. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Suc i \<notin> S

goal (1 subgoal):
 1. Suc i \<notin> S \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc i \<notin> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc i \<notin> S

goal (1 subgoal):
 1. local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
by (auto dest: *)
[PROOF STATE]
proof (state)
this:
local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w (Suc i) \<le> W \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
W < w (Suc i) \<Longrightarrow> sum v S \<le> local.OPT i W
w (Suc i) \<le> W \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)
[PROOF STEP]
have "?lhs \<le> ?rhs"
[PROOF STATE]
proof (prove)
using this:
W < w (Suc i) \<Longrightarrow> sum v S \<le> local.OPT i W
w (Suc i) \<le> W \<Longrightarrow> local.OPT (Suc i) W \<le> max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)

goal (1 subgoal):
 1. local.OPT (Suc i) W \<le> (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.OPT (Suc i) W \<le> (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
with \<open>?lhs \<ge> ?rhs\<close>
[PROOF STATE]
proof (chain)
picking this:
(if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)) \<le> local.OPT (Suc i) W
local.OPT (Suc i) W \<le> (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W)) \<le> local.OPT (Suc i) W
local.OPT (Suc i) W \<le> (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))

goal (1 subgoal):
 1. local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.OPT (Suc i) W = (if W < w (Suc i) then local.OPT i W else max (v (Suc i) + local.OPT i (W - w (Suc i))) (local.OPT i W))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_lattice_inf_le2: "inf (x::'a::linorder_lattice) y \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf x y \<le> y
[PROOF STEP]
unfolding inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<le> y then x else y) \<le> y
[PROOF STEP]
by (metis (full_types) linorder_linear)


[STATEMENT]
lemma true_suntil: "((\<lambda>_. True) suntil P) = ev P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. True) suntil P = ev P
[PROOF STEP]
by (simp add: suntil_def ev_def)


[STATEMENT]
lemma dir_image_alt: "dir_image r f = map_prod f f ` r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dir_image r f = map_prod f f ` r
[PROOF STEP]
unfolding dir_image_def map_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(f a, f b) |a b. (a, b) \<in> r} = (\<lambda>(x, y). (f x, f y)) ` r
[PROOF STEP]
by auto


[STATEMENT]
lemma PosOrdeq_trans:
  assumes "v1 :\<sqsubseteq>val v2" "v2 :\<sqsubseteq>val v3"
  shows "v1 :\<sqsubseteq>val v3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v1 :\<sqsubseteq>val v3
[PROOF STEP]
using assms PosOrd_ordering
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubseteq>val v2
v2 :\<sqsubseteq>val v3
ordering PosOrd_ex_eq PosOrd_ex

goal (1 subgoal):
 1. v1 :\<sqsubseteq>val v3
[PROOF STEP]
unfolding ordering_def
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubseteq>val v2
v2 :\<sqsubseteq>val v3
partial_preordering PosOrd_ex_eq \<and> ordering_axioms PosOrd_ex_eq PosOrd_ex

goal (1 subgoal):
 1. v1 :\<sqsubseteq>val v3
[PROOF STEP]
by (metis partial_preordering.trans)


[STATEMENT]
lemma closure_dyadic_rationals_in_convex_set_pos_1:
  fixes S :: "real set"
  assumes "convex S" and intnz: "interior S \<noteq> {}" and pos: "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> x"
    shows "closure(S \<inter> (\<Union>k m. {of_nat m / 2^k})) = closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
have "\<exists>m. f 1/2^k = real m / 2^k" if "(f 1) / 2^k \<in> S" "f 1 \<in> \<int>" for k and f :: "real \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m. f 1 / 2 ^ k = real m / 2 ^ k
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
f 1 / 2 ^ k \<in> S
f 1 \<in> \<int>

goal (1 subgoal):
 1. \<exists>m. f 1 / 2 ^ k = real m / 2 ^ k
[PROOF STEP]
by (force simp: Ints_def zero_le_divide_iff power_le_zero_eq dest: pos zero_le_imp_eq_int)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f 1 / 2 ^ ?k \<in> S; ?f 1 \<in> \<int>\<rbrakk> \<Longrightarrow> \<exists>m. ?f 1 / 2 ^ ?k = real m / 2 ^ ?k

goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?f 1 / 2 ^ ?k \<in> S; ?f 1 \<in> \<int>\<rbrakk> \<Longrightarrow> \<exists>m. ?f 1 / 2 ^ ?k = real m / 2 ^ ?k
[PROOF STEP]
have "S \<inter> (\<Union>k m. {real m / 2^k}) = S \<inter>
             (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2^k) *\<^sub>R i})"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f 1 / 2 ^ ?k \<in> S; ?f 1 \<in> \<int>\<rbrakk> \<Longrightarrow> \<exists>m. ?f 1 / 2 ^ ?k = real m / 2 ^ ?k

goal (1 subgoal):
 1. S \<inter> (\<Union>k m. {real m / 2 ^ k}) = S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
S \<inter> (\<Union>k m. {real m / 2 ^ k}) = S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})

goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<inter> (\<Union>k m. {real m / 2 ^ k}) = S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<inter> (\<Union>k m. {real m / 2 ^ k}) = S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})

goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
using closure_dyadic_rationals_in_convex_set [OF \<open>convex S\<close> intnz]
[PROOF STATE]
proof (prove)
using this:
S \<inter> (\<Union>k m. {real m / 2 ^ k}) = S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})
closure (S \<inter> (\<Union>k. \<Union>f\<in>Basis \<rightarrow> \<int>. {\<Sum>i\<in>Basis. (f i / 2 ^ k) *\<^sub>R i})) = closure S

goal (1 subgoal):
 1. closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closure (S \<inter> (\<Union>k m. {real m / 2 ^ k})) = closure S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_eq_rdot: "(\<forall>z. x \<bullet> z = y \<bullet> z) \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>z. x \<bullet> z = y \<bullet> z) = (x = y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>z. x \<bullet> z = y \<bullet> z \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
assume "\<forall>z. x \<bullet> z = y \<bullet> z"
[PROOF STATE]
proof (state)
this:
\<forall>z. x \<bullet> z = y \<bullet> z

goal (2 subgoals):
 1. \<forall>z. x \<bullet> z = y \<bullet> z \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
have "\<forall>z. (x - y) \<bullet> z = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>z. x \<bullet> z = y \<bullet> z

goal (1 subgoal):
 1. \<forall>z. (x - y) \<bullet> z = 0
[PROOF STEP]
by (simp add: inner_diff)
[PROOF STATE]
proof (state)
this:
\<forall>z. (x - y) \<bullet> z = 0

goal (2 subgoals):
 1. \<forall>z. x \<bullet> z = y \<bullet> z \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>z. (x - y) \<bullet> z = 0
[PROOF STEP]
have "(x - y) \<bullet> (x - y) = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>z. (x - y) \<bullet> z = 0

goal (1 subgoal):
 1. (x - y) \<bullet> (x - y) = 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(x - y) \<bullet> (x - y) = 0

goal (2 subgoals):
 1. \<forall>z. x \<bullet> z = y \<bullet> z \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> \<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x - y) \<bullet> (x - y) = 0
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
(x - y) \<bullet> (x - y) = 0

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

goal (1 subgoal):
 1. x = y \<Longrightarrow> \<forall>z. x \<bullet> z = y \<bullet> z
[PROOF STEP]
qed simp


[STATEMENT]
lemma norm: "norm (\<chi> k) = (if coprime k n then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
have "\<chi> k = \<chi> (k mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> k = \<chi> (k mod n)
[PROOF STEP]
by (intro cong) (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
\<chi> k = \<chi> (k mod n)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<chi> k = \<chi> (k mod n)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 < n
[PROOF STEP]
have "\<dots> = dc2c \<chi> (k mod n)"
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. \<chi> (k mod n) = dc2c \<chi> (k mod n)
[PROOF STEP]
by (simp add: dc2c_def)
[PROOF STATE]
proof (state)
this:
\<chi> (k mod n) = dc2c \<chi> (k mod n)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<chi> (k mod n) = dc2c \<chi> (k mod n)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 < n
[PROOF STEP]
have "norm \<dots> = (if coprime k n then 1 else 0)"
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. cmod (dc2c \<chi> (k mod n)) = (if coprime k n then 1 else 0)
[PROOF STEP]
by (subst dc2c.norm_char) (auto simp: G_def residue_mult_group_def mod_in_totatives)
[PROOF STATE]
proof (state)
this:
cmod (dc2c \<chi> (k mod n)) = (if coprime k n then 1 else 0)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (\<chi> k) = (if coprime k n then 1 else 0)

goal (1 subgoal):
 1. cmod (\<chi> k) = (if coprime k n then 1 else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod (\<chi> k) = (if coprime k n then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rat_denum: "\<exists>f :: nat \<Rightarrow> rat. surj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. surj f
[PROOF STEP]
using surj_nat_to_rat_surj
[PROOF STATE]
proof (prove)
using this:
surj nat_to_rat_surj

goal (1 subgoal):
 1. \<exists>f. surj f
[PROOF STEP]
by metis


[STATEMENT]
lemma (in finite_measure) finite_measure_eq_AE:
  assumes iff: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
  assumes A: "A \<in> sets M" and B: "B \<in> sets M"
  shows "measure M A = measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M A = Sigma_Algebra.measure M B
[PROOF STEP]
using assms emeasure_eq_AE[OF assms]
[PROOF STATE]
proof (prove)
using this:
AE x in M. (x \<in> A) = (x \<in> B)
A \<in> sets M
B \<in> sets M
emeasure M A = emeasure M B

goal (1 subgoal):
 1. Sigma_Algebra.measure M A = Sigma_Algebra.measure M B
[PROOF STEP]
by (simp add: emeasure_eq_measure)


[STATEMENT]
lemma sumset_translate_eq_right:
  assumes "A \<subseteq> G" and "B \<subseteq> G" and "x \<in> G"
  shows "(sumset A {x} = sumset B {x}) \<longleftrightarrow>  A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sumset A {x} = sumset B {x}) = (A = B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G
B \<subseteq> G
x \<in> G

goal (1 subgoal):
 1. (sumset A {x} = sumset B {x}) = (A = B)
[PROOF STEP]
by (smt (verit, best) Diff_Int_distrib2 Diff_eq_empty_iff
 Int_Un_eq(1) Int_absorb2 Un_Diff_cancel2 Un_commute insert_disjoint(2)
subset_refl sumset_is_empty_iff sumsetdiff_sing)


[STATEMENT]
lemma sets_tree_sigma_eq: "sets (tree_sigma M) = sigma_sets (trees (space M)) (trees_cyl ` trees (sets M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (tree_sigma M) = sigma_sets (trees (space M)) (trees_cyl ` trees (sets M))
[PROOF STEP]
unfolding tree_sigma_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (sigma (trees (space M)) (trees_cyl ` trees (sets M))) = sigma_sets (trees (space M)) (trees_cyl ` trees (sets M))
[PROOF STEP]
by (rule sets_measure_of) (rule trees_cyl_sets_in_space)


[STATEMENT]
lemma real_tendsto_divide_at_top:
  fixes c::"real"
  assumes "(f \<longlongrightarrow> c) F"
  assumes "filterlim g at_top F"
  shows "((\<lambda>x. f x / g x) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> 0) F
[PROOF STEP]
by (auto simp: divide_inverse_commute
      intro!: tendsto_mult[THEN tendsto_eq_rhs] tendsto_inverse_0_at_top assms)


[STATEMENT]
lemma stationary_distribution_exists:
  "\<exists> x. stationary_distribution (pmf_of_st_vec x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. stationary_distribution (pmf_of_st_vec x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. stationary_distribution (pmf_of_st_vec x)
[PROOF STEP]
from stationary_distribution_exists
[PROOF STATE]
proof (chain)
picking this:
\<exists>v. ?A *st v = v
[PROOF STEP]
obtain x where ev: "A *st x = x"
[PROOF STATE]
proof (prove)
using this:
\<exists>v. ?A *st v = v

goal (1 subgoal):
 1. (\<And>x. A *st x = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A *st x = x

goal (1 subgoal):
 1. \<exists>x. stationary_distribution (pmf_of_st_vec x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. stationary_distribution (pmf_of_st_vec x)
[PROOF STEP]
by (intro exI[of _ x], unfold stationary_distribution_pmf_of_st_vec,
    simp add: ev)
[PROOF STATE]
proof (state)
this:
\<exists>x. stationary_distribution (pmf_of_st_vec x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conv_radius_cong':
  assumes "eventually (\<lambda>x. f x = g x) sequentially"
  shows   "conv_radius f = conv_radius g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius f = conv_radius g
[PROOF STEP]
unfolding conv_radius_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>n. inverse (ereal (root n (norm (f n))))) = liminf (\<lambda>n. inverse (ereal (root n (norm (g n)))))
[PROOF STEP]
by (intro Liminf_eq eventually_mono [OF assms]) auto


[STATEMENT]
lemma M_not_dvd_24: "\<not>M dvd 24"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> M dvd 24
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M dvd 24 \<Longrightarrow> False
[PROOF STEP]
assume "M dvd 24"
[PROOF STATE]
proof (state)
this:
M dvd 24

goal (1 subgoal):
 1. M dvd 24 \<Longrightarrow> False
[PROOF STEP]
hence "M dvd 2 * 2 * 2 * 3"
[PROOF STATE]
proof (prove)
using this:
M dvd 24

goal (1 subgoal):
 1. M dvd 2 * 2 * 2 * 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M dvd 2 * 2 * 2 * 3

goal (1 subgoal):
 1. M dvd 24 \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M dvd 2 * 2 * 2 * 3

goal (1 subgoal):
 1. M dvd 24 \<Longrightarrow> False
[PROOF STEP]
have "?this \<longleftrightarrow> M dvd 2 \<or> M dvd 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M dvd 2 * 2 * 2 * 3) = (M dvd 2 \<or> M dvd 3)
[PROOF STEP]
using prime
[PROOF STATE]
proof (prove)
using this:
prime M

goal (1 subgoal):
 1. (M dvd 2 * 2 * 2 * 3) = (M dvd 2 \<or> M dvd 3)
[PROOF STEP]
by (simp only: prime_dvd_mult_iff) auto
[PROOF STATE]
proof (state)
this:
(M dvd 2 * 2 * 2 * 3) = (M dvd 2 \<or> M dvd 3)

goal (1 subgoal):
 1. M dvd 24 \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M dvd 2 \<or> M dvd 3
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
M dvd 2 \<or> M dvd 3

goal (1 subgoal):
 1. False
[PROOF STEP]
using M_gt_6
[PROOF STATE]
proof (prove)
using this:
M dvd 2 \<or> M dvd 3
6 < M

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_fm_UnionP [simp]:
  "(UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
obtain j::name where "atom j \<sharp> (x,y,z,i,u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. atom j \<sharp> (x, y, z, i, u) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom j \<sharp> (x, y, z, i, u)

goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom j \<sharp> (x, y, z, i, u)

goal (1 subgoal):
 1. (UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)
[PROOF STEP]
by (auto simp: UnionP.simps [of j])
[PROOF STATE]
proof (state)
this:
(UnionP x y z)(i::=u) = UnionP (subst i u x) (subst i u y) (subst i u z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_zip_with: "map f (zip_with g xs ys) = zip_with (\<lambda>x y. f (g x y)) xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (zip_with g xs ys) = zip_with (\<lambda>x y. f (g x y)) xs ys
[PROOF STEP]
by (induction g xs ys rule: zip_with.induct) simp_all


[STATEMENT]
lemma listI:
  "\<lbrakk> length xs = n; set xs <= A \<rbrakk> \<Longrightarrow> xs \<in> list n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = n; set xs \<subseteq> A\<rbrakk> \<Longrightarrow> xs \<in> list n A
[PROOF STEP]
apply (unfold list_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = n; set xs \<subseteq> A\<rbrakk> \<Longrightarrow> xs \<in> {xs. length xs = n \<and> set xs \<subseteq> A}
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Graph) isSimplePath_cons[split_path_simps]:
  "isSimplePath s (e#p) t
  \<longleftrightarrow> (\<exists>u. e=(s,u) \<and> s\<noteq>u \<and> (s,u)\<in>E
        \<and> isSimplePath u p t \<and> s\<notin>set (pathVertices_fwd u p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isSimplePath s (e # p) t = (\<exists>u. e = (s, u) \<and> s \<noteq> u \<and> (s, u) \<in> E \<and> isSimplePath u p t \<and> s \<notin> set (pathVertices_fwd u p))
[PROOF STEP]
using isSimplePath_append[of s "[e]" p t, simplified]
[PROOF STATE]
proof (prove)
using this:
isSimplePath s (e # p) t = (\<exists>u. isSimplePath s [e] u \<and> isSimplePath u p t \<and> {s, snd e} \<inter> set (pathVertices_fwd u p) = {u})

goal (1 subgoal):
 1. isSimplePath s (e # p) t = (\<exists>u. e = (s, u) \<and> s \<noteq> u \<and> (s, u) \<in> E \<and> isSimplePath u p t \<and> s \<notin> set (pathVertices_fwd u p))
[PROOF STEP]
by (auto simp: split_path_simps)


[STATEMENT]
lemma trivial_limit_at_left_real [simp]: "\<not> trivial_limit (at_left x)"
  for x :: "'a::{no_bot,dense_order,linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_left x \<noteq> bot
[PROOF STEP]
using lt_ex [of x]
[PROOF STATE]
proof (prove)
using this:
\<exists>y. y < x

goal (1 subgoal):
 1. at_left x \<noteq> bot
[PROOF STEP]
by safe (auto simp add: trivial_limit_def eventually_at_left dest: dense)


[STATEMENT]
lemma foldli_bex_aux: "foldli l (\<lambda>x. \<not>x) (\<lambda>x _. P x) b \<longleftrightarrow> b \<or> Bex (set l) P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldli l Not (\<lambda>x _. P x) b = (b \<or> Bex (set l) P)
[PROOF STEP]
by (induct l arbitrary: b) auto


[STATEMENT]
lemma (in group_action) orbit_sym:
  assumes "x \<in> E" and "y \<in> E" and "y \<in> orbit G \<phi> x"
  shows "x \<in> orbit G \<phi> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
have "\<exists> g \<in> carrier G. (\<phi> g) x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g\<in>carrier G. \<phi> g x = y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> E
y \<in> E
y \<in> orbit G \<phi> x

goal (1 subgoal):
 1. \<exists>g\<in>carrier G. \<phi> g x = y
[PROOF STEP]
by (auto simp: orbit_def)
[PROOF STATE]
proof (state)
this:
\<exists>g\<in>carrier G. \<phi> g x = y

goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>g\<in>carrier G. \<phi> g x = y
[PROOF STEP]
obtain g where g: "g \<in> carrier G \<and> (\<phi> g) x = y"
[PROOF STATE]
proof (prove)
using this:
\<exists>g\<in>carrier G. \<phi> g x = y

goal (1 subgoal):
 1. (\<And>g. g \<in> carrier G \<and> \<phi> g x = y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g \<in> carrier G \<and> \<phi> g x = y

goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
hence "(\<phi> (inv g)) y = x"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G \<and> \<phi> g x = y

goal (1 subgoal):
 1. \<phi> (inv g) y = x
[PROOF STEP]
using orbit_sym_aux
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G \<and> \<phi> g x = y
\<lbrakk>?g \<in> carrier G; ?x \<in> E; \<phi> ?g ?x = ?y\<rbrakk> \<Longrightarrow> \<phi> (inv ?g) ?y = ?x

goal (1 subgoal):
 1. \<phi> (inv g) y = x
[PROOF STEP]
by (simp add: assms(1))
[PROOF STATE]
proof (state)
this:
\<phi> (inv g) y = x

goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<phi> (inv g) y = x

goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
using g group_hom group_hom.axioms(1) orbit_def
[PROOF STATE]
proof (prove)
using this:
\<phi> (inv g) y = x
g \<in> carrier G \<and> \<phi> g x = y
group_hom G (BijGroup E) \<phi>
group_hom ?G ?H ?h \<Longrightarrow> Group.group ?G
orbit ?G ?\<phi> ?x = {?\<phi> g ?x |g. g \<in> carrier ?G}

goal (1 subgoal):
 1. x \<in> orbit G \<phi> y
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> orbit G \<phi> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finmap_eq_iff: "P = Q \<longleftrightarrow> (domain P = domain Q \<and> (\<forall>i\<in>domain P. P i = Q i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P = Q) = (domain P = domain Q \<and> (\<forall>i\<in>domain P. (P)\<^sub>F i = (Q)\<^sub>F i))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P Q. \<lbrakk>finite (dom P); finite (dom Q)\<rbrakk> \<Longrightarrow> (P = Q) = (dom P = dom Q \<and> (\<forall>i\<in>dom P. (if i \<in> dom P then the (P i) else undefined) = (if i \<in> dom Q then the (Q i) else undefined)))
[PROOF STEP]
apply (safe intro!: ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P Q x. \<lbrakk>finite (dom P); finite (dom Q); dom P = dom Q; \<forall>i\<in>dom P. (if i \<in> dom P then the (P i) else undefined) = (if i \<in> dom Q then the (Q i) else undefined)\<rbrakk> \<Longrightarrow> P x = Q x
[PROOF STEP]
subgoal for P Q x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (dom P); finite (dom Q); dom P = dom Q; \<forall>i\<in>dom P. (if i \<in> dom P then the (P i) else undefined) = (if i \<in> dom Q then the (Q i) else undefined)\<rbrakk> \<Longrightarrow> P x = Q x
[PROOF STEP]
by (cases "x \<in> dom P"; cases "P x") (auto dest!: bspec[where x=x])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gcd_smult_ex: assumes "a \<noteq> 0"
  shows "\<exists> b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
 2. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f = 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
 2. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f = 0

goal (1 subgoal):
 1. \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
by (intro exI[of _ 1], auto)
[PROOF STATE]
proof (state)
this:
\<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
hence id: "(a = 0 \<or> f = 0) = False"
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

goal (1 subgoal):
 1. (a = (0::'a) \<or> f = 0) = False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
a \<noteq> (0::'a)

goal (1 subgoal):
 1. (a = (0::'a) \<or> f = 0) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a = (0::'a) \<or> f = 0) = False

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
unfolding gcd_smult id if_False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. smult (gcd a (content g div gcd (content f) (content g))) (gcd f g) = smult b (gcd f g) \<and> b \<noteq> (0::'a)
[PROOF STEP]
by (intro exI conjI, rule refl, insert assms, auto)
[PROOF STATE]
proof (state)
this:
\<exists>b. gcd (smult a f) g = smult b (gcd f g) \<and> b \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_filter_disj_or_conv:
  assumes "\<And>x. x\<in>set xs \<longrightarrow> \<not>(P x \<and> Q x)"
  shows "length [x \<leftarrow> xs. P x \<or> Q x] = length (filter P xs) + length (filter Q xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>x. P x \<or> Q x) xs) = length (filter P xs) + length (filter Q xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> set xs \<longrightarrow> \<not> (P ?x \<and> Q ?x)

goal (1 subgoal):
 1. length (filter (\<lambda>x. P x \<or> Q x) xs) = length (filter P xs) + length (filter Q xs)
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma in_restrict_rel_iff: "(x, y) \<in> restrict_rel A R \<longleftrightarrow> (x, y) \<in> R \<and> x \<in> A \<and> y \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> restrict_rel A R) = ((x, y) \<in> R \<and> x \<in> A \<and> y \<in> A)
[PROOF STEP]
by(simp add: restrict_rel_def)


[STATEMENT]
lemma shunting_right:
  "-x \<sqinter> -y \<le> -z \<longleftrightarrow> -x \<le> -z \<squnion> --y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x \<sqinter> - y \<le> - z) = (- x \<le> - z \<squnion> - - y)
[PROOF STEP]
by (metis inf_commutative sub_commutative shunting)


[STATEMENT]
lemma proj2_incident_switch:
  assumes "proj2_incident p l"
  shows "proj2_incident (L2P l) (P2L p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_incident (L2P l) (P2L p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
proj2_incident p l

goal (1 subgoal):
 1. proj2_incident (L2P l) (P2L p)
[PROOF STEP]
unfolding proj2_incident_def and proj2_line_rep_def
[PROOF STATE]
proof (prove)
using this:
proj2_rep p \<bullet> proj2_rep (L2P l) = 0

goal (1 subgoal):
 1. proj2_rep (L2P l) \<bullet> proj2_rep (L2P (P2L p)) = 0
[PROOF STEP]
by (simp add: inner_commute)


[STATEMENT]
lemma midpoint_in_closed_segment [simp]: "midpoint a b \<in> closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint a b \<in> closed_segment a b
[PROOF STEP]
using midpoints_in_convex_hull segment_convex_hull
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> convex hull ?s; ?y \<in> convex hull ?s\<rbrakk> \<Longrightarrow> midpoint ?x ?y \<in> convex hull ?s
closed_segment ?a ?b = convex hull {?a, ?b}

goal (1 subgoal):
 1. midpoint a b \<in> closed_segment a b
[PROOF STEP]
by blast


[STATEMENT]
lemma is_poincare_line_0_imag_is_y_axis:
  assumes "is_poincare_line l" "0\<^sub>h \<in> circline_set l"
    "y \<in> circline_set l \<inter> circline_set y_axis" "y \<noteq> 0\<^sub>h" "y \<noteq> \<infinity>\<^sub>h"
  shows "l = y_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = y_axis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line l
0\<^sub>h \<in> circline_set l
y \<in> circline_set l \<inter> circline_set y_axis
y \<noteq> 0\<^sub>h
y \<noteq> \<infinity>\<^sub>h

goal (1 subgoal):
 1. l = y_axis
[PROOF STEP]
using is_poincare_line_trough_zero_trough_infty[OF assms(1-2)]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line l
0\<^sub>h \<in> circline_set l
y \<in> circline_set l \<inter> circline_set y_axis
y \<noteq> 0\<^sub>h
y \<noteq> \<infinity>\<^sub>h
\<infinity>\<^sub>h \<in> circline_set l

goal (1 subgoal):
 1. l = y_axis
[PROOF STEP]
using unique_circline_set[of y "0\<^sub>h" "\<infinity>\<^sub>h"]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line l
0\<^sub>h \<in> circline_set l
y \<in> circline_set l \<inter> circline_set y_axis
y \<noteq> 0\<^sub>h
y \<noteq> \<infinity>\<^sub>h
\<infinity>\<^sub>h \<in> circline_set l
\<lbrakk>y \<noteq> 0\<^sub>h; y \<noteq> \<infinity>\<^sub>h; 0\<^sub>h \<noteq> \<infinity>\<^sub>h\<rbrakk> \<Longrightarrow> \<exists>!H. y \<in> circline_set H \<and> 0\<^sub>h \<in> circline_set H \<and> \<infinity>\<^sub>h \<in> circline_set H

goal (1 subgoal):
 1. l = y_axis
[PROOF STEP]
by auto


[STATEMENT]
lemma ord_recp_succ_iff:
  assumes k: "Ord k" shows "ord_recp T G H (succ k) z \<longleftrightarrow> (\<exists>y. z = G y \<and> ord_recp T G H k y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
proof (cases "k=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
 2. k \<noteq> 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
 2. k \<noteq> 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
by (simp add: ord_recp_def ord_rec_Seq_def) (metis Seq_0 Seq_insf app_insf_Seq)
[PROOF STATE]
proof (state)
this:
ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)

goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
k \<noteq> 0

goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0

goal (1 subgoal):
 1. ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
Ord k

goal (1 subgoal):
 1. ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)
[PROOF STEP]
by (auto simp: ord_recp_def ord_rec_Seq_succ_iff)
[PROOF STATE]
proof (state)
this:
ord_recp T G H (succ k) z = (\<exists>y. z = G y \<and> ord_recp T G H k y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_power_eqD':
  fixes f g :: "'a :: {idom,semiring_char_0} fps"
  assumes "f ^ m = g ^ m" "f $ subdegree f = g $ subdegree g" "m > 0"
  shows   "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
using fps_power_Suc_eqD'[of f "m-1" g] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f ^ Suc (m - 1) = g ^ Suc (m - 1); f $ subdegree f = g $ subdegree g\<rbrakk> \<Longrightarrow> f = g
f ^ m = g ^ m
f $ subdegree f = g $ subdegree g
0 < m

goal (1 subgoal):
 1. f = g
[PROOF STEP]
by simp


[STATEMENT]
lemma convex_cball [iff]:
  fixes x :: "'a::real_normed_vector"
  shows "convex (cball x e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
fix y z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
assume yz: "dist x y \<le> e" "dist x z \<le> e"
[PROOF STATE]
proof (state)
this:
dist x y \<le> e
dist x z \<le> e

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
[PROOF STATE]
proof (state)
this:
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
using uv yz
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 \<le> v
u + v = 1
dist x y \<le> e
dist x z \<le> e

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
using convex_on_dist [of "cball x e" x, unfolded convex_on_def,
        THEN bspec[where x=y], THEN bspec[where x=z]]
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 \<le> v
u + v = 1
dist x y \<le> e
dist x z \<le> e
\<lbrakk>y \<in> cball x e; z \<in> cball x e\<rbrakk> \<Longrightarrow> \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
[PROOF STEP]
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e"
[PROOF STATE]
proof (prove)
using this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e
[PROOF STEP]
using convex_bound_le[OF yz uv]
[PROOF STATE]
proof (prove)
using this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z
u * dist x y + v * dist x z \<le> e

goal (1 subgoal):
 1. dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>dist x ?y2 \<le> e; dist x ?z2 \<le> e; 0 \<le> ?u2; 0 \<le> ?v2; ?u2 + ?v2 = 1\<rbrakk> \<Longrightarrow> dist x (?u2 *\<^sub>R ?y2 + ?v2 *\<^sub>R ?z2) \<le> e

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>dist x ?y2 \<le> e; dist x ?z2 \<le> e; 0 \<le> ?u2; 0 \<le> ?v2; ?u2 + ?v2 = 1\<rbrakk> \<Longrightarrow> dist x (?u2 *\<^sub>R ?y2 + ?v2 *\<^sub>R ?z2) \<le> e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dist x ?y2 \<le> e; dist x ?z2 \<le> e; 0 \<le> ?u2; 0 \<le> ?v2; ?u2 + ?v2 = 1\<rbrakk> \<Longrightarrow> dist x (?u2 *\<^sub>R ?y2 + ?v2 *\<^sub>R ?z2) \<le> e

goal (1 subgoal):
 1. convex (cball x e)
[PROOF STEP]
by (auto simp: convex_def Ball_def)
[PROOF STATE]
proof (state)
this:
convex (cball x e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_tm_le_mk_composable0: "length tm \<le> length (mk_composable0 tm)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
proof (cases "length tm")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length tm = 0 \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
 2. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
length tm = 0

goal (2 subgoals):
 1. length tm = 0 \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
 2. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length tm = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length tm = 0

goal (1 subgoal):
 1. length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length tm \<le> length (mk_composable0 tm)

goal (1 subgoal):
 1. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
case (Suc nat)
[PROOF STATE]
proof (state)
this:
length tm = Suc nat

goal (1 subgoal):
 1. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length tm = Suc nat
[PROOF STEP]
have A: "length tm = Suc nat"
[PROOF STATE]
proof (prove)
using this:
length tm = Suc nat

goal (1 subgoal):
 1. length tm = Suc nat
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length tm = Suc nat

goal (1 subgoal):
 1. \<And>nat. length tm = Suc nat \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
proof (cases "is_even (length tm)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_even (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
 2. is_odd (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
is_even (length tm)

goal (2 subgoals):
 1. is_even (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
 2. is_odd (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
length tm = Suc nat
is_even (length tm)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length tm = Suc nat
is_even (length tm)

goal (1 subgoal):
 1. length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
by (auto simp add: length_mk_composable0_even)
[PROOF STATE]
proof (state)
this:
length tm \<le> length (mk_composable0 tm)

goal (1 subgoal):
 1. is_odd (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_odd (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
is_odd (length tm)

goal (1 subgoal):
 1. is_odd (length tm) \<Longrightarrow> length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
length tm = Suc nat
is_odd (length tm)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length tm = Suc nat
is_odd (length tm)

goal (1 subgoal):
 1. length tm \<le> length (mk_composable0 tm)
[PROOF STEP]
by (auto simp add: length_mk_composable0_odd)
[PROOF STATE]
proof (state)
this:
length tm \<le> length (mk_composable0 tm)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unique_apath_verts_sub_awalk:
  "\<lbrakk>apath u p v; awalk u q v; \<exists>!p. apath u p v\<rbrakk> \<Longrightarrow> set (awalk_verts u p) \<subseteq> set (awalk_verts u q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>apath u p v; awalk u q v; \<exists>!p. apath u p v\<rbrakk> \<Longrightarrow> set (awalk_verts u p) \<subseteq> set (awalk_verts u q)
[PROOF STEP]
using unique_apath_verts_in_awalk
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> set (awalk_verts ?u ?p1.0); apath ?u ?p1.0 ?v; awalk ?u ?p2.0 ?v; \<exists>!p. apath ?u p ?v\<rbrakk> \<Longrightarrow> ?x \<in> set (awalk_verts ?u ?p2.0)

goal (1 subgoal):
 1. \<lbrakk>apath u p v; awalk u q v; \<exists>!p. apath u p v\<rbrakk> \<Longrightarrow> set (awalk_verts u p) \<subseteq> set (awalk_verts u q)
[PROOF STEP]
by blast


[STATEMENT]
lemma rem_nth_take_drop: "i < length xs \<Longrightarrow> rem_nth i xs = take i xs @ drop (Suc i) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length xs \<Longrightarrow> rem_nth i xs = take i xs @ drop (Suc i) xs
[PROOF STEP]
by (induction i xs rule: rem_nth.induct) auto


[STATEMENT]
lemma F1set3_bd: "|F1set3 x| <o bd_F1 +c bd_F2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |F1set3 x| <o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule ordLess_ordLeq_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. |F1set3 x| <o ?r'
 2. ?r' \<le>o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule F1.set_bd(3))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bd_F1 \<le>o bd_F1 +c bd_F2
[PROOF STEP]
apply (rule ordLeq_csum1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Card_order bd_F1
[PROOF STEP]
apply (rule F1.bd_Card_order)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma assumes "A \<in> carrier_mat n n"
  and "nonneg_mat A"
  and "\<forall> x. poly (char_poly A) x = 0 \<longrightarrow> x \<le> 1"
  and "\<forall> x :: complex. norm x = 1 \<longrightarrow> order x (map_poly of_real (char_poly A)) \<le> d"
  and "n \<noteq> 0"
  shows "\<exists>c1 c2. \<forall>k a. a \<in> elements_mat (A ^\<^sub>m k) \<longrightarrow> abs a \<le> (c1 + c2 * real k ^ (d - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k a. a \<in> elements_mat (A ^\<^sub>m k) \<longrightarrow> \<bar>a\<bar> \<le> c1 + c2 * real k ^ (d - 1)
[PROOF STEP]
using perron_frobenius_spectral_type_based[untransferred, cancel_card_constraint, OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>c1 c2. \<forall>k a. a \<in> elements_mat (A ^\<^sub>m k) \<longrightarrow> \<bar>a\<bar> \<le> c1 + c2 * real k ^ (d - 1)

goal (1 subgoal):
 1. \<exists>c1 c2. \<forall>k a. a \<in> elements_mat (A ^\<^sub>m k) \<longrightarrow> \<bar>a\<bar> \<le> c1 + c2 * real k ^ (d - 1)
[PROOF STEP]
.


[STATEMENT]
lemma det3_nonneg_segments_of_aformI:
  assumes "e \<in> UNIV \<rightarrow> {-1 .. 1}"
  assumes "length (half_segments_of_aform X) \<noteq> 1"
  assumes "seg \<in> set (segments_of_aform X)"
  shows "det3 (fst seg) (snd seg) (aform_val e X) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> det3 (fst seg) (snd seg) (aform_val e X)
[PROOF STEP]
using assms det3_nonneg_segments_of_aform
[PROOF STATE]
proof (prove)
using this:
e \<in> UNIV \<rightarrow> {- 1..1}
length (half_segments_of_aform X) \<noteq> 1
seg \<in> set (segments_of_aform X)
\<lbrakk>?e \<in> UNIV \<rightarrow> {- 1..1}; length (half_segments_of_aform ?X) \<noteq> 1\<rbrakk> \<Longrightarrow> list_all (\<lambda>seg. 0 \<le> det3 (fst seg) (snd seg) (aform_val ?e ?X)) (segments_of_aform ?X)

goal (1 subgoal):
 1. 0 \<le> det3 (fst seg) (snd seg) (aform_val e X)
[PROOF STEP]
by (auto simp: list_all_iff)


[STATEMENT]
lemma Int_interval_cart:
  fixes a :: "real^'n"
  shows "cbox a b \<inter> cbox c d =  {(\<chi> i. max (a$i) (c$i)) .. (\<chi> i. min (b$i) (d$i))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<inter> cbox c d = {\<chi>i. max (a $ i) (c $ i)..\<chi>i. min (b $ i) (d $ i)}
[PROOF STEP]
unfolding Int_interval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i) = {\<chi>i. max (a $ i) (c $ i)..\<chi>i. min (b $ i) (d $ i)}
[PROOF STEP]
by (auto simp: mem_box less_eq_vec_def)
    (auto simp: Basis_vec_def inner_axis)


[STATEMENT]
lemma of_bool_Bex_eq_nn_integral:
  assumes unique: "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> P x \<Longrightarrow> P y \<Longrightarrow> x = y"
  shows "of_bool (\<exists>y\<in>X. P y) = (\<integral>\<^sup>+y. of_bool (P y) \<partial>count_space X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
 2. \<not> ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
assume "\<exists>y\<in>X. P y"
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>X. P y

goal (2 subgoals):
 1. ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
 2. \<not> ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>y\<in>X. P y
[PROOF STEP]
obtain y where "P y" "y \<in> X"
[PROOF STATE]
proof (prove)
using this:
\<exists>y\<in>X. P y

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>P y; y \<in> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P y
y \<in> X

goal (2 subgoals):
 1. ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
 2. \<not> ?P \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P y
y \<in> X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P y
y \<in> X

goal (1 subgoal):
 1. of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
by (subst nn_integral_count_space'[where A="{y}"]) (auto dest: unique)
[PROOF STATE]
proof (state)
this:
of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X

goal (1 subgoal):
 1. \<not> (\<exists>y\<in>X. P y) \<Longrightarrow> of_bool (\<exists>y\<in>X. P y) = \<integral>\<^sup>+ y. of_bool (P y) \<partial>count_space X
[PROOF STEP]
qed (auto cong: nn_integral_cong_simp)


[STATEMENT]
lemma "c \<noteq> 0 \<Longrightarrow> D (\<lambda>t. exp (a * sin (cos (t^4) / c))) =
  (\<lambda>t. - 4 * a * t^3 * sin (t^4) / c * cos (cos (t^4) / c) * exp (a * sin (cos (t^4) / c))) on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow>  D (\<lambda>t. exp (a * sin (cos (t ^ 4) / c))) = (\<lambda>t. - 4 * a * t ^ 3 * sin (t ^ 4) / c * cos (cos (t ^ 4) / c) * exp (a * sin (cos (t ^ 4) / c))) on T
[PROOF STEP]
by (intro poly_derivatives) (auto intro!: poly_derivatives simp: power2_eq_square)


[STATEMENT]
lemma "(\<exists>x. P(x)\<longrightarrow>Q) = ((\<forall>x. P(x)) \<longrightarrow> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x \<longrightarrow> Q) = ((\<forall>x. P x) \<longrightarrow> Q)
[PROOF STEP]
by blast


[STATEMENT]
lemma tau_star: "(\<tau> x)\<^sup>\<star> = 1\<^sub>\<sigma> + \<tau> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> x\<^sup>\<star> = 1\<^sub>\<sigma> + \<tau> x
[PROOF STEP]
by (metis local.cl6 local.tau_def star_unfold_eq)


[STATEMENT]
lemma is_len_cong_is_len:
  assumes "TarskiLen A B l" and
    "Cong A B C D"
  shows "TarskiLen C D l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TarskiLen C D l
[PROOF STEP]
using TarskiLen_def assms(1) assms(2) lg_cong_lg
[PROOF STATE]
proof (prove)
using this:
TarskiLen ?A ?B ?l \<equiv> QCong ?l \<and> ?l ?A ?B
TarskiLen A B l
Cong A B C D
\<lbrakk>QCong ?l; ?l ?A ?B; Cong ?A ?B ?C ?D\<rbrakk> \<Longrightarrow> ?l ?C ?D

goal (1 subgoal):
 1. TarskiLen C D l
[PROOF STEP]
by fastforce


[STATEMENT]
lemma card_ge_2_imp_ne: "CARD('a) \<ge> 2 \<Longrightarrow> \<exists>(x::'a::finite) y::'a. x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> CARD('a) \<Longrightarrow> \<exists>x y. x \<noteq> y
[PROOF STEP]
by (meson card_2_iff' ex_card)


[STATEMENT]
theorem language_ranking_iff:
    assumes "finite (nodes A)"
    shows "w \<notin> language A \<longleftrightarrow> (\<exists> f. ranking A w f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<notin> language A) = (\<exists>f. ranking A w f)
[PROOF STEP]
using ranking_language language_ranking assms
[PROOF STATE]
proof (prove)
using this:
ranking ?A ?w ?f \<Longrightarrow> ?w \<notin> language ?A
\<lbrakk>finite (nodes ?A); ?w \<notin> language ?A\<rbrakk> \<Longrightarrow> ranking ?A ?w (rank ?A ?w)
finite (nodes A)

goal (1 subgoal):
 1. (w \<notin> language A) = (\<exists>f. ranking A w f)
[PROOF STEP]
by blast


[STATEMENT]
lemma path_connected_space_subconnected:
     "path_connected_space X \<longleftrightarrow>
      (\<forall>x \<in> topspace X. \<forall>y \<in> topspace X. \<exists>S. path_connectedin X S \<and> x \<in> S \<and> y \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected_space X = (\<forall>x\<in>topspace X. \<forall>y\<in>topspace X. \<exists>S. path_connectedin X S \<and> x \<in> S \<and> y \<in> S)
[PROOF STEP]
by (metis path_connectedin path_connectedin_topspace path_connected_space_def)


[STATEMENT]
lemma sqrt_lower_bound_2_small:
  assumes "0 \<le> x"
    shows "32*x*(16*x + 1)*(256*x^2 + 96*x + 1) / (65536*x^4 + 114688*x^3 + 17920*x^2 + 448*x + 1) \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 32 * x * (16 * x + 1) * (256 * x\<^sup>2 + 96 * x + 1) / (65536 * x ^ 4 + 114688 * x ^ 3 + 17920 * x\<^sup>2 + 448 * x + 1) \<le> sqrt x
[PROOF STEP]
apply (rule order_trans [OF eq_refl gen_sqrt_lower_scaled [of x 4 2]])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 32 * x * (16 * x + 1) * (256 * x\<^sup>2 + 96 * x + 1) / (65536 * x ^ 4 + 114688 * x ^ 3 + 17920 * x\<^sup>2 + 448 * x + 1) = sqrtl (x * 4\<^sup>2) 2 / 4
 2. 0 \<le> x
 3. 0 < 4
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (3 subgoals):
 1. 32 * x * (16 * x + 1) * (256 * x\<^sup>2 + 96 * x + 1) / (65536 * x ^ 4 + 114688 * x ^ 3 + 17920 * x\<^sup>2 + 448 * x + 1) = sqrtl (x * 4\<^sup>2) 2 / 4
 2. 0 \<le> x
 3. 0 < 4
[PROOF STEP]
apply (auto simp: sqrtl_2_eq )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> 32 * x * (16 * x + 1) * (256 * x\<^sup>2 + 96 * x + 1) / (65536 * x ^ 4 + 114688 * x ^ 3 + 17920 * x\<^sup>2 + 448 * x + 1) = 128 * x * (x * 16 + 1) * (x\<^sup>2 * 256 + 96 * x + 1) / (262144 * x ^ 4 + 458752 * x ^ 3 + 71680 * x\<^sup>2 + 1792 * x + 4)
[PROOF STEP]
apply (simp add: divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> 262144 * x ^ 4 + 458752 * x ^ 3 + 71680 * x\<^sup>2 + 1792 * x + 4 \<noteq> 0 \<longrightarrow> x = 0 \<or> (16 * x + 1) * ((256 * x\<^sup>2 + 96 * x + 1) * (262144 * x ^ 4 + 458752 * x ^ 3 + 71680 * x\<^sup>2 + 1792 * x + 4)) = 4 * ((x * 16 + 1) * ((x\<^sup>2 * 256 + 96 * x + 1) * (65536 * x ^ 4 + 114688 * x ^ 3 + 17920 * x\<^sup>2 + 448 * x + 1)))
[PROOF STEP]
apply algebra
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Sup_le_iff: "small A \<Longrightarrow> Sup A \<le> a \<longleftrightarrow> (\<forall>x\<in>A. x \<le> a)" for A::"V set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small A \<Longrightarrow> (\<Squnion> A \<le> a) = (\<forall>x\<in>A. x \<le> a)
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_of_cblinfun_zero:
  "mat_of_cblinfun (0 :: ('a::{basis_enum,complex_normed_vector}  \<Rightarrow>\<^sub>C\<^sub>L 'b::{basis_enum,complex_normed_vector}))
  = 0\<^sub>m (length (canonical_basis :: 'b list)) (length (canonical_basis :: 'a list))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun 0 = 0\<^sub>m (length canonical_basis) (length canonical_basis)
[PROOF STEP]
unfolding mat_of_cblinfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length canonical_basis) (length canonical_basis) (\<lambda>(i, j). crepresentation (set canonical_basis) (0 *\<^sub>V canonical_basis ! j) (canonical_basis ! i)) = 0\<^sub>m (length canonical_basis) (length canonical_basis)
[PROOF STEP]
by (auto simp: complex_vector.representation_zero)


[STATEMENT]
lemma derivativeReflexive:
  fixes P   :: pi
  and   a   :: subject
  and   x   :: name
  and   Rel :: "(pi \<times> pi) set"

  assumes "Id \<subseteq> Rel"

  shows "derivative P P a x Rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derivative P P a x Rel
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Id \<subseteq> Rel

goal (1 subgoal):
 1. derivative P P a x Rel
[PROOF STEP]
apply(cases a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1. \<lbrakk>Id \<subseteq> Rel; a = InputS x1\<rbrakk> \<Longrightarrow> derivative P P a x Rel
 2. \<And>x2. \<lbrakk>Id \<subseteq> Rel; a = BoundOutputS x2\<rbrakk> \<Longrightarrow> derivative P P a x Rel
[PROOF STEP]
by(auto simp add: derivative_def)


[STATEMENT]
lemma config_config:
  "set (fst (config A init qs)) = set init
        \<and> distinct (fst (config A init qs)) = distinct init
        \<and> length (fst (config A init qs)) = length init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (fst (config A init qs)) = set init \<and> distinct (fst (config A init qs)) = distinct init \<and> length (fst (config A init qs)) = length init
[PROOF STEP]
using config_config_distinct config_config_set config_config_length
[PROOF STATE]
proof (prove)
using this:
distinct (fst (config ?A ?init ?qs)) = distinct ?init
set (fst (config ?A ?init ?qs)) = set ?init
length (fst (config ?A ?init ?qs)) = length ?init

goal (1 subgoal):
 1. set (fst (config A init qs)) = set init \<and> distinct (fst (config A init qs)) = distinct init \<and> length (fst (config A init qs)) = length init
[PROOF STEP]
by metis