[STATEMENT]
lemma MVT0_within:
  fixes f ::"real \<Rightarrow> real"
    and f'::"real \<Rightarrow> real \<Rightarrow> real"
    and s t :: real
  assumes f':"\<And>x. x \<in> {0..t} \<Longrightarrow> (f has_derivative (f' x)) (at x  within {0..t})"
  assumes geq':"\<And>x. x \<in> {0..t} \<Longrightarrow> f' x s \<ge> 0"
  assumes int_s:"s > 0 \<and> s \<le> t"
  assumes t: "0 < t"
  shows "f s \<ge> f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<le> f s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f 0 \<le> f s
[PROOF STEP]
have "f 0 + 0 \<le> f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 + 0 \<le> f s
[PROOF STEP]
apply (rule Lib.MVT_ivl'[OF f', of 0 s 0])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> {0..t} \<Longrightarrow> x \<in> {0..t}
 2. \<And>x. x \<in> {0..t} \<Longrightarrow> 0 \<le> f' x (s - 0)
 3. \<And>x. x \<in> {0..1} \<Longrightarrow> 0 + x *\<^sub>R (s - 0) \<in> {0..t}
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {0..t} \<Longrightarrow> x \<in> {0..t}
[PROOF STEP]
by assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {0..t} \<Longrightarrow> 0 \<le> f' x (s - 0)
 2. \<And>x. x \<in> {0..1} \<Longrightarrow> 0 + x *\<^sub>R (s - 0) \<in> {0..t}
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {0..t} \<Longrightarrow> 0 \<le> f' x (s - 0)
[PROOF STEP]
using geq'
[PROOF STATE]
proof (prove)
using this:
?x5 \<in> {0..t} \<Longrightarrow> 0 \<le> f' ?x5 s

goal (1 subgoal):
 1. x \<in> {0..t} \<Longrightarrow> 0 \<le> f' x (s - 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> 0 + x *\<^sub>R (s - 0) \<in> {0..t}
[PROOF STEP]
using t int_s t
[PROOF STATE]
proof (prove)
using this:
0 < t
0 < s \<and> s \<le> t
0 < t

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> 0 + x *\<^sub>R (s - 0) \<in> {0..t}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x \<le> 1; 0 < s; s \<le> t\<rbrakk> \<Longrightarrow> x * s \<le> t
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1; 0 < s; s \<le> t\<rbrakk> \<Longrightarrow> x * s \<le> t
[PROOF STEP]
by (metis int_s mult.commute mult.right_neutral order.trans mult_le_cancel_iff2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
f 0 + 0 \<le> f s

goal (1 subgoal):
 1. f 0 \<le> f s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f 0 + 0 \<le> f s
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
f 0 + 0 \<le> f s

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtermap_nhds_open_map:
  assumes cont: "isCont f a"
    and open_map: "\<And>S. open S \<Longrightarrow> open (f`S)"
  shows "filtermap f (nhds a) = nhds (f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap f (nhds a) = nhds (f a)
[PROOF STEP]
unfolding filter_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. eventually P (filtermap f (nhds a)) = eventually P (nhds (f a))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
fix P
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
assume "eventually P (filtermap f (nhds a))"
[PROOF STATE]
proof (state)
this:
eventually P (filtermap f (nhds a))

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (filtermap f (nhds a))
[PROOF STEP]
obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)"
[PROOF STATE]
proof (prove)
using this:
eventually P (filtermap f (nhds a))

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>open S; a \<in> S; \<forall>x\<in>S. P (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_filtermap eventually_nhds)
[PROOF STATE]
proof (state)
this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (2 subgoals):
 1. \<And>P. eventually P (filtermap f (nhds a)) \<Longrightarrow> eventually P (nhds (f a))
 2. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)
[PROOF STEP]
show "eventually P (nhds (f a))"
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. eventually P (nhds (f a))
[PROOF STEP]
unfolding eventually_nhds
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. P (f x)

goal (1 subgoal):
 1. \<exists>S. open S \<and> f a \<in> S \<and> Ball S P
[PROOF STEP]
by (intro exI[of _ "f`S"]) (auto intro!: open_map)
[PROOF STATE]
proof (state)
this:
eventually P (nhds (f a))

goal (1 subgoal):
 1. \<And>P. eventually P (nhds (f a)) \<Longrightarrow> eventually P (filtermap f (nhds a))
[PROOF STEP]
qed (metis filterlim_iff tendsto_at_iff_tendsto_nhds isCont_def eventually_filtermap cont)


[STATEMENT]
lemma sylow_greater_zero:
  shows "card (subgroups_of_size (p ^ a)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
obtain P where PG:"subgroup P G" and cardP:"card P = p ^ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. \<lbrakk>subgroup P G; card P = p ^ a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis sylow_thm)
[PROOF STATE]
proof (state)
this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
hence "P \<in> subgroups_of_size (p ^ a)"
[PROOF STATE]
proof (prove)
using this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
unfolding subgroups_of_size_def
[PROOF STATE]
proof (prove)
using this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. P \<in> {H. subgroup H G \<and> card H = p ^ a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
hence "subgroups_of_size (p ^ a) \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. subgroups_of_size (p ^ a) \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subgroups_of_size (p ^ a) \<noteq> {}

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
subgroups_of_size (p ^ a) \<noteq> {}

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
from finite_G
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
[PROOF STEP]
have "finite (subgroups_of_size (p ^ a))"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)

goal (1 subgoal):
 1. finite (subgroups_of_size (p ^ a))
[PROOF STEP]
unfolding subgroups_of_size_def subgroup_def
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)

goal (1 subgoal):
 1. finite {H. ((H \<subseteq> carrier G \<and> (\<forall>x y. x \<in> H \<longrightarrow> y \<in> H \<longrightarrow> x \<otimes> y \<in> H)) \<and> \<one> \<in> H \<and> (\<forall>x. x \<in> H \<longrightarrow> inv x \<in> H)) \<and> card H = p ^ a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (subgroups_of_size (p ^ a))

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
subgroups_of_size (p ^ a) \<noteq> {}
finite (subgroups_of_size (p ^ a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subgroups_of_size (p ^ a) \<noteq> {}
finite (subgroups_of_size (p ^ a))

goal (1 subgoal):
 1. 0 < card (subgroups_of_size (p ^ a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < card (subgroups_of_size (p ^ a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_set_greaterThanLessThan:
  assumes "Suc i < j"
    shows "sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}
[PROOF STEP]
have "{i<..<j} = insert (Suc i) {Suc i<..<j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i<..<j} = insert (Suc i) {Suc i<..<j}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc i < j

goal (1 subgoal):
 1. {i<..<j} = insert (Suc i) {Suc i<..<j}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i<..<j} = insert (Suc i) {Suc i<..<j}

goal (1 subgoal):
 1. sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i<..<j} = insert (Suc i) {Suc i<..<j}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{i<..<j} = insert (Suc i) {Suc i<..<j}

goal (1 subgoal):
 1. sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}
[PROOF STEP]
by (metis assms atLeastSucLessThan_greaterThanLessThan sorted_list_of_set_range upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set {i<..<j} = Suc i # sorted_list_of_set {Suc i<..<j}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partitions_imp_finite_elements:
  assumes "p partitions n"
  shows "finite {i. 0 < p i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. 0 < p i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {i. 0 < p i}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p partitions n
[PROOF STEP]
have "{i. 0 < p i} \<subseteq> {..n}"
[PROOF STATE]
proof (prove)
using this:
p partitions n

goal (1 subgoal):
 1. {i. 0 < p i} \<subseteq> {..n}
[PROOF STEP]
by (auto elim: partitionsE)
[PROOF STATE]
proof (state)
this:
{i. 0 < p i} \<subseteq> {..n}

goal (1 subgoal):
 1. finite {i. 0 < p i}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
{i. 0 < p i} \<subseteq> {..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{i. 0 < p i} \<subseteq> {..n}

goal (1 subgoal):
 1. finite {i. 0 < p i}
[PROOF STEP]
using rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
{i. 0 < p i} \<subseteq> {..n}
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite {i. 0 < p i}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {i. 0 < p i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_dist_comp:
  assumes "bounded (f ` S)" "bounded (g ` S)"
  shows "bounded ((\<lambda>x. dist (f x) (g x)) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((\<lambda>x. dist (f x) (g x)) ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded ((\<lambda>x. dist (f x) (g x)) ` S)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
bounded (f ` S)
bounded (g ` S)
[PROOF STEP]
obtain M1 M2 where *: "dist (f x) undefined \<le> M1" "dist undefined (g x) \<le> M2" if "x \<in> S" for x
[PROOF STATE]
proof (prove)
using this:
bounded (f ` S)
bounded (g ` S)

goal (1 subgoal):
 1. (\<And>M1 M2. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> dist (f x) undefined \<le> M1; \<And>x. x \<in> S \<Longrightarrow> dist undefined (g x) \<le> M2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: bounded_any_center[of _ undefined] dist_commute)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> dist (f ?x) undefined \<le> M1
?x \<in> S \<Longrightarrow> dist undefined (g ?x) \<le> M2

goal (1 subgoal):
 1. bounded ((\<lambda>x. dist (f x) (g x)) ` S)
[PROOF STEP]
have "dist (f x) (g x) \<le> M1 + M2" if "x \<in> S" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f x) (g x) \<le> M1 + M2
[PROOF STEP]
using *[OF that]
[PROOF STATE]
proof (prove)
using this:
dist (f x) undefined \<le> M1
dist undefined (g x) \<le> M2

goal (1 subgoal):
 1. dist (f x) (g x) \<le> M1 + M2
[PROOF STEP]
by metric
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> dist (f ?x) (g ?x) \<le> M1 + M2

goal (1 subgoal):
 1. bounded ((\<lambda>x. dist (f x) (g x)) ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> dist (f ?x) (g ?x) \<le> M1 + M2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> dist (f ?x) (g ?x) \<le> M1 + M2

goal (1 subgoal):
 1. bounded ((\<lambda>x. dist (f x) (g x)) ` S)
[PROOF STEP]
by (auto intro!: boundedI)
[PROOF STATE]
proof (state)
this:
bounded ((\<lambda>x. dist (f x) (g x)) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> (a \<le> - (b / c)) = (a * c \<le> - b)
[PROOF STEP]
unfolding minus_divide_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < c \<Longrightarrow> (a \<le> - b / c) = (a * c \<le> - b)
[PROOF STEP]
by (rule pos_le_divide_eq)


[STATEMENT]
lemma countable_infinite_ex_bij: "\<exists>f::('a::{countable,infinite}\<Rightarrow>'b::{countable,infinite}). bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
have "infinite (range (to_nat::'a \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (range to_nat)
[PROOF STEP]
using finite_imageD infinite_UNIV
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (?f ` ?A); inj_on ?f ?A\<rbrakk> \<Longrightarrow> finite ?A
infinite UNIV

goal (1 subgoal):
 1. infinite (range to_nat)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
infinite (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
infinite (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
have "infinite (range (to_nat::'b \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (range to_nat)
[PROOF STEP]
using finite_imageD infinite_UNIV
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (?f ` ?A); inj_on ?f ?A\<rbrakk> \<Longrightarrow> finite ?A
infinite UNIV

goal (1 subgoal):
 1. infinite (range to_nat)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
infinite (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
infinite (range to_nat)
infinite (range to_nat)
[PROOF STEP]
have "\<exists>f. bij_betw f (range (to_nat::'a \<Rightarrow> nat)) (range (to_nat::'b \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
using this:
infinite (range to_nat)
infinite (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij_betw f (range to_nat) (range to_nat)
[PROOF STEP]
by (meson bij_betw_inv bij_betw_trans bij_enumerate)
[PROOF STATE]
proof (state)
this:
\<exists>f. bij_betw f (range to_nat) (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. bij_betw f (range to_nat) (range to_nat)
[PROOF STEP]
obtain f where f_def: "bij_betw f (range (to_nat::'a \<Rightarrow> nat)) (range (to_nat::'b \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. bij_betw f (range to_nat) (range to_nat)

goal (1 subgoal):
 1. (\<And>f. bij_betw f (range to_nat) (range to_nat) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
bij_betw f (range to_nat) (range to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw f (range to_nat) (range to_nat)
[PROOF STEP]
have f_range_trans: "f ` (range (to_nat::'a \<Rightarrow> nat)) = range (to_nat::'b \<Rightarrow> nat)"
[PROOF STATE]
proof (prove)
using this:
bij_betw f (range to_nat) (range to_nat)

goal (1 subgoal):
 1. f ` range to_nat = range to_nat
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on f (range to_nat) \<and> f ` range to_nat = range to_nat

goal (1 subgoal):
 1. f ` range to_nat = range to_nat
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f ` range to_nat = range to_nat

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
have "surj ((from_nat::nat \<Rightarrow> 'b) \<circ> f \<circ> (to_nat::'a \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj (from_nat \<circ> f \<circ> to_nat)
[PROOF STEP]
proof (rule surjI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
obtain b where [simp]: "to_nat (a::'b) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. to_nat a = b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
to_nat a = b

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
hence "b \<in> range (to_nat::'b \<Rightarrow> nat)"
[PROOF STATE]
proof (prove)
using this:
to_nat a = b

goal (1 subgoal):
 1. b \<in> range to_nat
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> range to_nat

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
with f_range_trans
[PROOF STATE]
proof (chain)
picking this:
f ` range to_nat = range to_nat
b \<in> range to_nat
[PROOF STEP]
have "b \<in> f ` (range (to_nat::'a \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
using this:
f ` range to_nat = range to_nat
b \<in> range to_nat

goal (1 subgoal):
 1. b \<in> f ` range to_nat
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b \<in> f ` range to_nat

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
from imageE [OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. \<lbrakk>b = f x; x \<in> range to_nat\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain c where [simp]:"f c = b" and "c \<in> range (to_nat::'a \<Rightarrow> nat)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x. \<lbrakk>b = f x; x \<in> range to_nat\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>f c = b; c \<in> range to_nat\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f c = b
c \<in> range to_nat

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
with f_def
[PROOF STATE]
proof (chain)
picking this:
bij_betw f (range to_nat) (range to_nat)
f c = b
c \<in> range to_nat
[PROOF STEP]
have [simp]: "inv_into (range (to_nat::'a \<Rightarrow> nat)) f b = c"
[PROOF STATE]
proof (prove)
using this:
bij_betw f (range to_nat) (range to_nat)
f c = b
c \<in> range to_nat

goal (1 subgoal):
 1. inv_into (range to_nat) f b = c
[PROOF STEP]
by (meson bij_betw_def inv_into_f_f)
[PROOF STATE]
proof (state)
this:
inv_into (range to_nat) f b = c

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv_into (range to_nat) f b = c
[PROOF STEP]
obtain d where cd: "from_nat c = (d::'a)"
[PROOF STATE]
proof (prove)
using this:
inv_into (range to_nat) f b = c

goal (1 subgoal):
 1. (\<And>d. from_nat c = d \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
from_nat c = d

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
with \<open>c \<in> range to_nat\<close>
[PROOF STATE]
proof (chain)
picking this:
c \<in> range to_nat
from_nat c = d
[PROOF STEP]
have [simp]:"to_nat d = c"
[PROOF STATE]
proof (prove)
using this:
c \<in> range to_nat
from_nat c = d

goal (1 subgoal):
 1. to_nat d = c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
to_nat d = c

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
from \<open>to_nat a = b\<close>
[PROOF STATE]
proof (chain)
picking this:
to_nat a = b
[PROOF STEP]
have [simp]: "from_nat b = a"
[PROOF STATE]
proof (prove)
using this:
to_nat a = b

goal (1 subgoal):
 1. from_nat b = a
[PROOF STEP]
using from_nat_to_nat
[PROOF STATE]
proof (prove)
using this:
to_nat a = b
from_nat (to_nat ?x) = ?x

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

goal (1 subgoal):
 1. \<And>x. (from_nat \<circ> f \<circ> to_nat) (?f x) = x
[PROOF STEP]
show "(from_nat \<circ> f \<circ> to_nat) (((from_nat::nat \<Rightarrow> 'a) \<circ> inv_into (range (to_nat::'a \<Rightarrow> nat)) f \<circ> (to_nat::'b \<Rightarrow> nat)) a) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (from_nat \<circ> f \<circ> to_nat) ((from_nat \<circ> inv_into (range to_nat) f \<circ> to_nat) a) = a
[PROOF STEP]
by (clarsimp simp: cd)
[PROOF STATE]
proof (state)
this:
(from_nat \<circ> f \<circ> to_nat) ((from_nat \<circ> inv_into (range to_nat) f \<circ> to_nat) a) = a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
surj (from_nat \<circ> f \<circ> to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
surj (from_nat \<circ> f \<circ> to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
have "inj ((from_nat::nat \<Rightarrow> 'b) \<circ> f \<circ> (to_nat::'a \<Rightarrow> nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (from_nat \<circ> f \<circ> to_nat)
[PROOF STEP]
apply (rule injI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (from_nat \<circ> f \<circ> to_nat) x = (from_nat \<circ> f \<circ> to_nat) y \<Longrightarrow> x = y
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. from_nat (f (to_nat x)) = from_nat (f (to_nat y)) \<Longrightarrow> x = y
[PROOF STEP]
apply (metis bij_betw_inv_into_left f_def f_inv_into_f f_range_trans from_nat_def image_eqI rangeI to_nat_split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
inj (from_nat \<circ> f \<circ> to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
surj (from_nat \<circ> f \<circ> to_nat)
inj (from_nat \<circ> f \<circ> to_nat)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
surj (from_nat \<circ> f \<circ> to_nat)
inj (from_nat \<circ> f \<circ> to_nat)

goal (1 subgoal):
 1. \<exists>f. bij f
[PROOF STEP]
by (blast intro: bijI)
[PROOF STATE]
proof (state)
this:
\<exists>f. bij f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma turan_sum_eq :
  fixes n p :: nat
  assumes "p \<ge> 2" and "p \<le> n"
  shows "(p-1) * (p-2) / 2 + (1 - 1 / (p-1)) * (n - p + 1) ^ 2 / 2 + (p - 2) * (n - p + 1) = (1 - 1 / (p-1)) * n^2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "a * (a-1) / 2 + (1 - 1 / a) * (n - a) ^ 2 / 2 + (a - 1) * (n - a)  = (1 - 1 / a) * n^2 / 2"
    if a1: "a \<ge> 1" and a2: "n \<ge> a"
    for a :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
have "a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2
[PROOF STEP]
using a2
[PROOF STATE]
proof (prove)
using this:
a \<le> n

goal (1 subgoal):
 1. a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2
[PROOF STEP]
apply (simp flip: Groups.ab_semigroup_mult_class.mult.commute [of 2 "a * (n - a)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> n \<Longrightarrow> a\<^sup>2 + (n - a)\<^sup>2 + 2 * (a * (n - a)) = n\<^sup>2
[PROOF STEP]
apply (simp add: Semiring_Normalization.comm_semiring_1_class.semiring_normalization_rules(18) [of 2 a "(n - a)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> n \<Longrightarrow> a\<^sup>2 + (n - a)\<^sup>2 + 2 * a * (n - a) = n\<^sup>2
[PROOF STEP]
by (simp flip: Power.comm_semiring_1_class.power2_sum [of a "n-a"])
[PROOF STATE]
proof (state)
this:
a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2
[PROOF STEP]
have "((a - 1) / a) * (a ^ 2 + (n - a) ^ 2 + a * (n - a) * 2) = ((a - 1) / a) * n^2"
[PROOF STATE]
proof (prove)
using this:
a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2 = n\<^sup>2

goal (1 subgoal):
 1. real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
have "(((a - 1) / a) * a ^ 2 + ((a - 1) / a) * (n - a) ^ 2 + ((a - 1) / a) * a * (n - a) * 2) = ..."
[PROOF STATE]
proof (prove)
using this:
real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
using Rings.semiring_class.distrib_left [of "(a - 1) / a" "a\<^sup>2 + (n - a)\<^sup>2" "a * (n - a) * 2"]
[PROOF STATE]
proof (prove)
using this:
real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
real (a - 1) / real a * (real (a\<^sup>2 + (n - a)\<^sup>2) + real (a * (n - a) * 2)) = real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2) + real (a - 1) / real a * real (a * (n - a) * 2)

goal (1 subgoal):
 1. real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
using Rings.semiring_class.distrib_left [of "(a - 1) / a" "a\<^sup>2" "(n - a)\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2 + a * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
real (a - 1) / real a * (real (a\<^sup>2 + (n - a)\<^sup>2) + real (a * (n - a) * 2)) = real (a - 1) / real a * real (a\<^sup>2 + (n - a)\<^sup>2) + real (a - 1) / real a * real (a * (n - a) * 2)
real (a - 1) / real a * (real (a\<^sup>2) + real ((n - a)\<^sup>2)) = real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2)

goal (1 subgoal):
 1. real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
have "((a - 1) / a) * a ^ 2 = a * (a-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a - 1) / real a * real (a\<^sup>2) = real (a * (a - 1))
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
real (a - 1) / real a * real (a\<^sup>2) = real (a * (a - 1))

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
real (a - 1) / real a * real (a\<^sup>2) = real (a * (a - 1))
[PROOF STEP]
have "a * (a-1) + ((a - 1) / a) * (n - a) ^ 2 + (a - 1) * (n - a) * 2  = ((a - 1) / a) * n^2"
[PROOF STATE]
proof (prove)
using this:
real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
real (a - 1) / real a * real (a\<^sup>2) = real (a * (a - 1))

goal (1 subgoal):
 1. real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
using a1 a2
[PROOF STATE]
proof (prove)
using this:
real (a - 1) / real a * real (a\<^sup>2) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real (a - 1) / real a * real a * real (n - a) * 2 = real (a - 1) / real a * real (n\<^sup>2)
real (a - 1) / real a * real (a\<^sup>2) = real (a * (a - 1))
1 \<le> a
a \<le> n

goal (1 subgoal):
 1. real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
have "1 - 1 / a = (a - 1) / a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - 1 / real a = real (a - 1) / real a
[PROOF STEP]
by (smt (verit, del_insts) One_nat_def Suc_pred diff_divide_distrib diff_is_0_eq of_nat_1 of_nat_diff of_nat_le_0_iff of_nat_le_iff of_nat_less_iff right_inverse_eq that)
[PROOF STATE]
proof (state)
this:
1 - 1 / real a = real (a - 1) / real a

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
1 - 1 / real a = real (a - 1) / real a
[PROOF STEP]
have "a * (a-1) + (1 - 1 / a) * (n - a) ^ 2 + (a - 1) * (n - a) * 2  = (1 - 1 / a) * n^2"
[PROOF STATE]
proof (prove)
using this:
real (a * (a - 1)) + real (a - 1) / real a * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = real (a - 1) / real a * real (n\<^sup>2)
1 - 1 / real a = real (a - 1) / real a

goal (1 subgoal):
 1. real (a * (a - 1)) + (1 - 1 / real a) * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = (1 - 1 / real a) * real (n\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (a * (a - 1)) + (1 - 1 / real a) * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = (1 - 1 / real a) * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (a * (a - 1)) + (1 - 1 / real a) * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = (1 - 1 / real a) * real (n\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (a * (a - 1)) + (1 - 1 / real a) * real ((n - a)\<^sup>2) + real ((a - 1) * (n - a) * 2) = (1 - 1 / real a) * real (n\<^sup>2)

goal (1 subgoal):
 1. real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (a * (a - 1)) / 2 + (1 - 1 / real a) * real ((n - a)\<^sup>2) / 2 + real ((a - 1) * (n - a)) = (1 - 1 / real a) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?a; ?a \<le> n\<rbrakk> \<Longrightarrow> real (?a * (?a - 1)) / 2 + (1 - 1 / real ?a) * real ((n - ?a)\<^sup>2) / 2 + real ((?a - 1) * (n - ?a)) = (1 - 1 / real ?a) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?a; ?a \<le> n\<rbrakk> \<Longrightarrow> real (?a * (?a - 1)) / 2 + (1 - 1 / real ?a) * real ((n - ?a)\<^sup>2) / 2 + real ((?a - 1) * (n - ?a)) = (1 - 1 / real ?a) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "p - 1 \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> p - 1
[PROOF STEP]
using \<open>p \<ge> 2\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> p

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

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 \<le> p - 1

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "n \<ge> p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p - 1 \<le> n
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
p \<le> n

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

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>1 \<le> ?a; ?a \<le> n\<rbrakk> \<Longrightarrow> real (?a * (?a - 1)) / 2 + (1 - 1 / real ?a) * real ((n - ?a)\<^sup>2) / 2 + real ((?a - 1) * (n - ?a)) = (1 - 1 / real ?a) * real (n\<^sup>2) / 2
1 \<le> p - 1
p - 1 \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> ?a; ?a \<le> n\<rbrakk> \<Longrightarrow> real (?a * (?a - 1)) / 2 + (1 - 1 / real ?a) * real ((n - ?a)\<^sup>2) / 2 + real ((?a - 1) * (n - ?a)) = (1 - 1 / real ?a) * real (n\<^sup>2) / 2
1 \<le> p - 1
p - 1 \<le> n

goal (1 subgoal):
 1. real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by (smt (verit) assms Nat.add_diff_assoc2 Nat.diff_diff_right diff_diff_left le_eq_less_or_eq less_Suc_eq_le linorder_not_less nat_1_add_1 plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma space_lebesgue_on [simp]: "space (lebesgue_on S) = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (lebesgue_on S) = S
[PROOF STEP]
by (simp add: space_restrict_space)


[STATEMENT]
lemma le_Real:
  assumes "cauchy X" "cauchy Y"
  shows "Real X \<le> Real Y = (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. X n \<le> Y n + r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Real X \<le> Real Y) = (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. X n \<le> Y n + r)
[PROOF STEP]
unfolding not_less [symmetric, where 'a=real] less_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> positive (Real X - Real Y)) = (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. X n \<le> Y n + r)
[PROOF STEP]
apply (simp add: diff_Real not_positive_Real assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. X n - Y n \<le> r) = (\<forall>r>0. \<exists>k. \<forall>n\<ge>k. X n \<le> Y n + r)
[PROOF STEP]
apply (simp add: diff_le_eq ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_of_countable_sets_range:
fixes A :: "'a set"
shows "|{X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}| \<le>o |{f::nat \<Rightarrow> 'a. range f \<subseteq> A}|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |{X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}| \<le>o |{f. range f \<subseteq> A}|
[PROOF STEP]
apply(rule card_of_ordLeqI[of from_nat_into])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on from_nat_into {X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}
 2. \<And>a. a \<in> {X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}} \<Longrightarrow> from_nat_into a \<in> {f. range f \<subseteq> A}
[PROOF STEP]
using inj_on_from_nat_into
[PROOF STATE]
proof (prove)
using this:
inj_on from_nat_into {A. A \<noteq> {} \<and> countable A}

goal (2 subgoals):
 1. inj_on from_nat_into {X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}
 2. \<And>a. a \<in> {X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}} \<Longrightarrow> from_nat_into a \<in> {f. range f \<subseteq> A}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{A. A \<noteq> {} \<and> countable A}. \<forall>y\<in>{A. A \<noteq> {} \<and> countable A}. from_nat_into x = from_nat_into y \<longrightarrow> x = y

goal (2 subgoals):
 1. \<forall>x\<in>{X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}. \<forall>y\<in>{X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}}. from_nat_into x = from_nat_into y \<longrightarrow> x = y
 2. \<And>a. a \<in> {X. X \<subseteq> A \<and> countable X \<and> X \<noteq> {}} \<Longrightarrow> from_nat_into a \<in> {f. range f \<subseteq> A}
[PROOF STEP]
by auto


[STATEMENT]
lemma floor_divide_lower:
  fixes q :: "'a::floor_ceiling"
  shows "q > 0 \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p
[PROOF STEP]
using of_int_floor_le pos_le_divide_eq
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>?x\<rfloor> \<le> ?x
(0::?'a) < ?c \<Longrightarrow> (?a \<le> ?b / ?c) = (?a * ?c \<le> ?b)

goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p
[PROOF STEP]
by blast


[STATEMENT]
lemma rel_interior_Times:
  fixes S :: "'n::euclidean_space set"
    and T :: "'m::euclidean_space set"
  assumes "convex S"
    and "convex T"
  shows "rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
proof (cases "S = {} \<or> T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {} \<or> T = {}

goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {} \<or> T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> T = {}

goal (1 subgoal):
 1. rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S = {} \<or> T = {})

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (S = {} \<or> T = {})
[PROOF STEP]
have "S \<noteq> {}" "T \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<not> (S = {} \<or> T = {})

goal (1 subgoal):
 1. S \<noteq> {} &&& T \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<noteq> {}
T \<noteq> {}

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
T \<noteq> {}
[PROOF STEP]
have ri: "rel_interior S \<noteq> {}" "rel_interior T \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
T \<noteq> {}

goal (1 subgoal):
 1. rel_interior S \<noteq> {} &&& rel_interior T \<noteq> {}
[PROOF STEP]
using rel_interior_eq_empty assms
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
T \<noteq> {}
convex ?S \<Longrightarrow> (rel_interior ?S = {}) = (?S = {})
convex S
convex T

goal (1 subgoal):
 1. rel_interior S \<noteq> {} &&& rel_interior T \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}
[PROOF STEP]
have "fst -` rel_interior S \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. fst -` rel_interior S \<noteq> {}
[PROOF STEP]
using fst_vimage_eq_Times[of "rel_interior S"]
[PROOF STATE]
proof (prove)
using this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}
fst -` rel_interior S = rel_interior S \<times> UNIV

goal (1 subgoal):
 1. fst -` rel_interior S \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst -` rel_interior S \<noteq> {}

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst -` rel_interior S \<noteq> {}
[PROOF STEP]
have "rel_interior ((fst :: 'n * 'm \<Rightarrow> 'n) -` S) = fst -` rel_interior S"
[PROOF STATE]
proof (prove)
using this:
fst -` rel_interior S \<noteq> {}

goal (1 subgoal):
 1. rel_interior (fst -` S) = fst -` rel_interior S
[PROOF STEP]
using linear_fst \<open>convex S\<close> rel_interior_convex_linear_preimage[of fst S]
[PROOF STATE]
proof (prove)
using this:
fst -` rel_interior S \<noteq> {}
linear fst
convex S
\<lbrakk>linear fst; convex S; fst -` rel_interior S \<noteq> {}\<rbrakk> \<Longrightarrow> rel_interior (fst -` S) = fst -` rel_interior S

goal (1 subgoal):
 1. rel_interior (fst -` S) = fst -` rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (fst -` S) = fst -` rel_interior S

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_interior (fst -` S) = fst -` rel_interior S
[PROOF STEP]
have s: "rel_interior (S \<times> (UNIV :: 'm set)) = rel_interior S \<times> UNIV"
[PROOF STATE]
proof (prove)
using this:
rel_interior (fst -` S) = fst -` rel_interior S

goal (1 subgoal):
 1. rel_interior (S \<times> UNIV) = rel_interior S \<times> UNIV
[PROOF STEP]
by (simp add: fst_vimage_eq_Times)
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> UNIV) = rel_interior S \<times> UNIV

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
from ri
[PROOF STATE]
proof (chain)
picking this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}
[PROOF STEP]
have "snd -` rel_interior T \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. snd -` rel_interior T \<noteq> {}
[PROOF STEP]
using snd_vimage_eq_Times[of "rel_interior T"]
[PROOF STATE]
proof (prove)
using this:
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}
snd -` rel_interior T = UNIV \<times> rel_interior T

goal (1 subgoal):
 1. snd -` rel_interior T \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd -` rel_interior T \<noteq> {}

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
snd -` rel_interior T \<noteq> {}
[PROOF STEP]
have "rel_interior ((snd :: 'n * 'm \<Rightarrow> 'm) -` T) = snd -` rel_interior T"
[PROOF STATE]
proof (prove)
using this:
snd -` rel_interior T \<noteq> {}

goal (1 subgoal):
 1. rel_interior (snd -` T) = snd -` rel_interior T
[PROOF STEP]
using linear_snd \<open>convex T\<close> rel_interior_convex_linear_preimage[of snd T]
[PROOF STATE]
proof (prove)
using this:
snd -` rel_interior T \<noteq> {}
linear snd
convex T
\<lbrakk>linear snd; convex T; snd -` rel_interior T \<noteq> {}\<rbrakk> \<Longrightarrow> rel_interior (snd -` T) = snd -` rel_interior T

goal (1 subgoal):
 1. rel_interior (snd -` T) = snd -` rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (snd -` T) = snd -` rel_interior T

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rel_interior (snd -` T) = snd -` rel_interior T
[PROOF STEP]
have t: "rel_interior ((UNIV :: 'n set) \<times> T) = UNIV \<times> rel_interior T"
[PROOF STATE]
proof (prove)
using this:
rel_interior (snd -` T) = snd -` rel_interior T

goal (1 subgoal):
 1. rel_interior (UNIV \<times> T) = UNIV \<times> rel_interior T
[PROOF STEP]
by (simp add: snd_vimage_eq_Times)
[PROOF STATE]
proof (state)
this:
rel_interior (UNIV \<times> T) = UNIV \<times> rel_interior T

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
from s t
[PROOF STATE]
proof (chain)
picking this:
rel_interior (S \<times> UNIV) = rel_interior S \<times> UNIV
rel_interior (UNIV \<times> T) = UNIV \<times> rel_interior T
[PROOF STEP]
have *: "rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T) =
      rel_interior S \<times> rel_interior T"
[PROOF STATE]
proof (prove)
using this:
rel_interior (S \<times> UNIV) = rel_interior S \<times> UNIV
rel_interior (UNIV \<times> T) = UNIV \<times> rel_interior T

goal (1 subgoal):
 1. rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T) = rel_interior S \<times> rel_interior T

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
have "S \<times> T = S \<times> (UNIV :: 'm set) \<inter> (UNIV :: 'n set) \<times> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<times> T = S \<times> UNIV \<inter> UNIV \<times> T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<times> T = S \<times> UNIV \<inter> UNIV \<times> T

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<times> T = S \<times> UNIV \<inter> UNIV \<times> T
[PROOF STEP]
have "rel_interior (S \<times> T) = rel_interior ((S \<times> (UNIV :: 'm set)) \<inter> ((UNIV :: 'n set) \<times> T))"
[PROOF STATE]
proof (prove)
using this:
S \<times> T = S \<times> UNIV \<inter> UNIV \<times> T

goal (1 subgoal):
 1. rel_interior (S \<times> T) = rel_interior (S \<times> UNIV \<inter> UNIV \<times> T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> T) = rel_interior (S \<times> UNIV \<inter> UNIV \<times> T)

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> T) = rel_interior (S \<times> UNIV \<inter> UNIV \<times> T)

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
have "\<dots> = rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior (S \<times> UNIV \<inter> UNIV \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)
[PROOF STEP]
using * ri assms convex_Times
[PROOF STATE]
proof (prove)
using this:
rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T) = rel_interior S \<times> rel_interior T
rel_interior S \<noteq> {}
rel_interior T \<noteq> {}
convex S
convex T
\<lbrakk>convex ?s; convex ?t\<rbrakk> \<Longrightarrow> convex (?s \<times> ?t)

goal (1 subgoal):
 1. rel_interior (S \<times> UNIV \<inter> UNIV \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)
[PROOF STEP]
by (subst convex_rel_interior_inter_two) auto
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> UNIV \<inter> UNIV \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)

goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rel_interior (S \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel_interior (S \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)

goal (1 subgoal):
 1. rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
rel_interior (S \<times> T) = rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T)
rel_interior (S \<times> UNIV) \<inter> rel_interior (UNIV \<times> T) = rel_interior S \<times> rel_interior T

goal (1 subgoal):
 1. rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ns_mul_ext_mono:
  assumes "ns \<subseteq> ns'" "s \<subseteq> s'" shows "ns_mul_ext ns s \<subseteq> ns_mul_ext ns' s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ns_mul_ext ns s \<subseteq> ns_mul_ext ns' s'
[PROOF STEP]
unfolding ns_mul_ext_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse> \<subseteq> (mult2_alt_ns (ns'\<inverse>) (s'\<inverse>))\<inverse>
[PROOF STEP]
using assms mono_mult2_alt[of "ns\<inverse>" "ns'\<inverse>" "s\<inverse>" "s'\<inverse>"]
[PROOF STATE]
proof (prove)
using this:
ns \<subseteq> ns'
s \<subseteq> s'
\<lbrakk>ns\<inverse> \<subseteq> ns'\<inverse>; s\<inverse> \<subseteq> s'\<inverse>\<rbrakk> \<Longrightarrow> mult2_alt ?b (ns\<inverse>) (s\<inverse>) \<subseteq> mult2_alt ?b (ns'\<inverse>) (s'\<inverse>)

goal (1 subgoal):
 1. (mult2_alt_ns (ns\<inverse>) (s\<inverse>))\<inverse> \<subseteq> (mult2_alt_ns (ns'\<inverse>) (s'\<inverse>))\<inverse>
[PROOF STEP]
by simp


[STATEMENT]
lemma scalar_prod_left_sum_distrib:
  assumes vs: "\<And> v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n" and w: "w \<in> carrier_vec n"
  shows "sumlist vvs \<bullet> w = sum_list (map (\<lambda> v. v \<bullet> w) vvs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w)
[PROOF STEP]
using vs
[PROOF STATE]
proof (prove)
using this:
?v1 \<in> set vvs \<Longrightarrow> ?v1 \<in> carrier_vec n

goal (1 subgoal):
 1. M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w)
[PROOF STEP]
proof (induct vvs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
case (Cons v vs)
[PROOF STATE]
proof (state)
this:
(\<And>v. v \<in> set vs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vs \<bullet> w = (\<Sum>v\<leftarrow>vs. v \<bullet> w)
?v1 \<in> set (v # vs) \<Longrightarrow> ?v1 \<in> carrier_vec n

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
from Cons
[PROOF STATE]
proof (chain)
picking this:
(\<And>v. v \<in> set vs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vs \<bullet> w = (\<Sum>v\<leftarrow>vs. v \<bullet> w)
?v1 \<in> set (v # vs) \<Longrightarrow> ?v1 \<in> carrier_vec n
[PROOF STEP]
have v: "v \<in> carrier_vec n" and vs: "sumlist vs \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
(\<And>v. v \<in> set vs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vs \<bullet> w = (\<Sum>v\<leftarrow>vs. v \<bullet> w)
?v1 \<in> set (v # vs) \<Longrightarrow> ?v1 \<in> carrier_vec n

goal (1 subgoal):
 1. v \<in> carrier_vec n &&& M.sumlist vs \<in> carrier_vec n
[PROOF STEP]
by (auto intro!: sumlist_carrier)
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec n
M.sumlist vs \<in> carrier_vec n

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
have "sumlist (v # vs) \<bullet> w = sumlist ([v] @ vs) \<bullet> w "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (v # vs) \<bullet> w = M.sumlist ([v] @ vs) \<bullet> w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M.sumlist (v # vs) \<bullet> w = M.sumlist ([v] @ vs) \<bullet> w

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist (v # vs) \<bullet> w = M.sumlist ([v] @ vs) \<bullet> w

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
have "\<dots> = (v + sumlist vs) \<bullet> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist ([v] @ vs) \<bullet> w = (v + M.sumlist vs) \<bullet> w
[PROOF STEP]
by (subst sumlist_append, insert Cons v vs, auto)
[PROOF STATE]
proof (state)
this:
M.sumlist ([v] @ vs) \<bullet> w = (v + M.sumlist vs) \<bullet> w

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist ([v] @ vs) \<bullet> w = (v + M.sumlist vs) \<bullet> w

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
have "\<dots> = v \<bullet> w + (sumlist vs \<bullet> w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v + M.sumlist vs) \<bullet> w = v \<bullet> w + M.sumlist vs \<bullet> w
[PROOF STEP]
by (rule add_scalar_prod_distrib[OF v vs w])
[PROOF STATE]
proof (state)
this:
(v + M.sumlist vs) \<bullet> w = v \<bullet> w + M.sumlist vs \<bullet> w

goal (2 subgoals):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
 2. \<And>a vvs. \<lbrakk>(\<And>v. v \<in> set vvs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vvs \<bullet> w = (\<Sum>v\<leftarrow>vvs. v \<bullet> w); \<And>v. v \<in> set (a # vvs) \<Longrightarrow> v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> M.sumlist (a # vvs) \<bullet> w = (\<Sum>v\<leftarrow>a # vvs. v \<bullet> w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M.sumlist (v # vs) \<bullet> w = v \<bullet> w + M.sumlist vs \<bullet> w
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
M.sumlist (v # vs) \<bullet> w = v \<bullet> w + M.sumlist vs \<bullet> w

goal (1 subgoal):
 1. M.sumlist (v # vs) \<bullet> w = (\<Sum>v\<leftarrow>v # vs. v \<bullet> w)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
M.sumlist (v # vs) \<bullet> w = v \<bullet> w + M.sumlist vs \<bullet> w
(\<And>v. v \<in> set vs \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist vs \<bullet> w = (\<Sum>v\<leftarrow>vs. v \<bullet> w)
?v1 \<in> set (v # vs) \<Longrightarrow> ?v1 \<in> carrier_vec n

goal (1 subgoal):
 1. M.sumlist (v # vs) \<bullet> w = (\<Sum>v\<leftarrow>v # vs. v \<bullet> w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M.sumlist (v # vs) \<bullet> w = (\<Sum>v\<leftarrow>v # vs. v \<bullet> w)

goal (1 subgoal):
 1. (\<And>v. v \<in> set [] \<Longrightarrow> v \<in> carrier_vec n) \<Longrightarrow> M.sumlist [] \<bullet> w = (\<Sum>v\<leftarrow>[]. v \<bullet> w)
[PROOF STEP]
qed (insert w, auto)


[STATEMENT]
lemma compact_space_alt:
   "compact_space X \<longleftrightarrow>
        (\<forall>\<U>. (\<forall>U \<in> \<U>. openin X U) \<and> topspace X \<subseteq> \<Union>\<U>
            \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> topspace X \<subseteq> \<Union>\<F>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact_space X = (\<forall>\<U>. (\<forall>U\<in>\<U>. openin X U) \<and> topspace X \<subseteq> \<Union> \<U> \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> topspace X \<subseteq> \<Union> \<F>))
[PROOF STEP]
by (simp add: compact_space_def compactin_def)


[STATEMENT]
lemma uminus_add_mat: fixes A :: "'a :: group_add mat"
  assumes "A \<in> carrier_mat nr nc"
  and "B \<in> carrier_mat nr nc"
  shows "- (A + B) = - B + - A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (A + B) = - B + - A
[PROOF STEP]
by (intro eq_matI, insert assms, auto simp: minus_add)


[STATEMENT]
lemma power_inductl_var: "x \<cdot> y \<le> y \<Longrightarrow> x\<^bsup>n\<^esup> \<cdot> y \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> y \<le> y \<Longrightarrow> x\<^bsup>n\<^esup> \<cdot> y \<le> y
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<cdot> y \<le> y \<Longrightarrow> x\<^bsup>0\<^esup> \<cdot> y \<le> y
 2. \<And>n. \<lbrakk>x \<cdot> y \<le> y \<Longrightarrow> x\<^bsup>n\<^esup> \<cdot> y \<le> y; x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x\<^bsup>Suc n\<^esup> \<cdot> y \<le> y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>x \<cdot> y \<le> y \<Longrightarrow> x\<^bsup>n\<^esup> \<cdot> y \<le> y; x \<cdot> y \<le> y\<rbrakk> \<Longrightarrow> x\<^bsup>Suc n\<^esup> \<cdot> y \<le> y
[PROOF STEP]
by (metis (no_types, lifting) local.dual_order.trans local.mult_isol local.power_Suc2 mult_assoc)


[STATEMENT]
lemma nat_to_ce_set_lm_1: "nat_to_ce_set n = { x . \<exists> y. (nat_to_pr n) (c_pair x y) = 0 }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
have S1: "nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))
[PROOF STEP]
by (simp add: nat_to_ce_set_def)
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))

goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))
[PROOF STEP]
have S2: "nat_to_ce_set n = { x . \<exists> y. (pr_conv_1_to_2 (nat_to_pr n)) x y = 0}"
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set n = fn_to_set (pr_conv_1_to_2 (nat_to_pr n))

goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. pr_conv_1_to_2 (nat_to_pr n) x y = 0}
[PROOF STEP]
by (simp add: fn_to_set_def)
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n = {x. \<exists>y. pr_conv_1_to_2 (nat_to_pr n) x y = 0}

goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
have S3: "\<And> x y. (pr_conv_1_to_2 (nat_to_pr n)) x y = (nat_to_pr n) (c_pair x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. pr_conv_1_to_2 (nat_to_pr n) x y = nat_to_pr n (c_pair x y)
[PROOF STEP]
by (simp add: pr_conv_1_to_2_def)
[PROOF STATE]
proof (state)
this:
pr_conv_1_to_2 (nat_to_pr n) ?x ?y = nat_to_pr n (c_pair ?x ?y)

goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
from S2 S3
[PROOF STATE]
proof (chain)
picking this:
nat_to_ce_set n = {x. \<exists>y. pr_conv_1_to_2 (nat_to_pr n) x y = 0}
pr_conv_1_to_2 (nat_to_pr n) ?x ?y = nat_to_pr n (c_pair ?x ?y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_to_ce_set n = {x. \<exists>y. pr_conv_1_to_2 (nat_to_pr n) x y = 0}
pr_conv_1_to_2 (nat_to_pr n) ?x ?y = nat_to_pr n (c_pair ?x ?y)

goal (1 subgoal):
 1. nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_ce_set n = {x. \<exists>y. nat_to_pr n (c_pair x y) = 0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_match_semantics_ipset_from_netmask:
    assumes "valid_prefix pfx"
    shows "prefix_match_semantics pfx a \<longleftrightarrow>
            a \<in> ipset_from_netmask (pfxm_prefix pfx) (NOT (pfxm_mask pfx))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix_match_semantics pfx a = (a \<in> ipset_from_netmask (pfxm_prefix pfx) (~~ pfxm_mask pfx))
[PROOF STEP]
unfolding prefix_match_semantics_wordset[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> prefix_to_wordset pfx) = (a \<in> ipset_from_netmask (pfxm_prefix pfx) (~~ pfxm_mask pfx))
[PROOF STEP]
unfolding valid_prefix_ipset_from_netmask_ipset_from_cidr
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> prefix_to_wordset pfx) = (a \<in> ipset_from_cidr (pfxm_prefix pfx) (pfxm_length pfx))
[PROOF STEP]
unfolding prefix_to_wordset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || pfxm_mask pfx}) = (a \<in> ipset_from_cidr (pfxm_prefix pfx) (pfxm_length pfx))
[PROOF STEP]
apply(subst ipset_from_cidr_base_wellforemd)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0
 2. (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || pfxm_mask pfx}) = (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || mask (LENGTH('a) - pfxm_length pfx)})
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_prefix pfx

goal (1 subgoal):
 1. mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0
[PROOF STEP]
by(simp add: valid_prefix_def pfxm_mask_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || pfxm_mask pfx}) = (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || mask (LENGTH('a) - pfxm_length pfx)})
[PROOF STEP]
by(simp add: pfxm_mask_def)


[STATEMENT]
lemma eucl_truncate_down_correct:
  "dist (x::'a::executable_euclidean_space) (eucl_down e x) \<in>
    {0..sqrt (DIM('a)) * 2 powr of_int (- e)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
have "dist x (eucl_down e x) = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (eucl_down e x) = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2)
[PROOF STEP]
unfolding euclidean_dist_l2[where 'a='a] L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2) = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
dist x (eucl_down e x) = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2)

goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist x (eucl_down e x) = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2)

goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
have "\<dots> \<le> sqrt (\<Sum>i\<in>(Basis::'a set). ((2 powr of_int (- e))\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>Basis. (2 powr real_of_int (- e))\<^sup>2)
[PROOF STEP]
by (intro real_sqrt_le_mono sum_mono power_mono)
      (auto simp: dist_real_def eucl_down_def abs_round_down_le)
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (eucl_down e x \<bullet> i))\<^sup>2) \<le> sqrt (\<Sum>i\<in>Basis. (2 powr real_of_int (- e))\<^sup>2)

goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist x (eucl_down e x) \<le> sqrt (\<Sum>i\<in>Basis. (2 powr real_of_int (- e))\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist x (eucl_down e x) \<le> sqrt (\<Sum>i\<in>Basis. (2 powr real_of_int (- e))\<^sup>2)

goal (1 subgoal):
 1. dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}
[PROOF STEP]
by (simp add: real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
dist x (eucl_down e x) \<in> {0..sqrt (real DIM('a)) * 2 powr real_of_int (- e)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_lpolies_coeff_access:
  assumes "i < dim_row A" and "j < dim_col A"
  shows "coeff (matrix_to_lpolies A ! i) j = A $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abstract_Linear_Poly.coeff (matrix_to_lpolies A ! i) j = A $$ (i, j)
[PROOF STEP]
using matrix_to_lp_vec_to_lpoly_row[of i A, OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
matrix_to_lpolies A ! i = vec_to_lpoly (row A i)

goal (1 subgoal):
 1. Abstract_Linear_Poly.coeff (matrix_to_lpolies A ! i) j = A $$ (i, j)
[PROOF STEP]
by (metis assms(1) assms(2) index_row(1) index_row(2) vec_to_lin_poly_coeff_access)


[STATEMENT]
lemma card_support_1_probability_1:
  assumes "card (set_pmf p) = 1"
  shows "\<forall>e \<in> set_pmf p. pmf p e = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e\<in>set_pmf p. pmf p e = 1
[PROOF STEP]
by(auto) (metis assms card_1_singletonE card_ge_0_finite
      card_subset_eq ex_card le_numeral_extra(4) measure_measure_pmf_finite
      pmf.rep_eq singletonD sum_pmf_eq_1 zero_less_one)


[STATEMENT]
lemma singular_chain_diff:
   "\<lbrakk>singular_chain p X a; singular_chain p X b\<rbrakk> \<Longrightarrow> singular_chain p X (a-b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_chain p X a; singular_chain p X b\<rbrakk> \<Longrightarrow> singular_chain p X (a - b)
[PROOF STEP]
unfolding singular_chain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Poly_Mapping.keys a \<subseteq> singular_simplex_set p X; Poly_Mapping.keys b \<subseteq> singular_simplex_set p X\<rbrakk> \<Longrightarrow> Poly_Mapping.keys (a - b) \<subseteq> singular_simplex_set p X
[PROOF STEP]
using keys_diff [of a b]
[PROOF STATE]
proof (prove)
using this:
Poly_Mapping.keys (a - b) \<subseteq> Poly_Mapping.keys a \<union> Poly_Mapping.keys b

goal (1 subgoal):
 1. \<lbrakk>Poly_Mapping.keys a \<subseteq> singular_simplex_set p X; Poly_Mapping.keys b \<subseteq> singular_simplex_set p X\<rbrakk> \<Longrightarrow> Poly_Mapping.keys (a - b) \<subseteq> singular_simplex_set p X
[PROOF STEP]
by blast


[STATEMENT]
lemma powr_less_eq_inverse_iff':
  fixes x y z::real
  assumes "x>0" "y>0" "z>0"
  shows "z \<le> x powr y \<longleftrightarrow> z powr (inverse y) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<le> x powr y) = (z powr inverse y \<le> x)
[PROOF STEP]
by (simp add: assms powr_less_eq_inverse_iff)


[STATEMENT]
lemma transcendental_tanh:
  assumes "algebraic z" "z \<noteq> 0" "cosh z \<noteq> 0"
  shows   "\<not>algebraic (tanh z :: complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> algebraic (tanh z)
[PROOF STEP]
using transcendental_tan[of "\<i> * z"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>algebraic (\<i> * z); \<i> * z \<noteq> 0\<rbrakk> \<Longrightarrow> \<not> algebraic (tan (\<i> * z))
algebraic z
z \<noteq> 0
cosh z \<noteq> 0

goal (1 subgoal):
 1. \<not> algebraic (tanh z)
[PROOF STEP]
unfolding tanh_conv_tan
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>algebraic (\<i> * z); \<i> * z \<noteq> 0\<rbrakk> \<Longrightarrow> \<not> algebraic (tan (\<i> * z))
algebraic z
z \<noteq> 0
cosh z \<noteq> 0

goal (1 subgoal):
 1. \<not> algebraic (- \<i> * tan (\<i> * z))
[PROOF STEP]
by simp


[STATEMENT]
lemma frontier_halfspace_lt:
  assumes "a \<noteq> 0 \<or> b \<noteq> 0"
    shows "frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
 2. a \<noteq> (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = (0::'a)

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
 2. a \<noteq> (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a) \<or> b \<noteq> 0
a = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a) \<or> b \<noteq> 0
a = (0::'a)

goal (1 subgoal):
 1. frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}
[PROOF STEP]
by (force simp: frontier_def interior_open open_halfspace_lt)
[PROOF STATE]
proof (state)
this:
frontier {x. a \<bullet> x < b} = {x. a \<bullet> x = b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_field_min_order:
  "order R > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < order R
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
assume a:"\<not>(1 < order R)"
[PROOF STATE]
proof (state)
this:
\<not> 1 < order R

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
have "{\<zero>\<^bsub>R\<^esub>,\<one>\<^bsub>R\<^esub>} \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<zero>, \<one>} \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{\<zero>, \<one>} \<subseteq> carrier R

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
hence "card {\<zero>\<^bsub>R\<^esub>,\<one>\<^bsub>R\<^esub>} \<le> card (carrier R)"
[PROOF STATE]
proof (prove)
using this:
{\<zero>, \<one>} \<subseteq> carrier R

goal (1 subgoal):
 1. card {\<zero>, \<one>} \<le> card (carrier R)
[PROOF STEP]
using card_mono finite_carrier
[PROOF STATE]
proof (prove)
using this:
{\<zero>, \<one>} \<subseteq> carrier R
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
finite (carrier R)

goal (1 subgoal):
 1. card {\<zero>, \<one>} \<le> card (carrier R)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card {\<zero>, \<one>} \<le> card (carrier R)

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {\<zero>, \<one>} \<le> card (carrier R)

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
have "... \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier R) \<le> 1
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < order R

goal (1 subgoal):
 1. card (carrier R) \<le> 1
[PROOF STEP]
by (simp add:order_def)
[PROOF STATE]
proof (state)
this:
card (carrier R) \<le> 1

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {\<zero>, \<one>} \<le> 1
[PROOF STEP]
have "card {\<zero>\<^bsub>R\<^esub>,\<one>\<^bsub>R\<^esub>} \<le> 1"
[PROOF STATE]
proof (prove)
using this:
card {\<zero>, \<one>} \<le> 1

goal (1 subgoal):
 1. card {\<zero>, \<one>} \<le> 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card {\<zero>, \<one>} \<le> 1

goal (1 subgoal):
 1. \<not> 1 < order R \<Longrightarrow> False
[PROOF STEP]
thus "False"
[PROOF STATE]
proof (prove)
using this:
card {\<zero>, \<one>} \<le> 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg_of_real: "Arg (of_real x) =
  (if x < 0 then pi else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
 2. x \<noteq> 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
 2. x \<noteq> 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
hence "x < 0 \<or> x > 0"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

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

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
 2. x \<noteq> 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x < 0 \<or> 0 < x

goal (1 subgoal):
 1. Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
by (intro cis_Arg_unique, auto
      simp: complex_sgn_def scaleR_complex.ctr complex_eq_iff)
[PROOF STATE]
proof (state)
this:
Arg (cor x) = (if x < 0 then pi else 0)

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> Arg (cor x) = (if x < 0 then pi else 0)
[PROOF STEP]
qed (auto simp: Arg_def)


[STATEMENT]
lemma face_of_aff_dim_lt:
  fixes S :: "'a::euclidean_space set"
  assumes "convex S" "T face_of S" "T \<noteq> S"
    shows "aff_dim T < aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim T < aff_dim S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim T < aff_dim S
[PROOF STEP]
have "aff_dim T \<le> aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim T \<le> aff_dim S
[PROOF STEP]
by (simp add: face_of_imp_subset aff_dim_subset assms)
[PROOF STATE]
proof (state)
this:
aff_dim T \<le> aff_dim S

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

goal (1 subgoal):
 1. aff_dim T < aff_dim S
[PROOF STEP]
have "aff_dim T \<noteq> aff_dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim T \<noteq> aff_dim S
[PROOF STEP]
proof (cases "T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. T = {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
 2. T \<noteq> {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
T = {}

goal (2 subgoals):
 1. T = {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
 2. T \<noteq> {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T = {}

goal (1 subgoal):
 1. aff_dim T \<noteq> aff_dim S
[PROOF STEP]
by (metis aff_dim_empty \<open>T \<noteq> S\<close>)
[PROOF STATE]
proof (state)
this:
aff_dim T \<noteq> aff_dim S

goal (1 subgoal):
 1. T \<noteq> {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T \<noteq> {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
T \<noteq> {}

goal (1 subgoal):
 1. T \<noteq> {} \<Longrightarrow> aff_dim T \<noteq> aff_dim S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {}

goal (1 subgoal):
 1. aff_dim T \<noteq> aff_dim S
[PROOF STEP]
by (smt (verit) aff_dim_empty assms convex_rel_frontier_aff_dim face_of_imp_convex face_of_subset_rel_frontier)
[PROOF STATE]
proof (state)
this:
aff_dim T \<noteq> aff_dim S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
aff_dim T \<noteq> aff_dim S

goal (1 subgoal):
 1. aff_dim T < aff_dim S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim T \<le> aff_dim S
aff_dim T \<noteq> aff_dim S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim T \<le> aff_dim S
aff_dim T \<noteq> aff_dim S

goal (1 subgoal):
 1. aff_dim T < aff_dim S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aff_dim T < aff_dim S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma congruent_triangleI_asa:
  assumes "angle a1 b1 c1 = angle a2 b2 c2"
  assumes "dist a1 b1 = dist a2 b2"
  assumes "angle b1 a1 c1 = angle b2 a2 c2"
  assumes "\<not>collinear {a1, b1, c1}"
  shows   "congruent_triangle a1 b1 c1 a2 b2 c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. congruent_triangle a1 b1 c1 a2 b2 c2
[PROOF STEP]
proof (rule congruent_triangleI_aas)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. angle a1 b1 c1 = angle a2 b2 c2
 2. angle b1 c1 a1 = angle b2 c2 a2
 3. dist a1 b1 = dist a2 b2
 4. \<not> collinear {a1, b1, c1}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
angle a1 b1 c1 = angle a2 b2 c2
dist a1 b1 = dist a2 b2
angle b1 a1 c1 = angle b2 a2 c2
\<not> collinear {a1, b1, c1}
[PROOF STEP]
have neq: "a1 \<noteq> b1" "a2 \<noteq> b2"
[PROOF STATE]
proof (prove)
using this:
angle a1 b1 c1 = angle a2 b2 c2
dist a1 b1 = dist a2 b2
angle b1 a1 c1 = angle b2 a2 c2
\<not> collinear {a1, b1, c1}

goal (1 subgoal):
 1. a1 \<noteq> b1 &&& a2 \<noteq> b2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a1 \<noteq> b1
a2 \<noteq> b2

goal (4 subgoals):
 1. angle a1 b1 c1 = angle a2 b2 c2
 2. angle b1 c1 a1 = angle b2 c2 a2
 3. dist a1 b1 = dist a2 b2
 4. \<not> collinear {a1, b1, c1}
[PROOF STEP]
show "angle b1 c1 a1 = angle b2 c2 a2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angle b1 c1 a1 = angle b2 c2 a2
[PROOF STEP]
by (rule similar_triangle_aa) (insert assms neq, simp_all add: angle_commute)
[PROOF STATE]
proof (state)
this:
angle b1 c1 a1 = angle b2 c2 a2

goal (3 subgoals):
 1. angle a1 b1 c1 = angle a2 b2 c2
 2. dist a1 b1 = dist a2 b2
 3. \<not> collinear {a1, b1, c1}
[PROOF STEP]
qed fact+


[STATEMENT]
lemma dim_eq:
assumes fin_dim_V: "V.fin_dim"
and i: "inj_on T (carrier V)" and surj: "T` (carrier V) = carrier W"
shows "V.dim = W.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
have dim0: "vectorspace.dim K (V.vs kerT) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ker.dim = 0
[PROOF STEP]
by (rule inj_imp_dim_ker0[OF i])
[PROOF STATE]
proof (state)
this:
Ker.dim = 0

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
have imT_W: "(imT) = carrier W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imT = carrier W
[PROOF STEP]
by (rule surj_imp_imT_carrier[OF surj])
[PROOF STATE]
proof (state)
this:
imT = carrier W

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
have rnt: "vectorspace.dim K (W.vs imT) + vectorspace.dim K (V.vs kerT) = V.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. im.dim + Ker.dim = V.dim
[PROOF STEP]
by (rule rank_nullity[OF fin_dim_V])
[PROOF STATE]
proof (state)
this:
im.dim + Ker.dim = V.dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
hence "V.dim = vectorspace.dim K (W.vs imT)"
[PROOF STATE]
proof (prove)
using this:
im.dim + Ker.dim = V.dim

goal (1 subgoal):
 1. V.dim = im.dim
[PROOF STEP]
using dim0
[PROOF STATE]
proof (prove)
using this:
im.dim + Ker.dim = V.dim
Ker.dim = 0

goal (1 subgoal):
 1. V.dim = im.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V.dim = im.dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
V.dim = im.dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
have "...  = W.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. im.dim = W.dim
[PROOF STEP]
using imT_W
[PROOF STATE]
proof (prove)
using this:
imT = carrier W

goal (1 subgoal):
 1. im.dim = W.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
im.dim = W.dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
V.dim = W.dim
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
V.dim = W.dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
using fin_dim_V
[PROOF STATE]
proof (prove)
using this:
V.dim = W.dim
V.fin_dim

goal (1 subgoal):
 1. V.dim = W.dim
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V.dim = W.dim

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_add_int: "\<lfloor>x\<rfloor> + z = \<lfloor>x + of_int z\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> + z = \<lfloor>x + of_int z\<rfloor>
[PROOF STEP]
using floor_correct [of x]
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>x\<rfloor> \<le> x \<and> x < of_int (\<lfloor>x\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>x\<rfloor> + z = \<lfloor>x + of_int z\<rfloor>
[PROOF STEP]
by (simp add: floor_unique[symmetric])


[STATEMENT]
lemma integral_0_1_ln_times_powr:
  assumes "e > -1"
  shows   "(LBINT x=0..1. -ln x * x powr e) = 1 / (e + 1)\<^sup>2"
    and   "interval_lebesgue_integrable lborel 0 1 (\<lambda>x. -ln x * x powr e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2 &&& interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
define f where "f = (\<lambda>x. -ln x * x powr e)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. - ln x * x powr e)

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
define F where "F = (\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1) ^ 2)"
[PROOF STATE]
proof (state)
this:
F = (\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2)

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have 0: "isCont f x" if "x \<in> {0<..<1}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<1}

goal (1 subgoal):
 1. isCont f x
[PROOF STEP]
by (auto intro!: continuous_intros simp: f_def)
[PROOF STATE]
proof (state)
this:
?x \<in> {0<..<1} \<Longrightarrow> isCont f ?x

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have 1: "(F has_real_derivative f x) (at x)" if "x \<in> {0<..<1}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F has_real_derivative f x) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (F has_real_derivative f x) (at x)
[PROOF STEP]
show "(F has_real_derivative f x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F has_real_derivative f x) (at x)
[PROOF STEP]
unfolding F_def f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) has_real_derivative - ln x * x powr e) (at x)
[PROOF STEP]
using that assms
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<1}
- 1 < e

goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) has_real_derivative - ln x * x powr e) (at x)
[PROOF STEP]
apply (insert that assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> {0<..<1}; - 1 < e\<rbrakk> \<Longrightarrow> ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) has_real_derivative - ln x * x powr e) (at x)
[PROOF STEP]
apply (rule derivative_eq_intros refl | simp)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x \<and> x < 1; - 1 < e\<rbrakk> \<Longrightarrow> ((e + 1) * x powr e * (1 - (e + 1) * ln x) - (e + 1) * x powr (e + 1) / x) * (e + 1)\<^sup>2 / (e + 1) ^ 4 = - (ln x * x powr e)
[PROOF STEP]
apply (simp add: divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x \<and> x < 1; - 1 < e\<rbrakk> \<Longrightarrow> ((e + 1) * x powr e * (1 - (e + 1) * ln x) * x - (e + 1) * x powr (e + 1)) * (e + 1)\<^sup>2 = - (ln x * x powr e * (x * (e + 1) ^ 4))
[PROOF STEP]
apply (simp add: power2_eq_square algebra_simps powr_add power_numeral_reduce)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(F has_real_derivative f x) (at x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> {0<..<1} \<Longrightarrow> (F has_real_derivative f ?x) (at ?x)

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have 2: "AE x in lborel. ereal 0 < ereal x \<longrightarrow> ereal x < ereal 1 \<longrightarrow> 0 \<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lborel. ereal 0 < ereal x \<longrightarrow> ereal x < ereal 1 \<longrightarrow> 0 \<le> f x
[PROOF STEP]
by (intro AE_I2) (auto simp: f_def mult_nonpos_nonneg)
[PROOF STATE]
proof (state)
this:
AE x in lborel. ereal 0 < ereal x \<longrightarrow> ereal x < ereal 1 \<longrightarrow> 0 \<le> f x

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have 3: "((F \<circ> real_of_ereal) \<longlongrightarrow> 0) (at_right (ereal 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((F \<circ> real_of_ereal) \<longlongrightarrow> 0) (at_right (ereal 0))
[PROOF STEP]
unfolding ereal_tendsto_simps F_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- 1 < e

goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
((F \<circ> real_of_ereal) \<longlongrightarrow> 0) (at_right (ereal 0))

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have 4: "((F \<circ> real_of_ereal) \<longlongrightarrow> F 1) (at_left (ereal 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((F \<circ> real_of_ereal) \<longlongrightarrow> F 1) (at_left (ereal 1))
[PROOF STEP]
unfolding ereal_tendsto_simps F_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) \<longlongrightarrow> 1 powr (e + 1) * (1 - (e + 1) * ln 1) / (e + 1)\<^sup>2) (at_left 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- 1 < e

goal (1 subgoal):
 1. ((\<lambda>x. x powr (e + 1) * (1 - (e + 1) * ln x) / (e + 1)\<^sup>2) \<longlongrightarrow> 1 powr (e + 1) * (1 - (e + 1) * ln 1) / (e + 1)\<^sup>2) (at_left 1)
[PROOF STEP]
by real_asymp (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
((F \<circ> real_of_ereal) \<longlongrightarrow> F 1) (at_left (ereal 1))

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have "(LBINT x=ereal 0..ereal 1. f x) = F 1 - 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral lborel (ereal 0) (ereal 1) f = F 1 - 0
[PROOF STEP]
by (rule interval_integral_FTC_nonneg[where F = F])
       (use 0 1 2 3 4 in auto)
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integral lborel (ereal 0) (ereal 1) f = F 1 - 0

goal (2 subgoals):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
 2. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
thus "(LBINT x=0..1. -ln x * x powr e) = 1 / (e + 1)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integral lborel (ereal 0) (ereal 1) f = F 1 - 0

goal (1 subgoal):
 1. LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2
[PROOF STEP]
by (simp add: F_def zero_ereal_def one_ereal_def f_def)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. - ln x * x powr e = 1 / (e + 1)\<^sup>2

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
have "set_integrable lborel (einterval (ereal 0) (ereal 1)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval (ereal 0) (ereal 1)) f
[PROOF STEP]
by (rule interval_integral_FTC_nonneg)
       (use 0 1 2 3 4 in auto)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval (ereal 0) (ereal 1)) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel 0 1 (\<lambda>x. - ln x * x powr e)
[PROOF STEP]
thus "interval_lebesgue_integrable lborel 0 1 f"
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel (einterval (ereal 0) (ereal 1)) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel 0 1 f
[PROOF STEP]
by (simp add: interval_lebesgue_integrable_def einterval_def)
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integrable lborel 0 1 f

goal:
No subgoals!
[PROOF STEP]
qed