[STATEMENT]
lemma interleavings_Cons:
  "{zs. interleavings (x#xs) (y#ys) zs} =
    {x#zs|zs. interleavings xs (y#ys) zs} \<union> {y#zs|zs. interleavings (x#xs) ys zs}"
  (is "?S = ?expr")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {zs. interleavings (x # xs) (y # ys) zs} = {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {zs. interleavings (x # xs) (y # ys) zs} \<subseteq> {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}
 2. {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs} \<subseteq> {zs. interleavings (x # xs) (y # ys) zs}
[PROOF STEP]
show "?S \<subseteq> ?expr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {zs. interleavings (x # xs) (y # ys) zs} \<subseteq> {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
by (auto elim: interleavings.cases)
[PROOF STATE]
proof (state)
this:
{zs. interleavings (x # xs) (y # ys) zs} \<subseteq> {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs} \<subseteq> {zs. interleavings (x # xs) (y # ys) zs}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs} \<subseteq> {zs. interleavings (x # xs) (y # ys) zs}
[PROOF STEP]
show "?expr \<subseteq> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs} \<subseteq> {zs. interleavings (x # xs) (y # ys) zs}
[PROOF STEP]
by (auto intro: interleavings.intros)
[PROOF STATE]
proof (state)
this:
{x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs} \<subseteq> {zs. interleavings (x # xs) (y # ys) zs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fun_eq_on_bij_betw: "fun_eq_on f g A \<Longrightarrow> bij_betw f A B = bij_betw g A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_eq_on f g A \<Longrightarrow> bij_betw f A B = bij_betw g A B
[PROOF STEP]
using bij_betw_cong
[PROOF STATE]
proof (prove)
using this:
(\<And>a. a \<in> ?A \<Longrightarrow> ?f a = ?g a) \<Longrightarrow> bij_betw ?f ?A ?A' = bij_betw ?g ?A ?A'

goal (1 subgoal):
 1. fun_eq_on f g A \<Longrightarrow> bij_betw f A B = bij_betw g A B
[PROOF STEP]
unfolding fun_eq_on_def
[PROOF STATE]
proof (prove)
using this:
(\<And>a. a \<in> ?A \<Longrightarrow> ?f a = ?g a) \<Longrightarrow> bij_betw ?f ?A ?A' = bij_betw ?g ?A ?A'

goal (1 subgoal):
 1. \<forall>a\<in>A. f a = g a \<Longrightarrow> bij_betw f A B = bij_betw g A B
[PROOF STEP]
by fast


[STATEMENT]
lemma lhopital_at_top_at_bot:
  fixes f g :: "real \<Rightarrow> real"
  assumes f_0: "LIM x at a. f x :> at_top"
  assumes g_0: "LIM x at a. g x :> at_bot"
    and ev:
      "eventually (\<lambda>x. DERIV f x :> f' x) (at a)"
      "eventually (\<lambda>x. DERIV g x :> g' x) (at a)"
    and lim: "filterlim (\<lambda> x. (f' x / g' x)) at_bot (at a)"
  shows "filterlim (\<lambda> x. f x / g x) at_bot (at a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at a. f x / g x :> at_bot
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top (at a)
filterlim g at_bot (at a)
\<forall>\<^sub>F x in at a. (f has_real_derivative f' x) (at x)
\<forall>\<^sub>F x in at a. (g has_real_derivative g' x) (at x)
LIM x at a. f' x / g' x :> at_bot

goal (1 subgoal):
 1. LIM x at a. f x / g x :> at_bot
[PROOF STEP]
unfolding eventually_at_split filterlim_at_split
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top (at_left a) \<and> filterlim f at_top (at_right a)
filterlim g at_bot (at_left a) \<and> filterlim g at_bot (at_right a)
(\<forall>\<^sub>F x in at_left a. (f has_real_derivative f' x) (at x)) \<and> (\<forall>\<^sub>F x in at_right a. (f has_real_derivative f' x) (at x))
(\<forall>\<^sub>F x in at_left a. (g has_real_derivative g' x) (at x)) \<and> (\<forall>\<^sub>F x in at_right a. (g has_real_derivative g' x) (at x))
(LIM x at_left a. f' x / g' x :> at_bot) \<and> (LIM x at_right a. f' x / g' x :> at_bot)

goal (1 subgoal):
 1. (LIM x at_left a. f x / g x :> at_bot) \<and> (LIM x at_right a. f x / g x :> at_bot)
[PROOF STEP]
by (auto intro!: lhopital_right_at_top_at_bot[of f a g f' g']
                   lhopital_left_at_top_at_bot[of f a g f' g'])


[STATEMENT]
lemma convergent_filter_closure:
  fixes F and T (structure)
  assumes "filter F T"
  assumes converge: "F \<longlongrightarrow> x"
  and   xpoint: "x \<in> carrier"
  and   AF: "A \<in> F"
  shows "x \<in> closure A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
interpret filter F T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Topology.filter F T
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
have "x adh A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x adh A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. U \<in> nhds x \<Longrightarrow> U \<inter> A \<noteq> {}
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. U \<in> nhds x \<Longrightarrow> U \<inter> A \<noteq> {}
[PROOF STEP]
assume unhd: "u \<in> nhds x"
[PROOF STATE]
proof (state)
this:
u \<in> nhds x

goal (1 subgoal):
 1. \<And>U. U \<in> nhds x \<Longrightarrow> U \<inter> A \<noteq> {}
[PROOF STEP]
with converge
[PROOF STATE]
proof (chain)
picking this:
F \<longlongrightarrow> x
u \<in> nhds x
[PROOF STEP]
have "u \<in> F"
[PROOF STATE]
proof (prove)
using this:
F \<longlongrightarrow> x
u \<in> nhds x

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

goal (1 subgoal):
 1. \<And>U. U \<in> nhds x \<Longrightarrow> U \<inter> A \<noteq> {}
[PROOF STEP]
with AF
[PROOF STATE]
proof (chain)
picking this:
A \<in> F
u \<in> F
[PROOF STEP]
have "u \<inter> A \<in> F"
[PROOF STATE]
proof (prove)
using this:
A \<in> F
u \<in> F

goal (1 subgoal):
 1. u \<inter> A \<in> F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<inter> A \<in> F

goal (1 subgoal):
 1. \<And>U. U \<in> nhds x \<Longrightarrow> U \<inter> A \<noteq> {}
[PROOF STEP]
thus "u \<inter> A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
u \<inter> A \<in> F

goal (1 subgoal):
 1. u \<inter> A \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u \<inter> A \<noteq> {}

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

goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
with xpoint
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier
x adh A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier
x adh A

goal (1 subgoal):
 1. x \<in> closure A
[PROOF STEP]
by (rule adh_imp_closure)
[PROOF STATE]
proof (state)
this:
x \<in> closure A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma islimpt_diff_finite:
  assumes "finite (t::'a::t1_space set)"
  shows "x islimpt s - t = x islimpt s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
have iii: "s - t = s - (t \<inter> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s - t = s - t \<inter> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s - t = s - t \<inter> s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
have "(t \<inter> s) \<subseteq> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<inter> s \<subseteq> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<inter> s \<subseteq> s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
have ii:"finite (t \<inter> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (t \<inter> s)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
finite t

goal (1 subgoal):
 1. finite (t \<inter> s)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (t \<inter> s)

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
have i: "(t \<inter> s) \<union> (s - (t \<inter> s)) = ( s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<inter> s \<union> (s - t \<inter> s) = s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite t

goal (1 subgoal):
 1. t \<inter> s \<union> (s - t \<inter> s) = s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<inter> s \<union> (s - t \<inter> s) = s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<inter> s \<union> (s - t \<inter> s) = s
[PROOF STEP]
have "x islimpt s - (t \<inter> s) = x islimpt s"
[PROOF STATE]
proof (prove)
using this:
t \<inter> s \<union> (s - t \<inter> s) = s

goal (1 subgoal):
 1. x islimpt s - t \<inter> s = x islimpt s
[PROOF STEP]
using islimpt_Un_finite[OF ii,where ?t = "s - (t \<inter> s)"] i assms(1)
[PROOF STATE]
proof (prove)
using this:
t \<inter> s \<union> (s - t \<inter> s) = s
?x islimpt t \<inter> s \<union> (s - t \<inter> s) = ?x islimpt s - t \<inter> s
t \<inter> s \<union> (s - t \<inter> s) = s
finite t

goal (1 subgoal):
 1. x islimpt s - t \<inter> s = x islimpt s
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x islimpt s - t \<inter> s = x islimpt s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x islimpt s - t \<inter> s = x islimpt s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x islimpt s - t \<inter> s = x islimpt s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
using iii
[PROOF STATE]
proof (prove)
using this:
x islimpt s - t \<inter> s = x islimpt s
s - t = s - t \<inter> s

goal (1 subgoal):
 1. x islimpt s - t = x islimpt s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x islimpt s - t = x islimpt s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in valid_unSimpGraph) path_count:
  assumes k_adj:"\<And>v. v\<in>V \<Longrightarrow> card {n. adjacent v n} = k" and  "v\<in>V" and "finite V" and "k>0"
  shows "card {ps. length ps=l \<and> adj_path v ps}=k^l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {ps. length ps = l \<and> adj_path v ps} = k ^ l
[PROOF STEP]
proof (induct l rule:nat.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card {ps. length ps = 0 \<and> adj_path v ps} = k ^ 0
 2. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
case zero
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card {ps. length ps = 0 \<and> adj_path v ps} = k ^ 0
 2. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
have "{ps. length ps=0 \<and> adj_path v ps}={[]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ps. length ps = 0 \<and> adj_path v ps} = {[]}
[PROOF STEP]
using \<open>v\<in>V\<close>
[PROOF STATE]
proof (prove)
using this:
v \<in> V

goal (1 subgoal):
 1. {ps. length ps = 0 \<and> adj_path v ps} = {[]}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{ps. length ps = 0 \<and> adj_path v ps} = {[]}

goal (2 subgoals):
 1. card {ps. length ps = 0 \<and> adj_path v ps} = k ^ 0
 2. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
{ps. length ps = 0 \<and> adj_path v ps} = {[]}

goal (1 subgoal):
 1. card {ps. length ps = 0 \<and> adj_path v ps} = k ^ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {ps. length ps = 0 \<and> adj_path v ps} = k ^ 0

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
card {ps. length ps = n \<and> adj_path v ps} = k ^ n

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
obtain ext where ext: "ext=(\<lambda>ps ps'.  ps'\<noteq>[] \<and> (butlast ps'=ps) \<and> adj_path v ps')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ext. ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
have "\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
fix ps
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
assume "ps\<in>{ps. length ps = n \<and> adj_path v ps}"
[PROOF STATE]
proof (state)
this:
ps \<in> {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
hence "adj_path v ps" and "length ps = n"
[PROOF STATE]
proof (prove)
using this:
ps \<in> {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. adj_path v ps &&& length ps = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adj_path v ps
length ps = n

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
obtain qs where qs:"qs = {n. if ps=[] then adjacent v n else adjacent (last ps) n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>qs. qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
hence "card qs = k"
[PROOF STATE]
proof (prove)
using this:
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}

goal (1 subgoal):
 1. card qs = k
[PROOF STEP]
proof (cases "ps=[]")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps = []\<rbrakk> \<Longrightarrow> card qs = k
 2. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
ps = []

goal (2 subgoals):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps = []\<rbrakk> \<Longrightarrow> card qs = k
 2. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ps = []

goal (1 subgoal):
 1. card qs = k
[PROOF STEP]
using qs k_adj[OF \<open>v\<in>V\<close>]
[PROOF STATE]
proof (prove)
using this:
ps = []
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}
card {n. adjacent v n} = k

goal (1 subgoal):
 1. card qs = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card qs = k

goal (1 subgoal):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
ps \<noteq> []

goal (1 subgoal):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
have "last ps \<in> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last ps \<in> V
[PROOF STEP]
using adj_path_V
[PROOF STATE]
proof (prove)
using this:
adj_path ?v ?ps \<Longrightarrow> set ?ps \<subseteq> V

goal (1 subgoal):
 1. last ps \<in> V
[PROOF STEP]
by (metis False \<open>adj_path v ps\<close> last_in_set subsetD)
[PROOF STATE]
proof (state)
this:
last ps \<in> V

goal (1 subgoal):
 1. \<lbrakk>qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}; ps \<noteq> []\<rbrakk> \<Longrightarrow> card qs = k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
last ps \<in> V

goal (1 subgoal):
 1. card qs = k
[PROOF STEP]
using k_adj[of "last ps"] False qs
[PROOF STATE]
proof (prove)
using this:
last ps \<in> V
last ps \<in> V \<Longrightarrow> card {n. adjacent (last ps) n} = k
ps \<noteq> []
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}

goal (1 subgoal):
 1. card qs = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card qs = k

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

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
obtain app where app:"app=(\<lambda>q. ps@[q])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>app. app = (\<lambda>q. ps @ [q]) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
app = (\<lambda>q. ps @ [q])

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
have "app ` qs = {ps'. ext ps ps'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
have "\<And>xs. xs\<in> app ` qs \<Longrightarrow> xs \<in> {ps'. ext ps ps'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. xs \<in> app ` qs \<Longrightarrow> xs \<in> {ps'. ext ps ps'}
[PROOF STEP]
proof (rule,cases "ps=[]")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
ps = []

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
assume "xs\<in> app ` qs"
[PROOF STATE]
proof (state)
this:
xs \<in> app ` qs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> app ` qs
[PROOF STEP]
obtain q where "q\<in> qs" "app q=xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> app ` qs

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>q \<in> qs; app q = xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis imageE)
[PROOF STATE]
proof (state)
this:
q \<in> qs
app q = xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
hence  "adjacent v q" and "xs=ps@[q]"
[PROOF STATE]
proof (prove)
using this:
q \<in> qs
app q = xs

goal (1 subgoal):
 1. adjacent v q &&& xs = ps @ [q]
[PROOF STEP]
using qs app True
[PROOF STATE]
proof (prove)
using this:
q \<in> qs
app q = xs
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}
app = (\<lambda>q. ps @ [q])
ps = []

goal (1 subgoal):
 1. adjacent v q &&& xs = ps @ [q]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjacent v q
xs = ps @ [q]

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
hence "adj_path v xs"
[PROOF STATE]
proof (prove)
using this:
adjacent v q
xs = ps @ [q]

goal (1 subgoal):
 1. adj_path v xs
[PROOF STEP]
by (metis True adj_path.simps(1) adj_path.simps(2) adjacent_V(2) append_Nil)
[PROOF STATE]
proof (state)
this:
adj_path v xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
adj_path v xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
have "butlast xs = ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast xs = ps
[PROOF STEP]
using  \<open>xs=ps@[q]\<close>
[PROOF STATE]
proof (prove)
using this:
xs = ps @ [q]

goal (1 subgoal):
 1. butlast xs = ps
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
butlast xs = ps

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps = []\<rbrakk> \<Longrightarrow> ext ps xs
 2. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
adj_path v xs
butlast xs = ps
[PROOF STEP]
show "ext ps xs"
[PROOF STATE]
proof (prove)
using this:
adj_path v xs
butlast xs = ps

goal (1 subgoal):
 1. ext ps xs
[PROOF STEP]
using ext \<open>xs=ps@[q]\<close>
[PROOF STATE]
proof (prove)
using this:
adj_path v xs
butlast xs = ps
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')
xs = ps @ [q]

goal (1 subgoal):
 1. ext ps xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ext ps xs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
ps \<noteq> []

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
assume "xs\<in> app ` qs"
[PROOF STATE]
proof (state)
this:
xs \<in> app ` qs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> app ` qs
[PROOF STEP]
obtain q where "q\<in> qs" "app q=xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> app ` qs

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>q \<in> qs; app q = xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis imageE)
[PROOF STATE]
proof (state)
this:
q \<in> qs
app q = xs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
hence  "adjacent (last ps) q"
[PROOF STATE]
proof (prove)
using this:
q \<in> qs
app q = xs

goal (1 subgoal):
 1. adjacent (last ps) q
[PROOF STEP]
using qs app False
[PROOF STATE]
proof (prove)
using this:
q \<in> qs
app q = xs
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}
app = (\<lambda>q. ps @ [q])
ps \<noteq> []

goal (1 subgoal):
 1. adjacent (last ps) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjacent (last ps) q

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
hence "adj_path v (ps@[q])"
[PROOF STATE]
proof (prove)
using this:
adjacent (last ps) q

goal (1 subgoal):
 1. adj_path v (ps @ [q])
[PROOF STEP]
using  \<open>adj_path v ps\<close> False adj_path_app
[PROOF STATE]
proof (prove)
using this:
adjacent (last ps) q
adj_path v ps
ps \<noteq> []
\<lbrakk>adj_path ?v ?ps; ?ps \<noteq> []; adjacent (last ?ps) ?u\<rbrakk> \<Longrightarrow> adj_path ?v (?ps @ [?u])

goal (1 subgoal):
 1. adj_path v (ps @ [q])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adj_path v (ps @ [q])

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
hence "adj_path v xs"
[PROOF STATE]
proof (prove)
using this:
adj_path v (ps @ [q])

goal (1 subgoal):
 1. adj_path v xs
[PROOF STEP]
by (metis \<open>app q = xs\<close> app)
[PROOF STATE]
proof (state)
this:
adj_path v xs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
adj_path v xs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
have "butlast xs=ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast xs = ps
[PROOF STEP]
by (metis \<open>app q = xs\<close> app butlast_snoc)
[PROOF STATE]
proof (state)
this:
butlast xs = ps

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> app ` qs; ps \<noteq> []\<rbrakk> \<Longrightarrow> ext ps xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
adj_path v xs
butlast xs = ps
[PROOF STEP]
show "ext ps xs"
[PROOF STATE]
proof (prove)
using this:
adj_path v xs
butlast xs = ps

goal (1 subgoal):
 1. ext ps xs
[PROOF STEP]
by (metis False butlast.simps(1) ext)
[PROOF STATE]
proof (state)
this:
ext ps xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?xs \<in> app ` qs \<Longrightarrow> ?xs \<in> {ps'. ext ps ps'}

goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xs \<in> app ` qs \<Longrightarrow> ?xs \<in> {ps'. ext ps ps'}

goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
have "\<And>xs. xs\<in>{ps'. ext ps ps'} \<Longrightarrow> xs\<in> app ` qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps'. ext ps ps'} \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
proof (cases "ps=[]")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
ps = []

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
hence "qs = {n. adjacent v n }"
[PROOF STATE]
proof (prove)
using this:
ps = []

goal (1 subgoal):
 1. qs = {n. adjacent v n}
[PROOF STEP]
using qs
[PROOF STATE]
proof (prove)
using this:
ps = []
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}

goal (1 subgoal):
 1. qs = {n. adjacent v n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
qs = {n. adjacent v n}

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
assume "xs \<in> {ps'. ext ps ps'}"
[PROOF STATE]
proof (state)
this:
xs \<in> {ps'. ext ps ps'}

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
hence "xs\<noteq>[]" and "(butlast xs=ps)" and "adj_path v xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> {ps'. ext ps ps'}

goal (1 subgoal):
 1. xs \<noteq> [] &&& butlast xs = ps &&& adj_path v xs
[PROOF STEP]
using ext
[PROOF STATE]
proof (prove)
using this:
xs \<in> {ps'. ext ps ps'}
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')

goal (1 subgoal):
 1. xs \<noteq> [] &&& butlast xs = ps &&& adj_path v xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
butlast xs = ps
adj_path v xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps = []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
 2. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
thus "xs \<in> app ` qs"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
butlast xs = ps
adj_path v xs

goal (1 subgoal):
 1. xs \<in> app ` qs
[PROOF STEP]
using True app \<open>qs = {n. adjacent v n}\<close>
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
butlast xs = ps
adj_path v xs
ps = []
app = (\<lambda>q. ps @ [q])
qs = {n. adjacent v n}

goal (1 subgoal):
 1. xs \<in> app ` qs
[PROOF STEP]
by (metis  adj_path.simps(2) append_butlast_last_id append_self_conv2 image_iff
                  mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
xs \<in> app ` qs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
ps \<noteq> []

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
assume "xs \<in> {ps'. ext ps ps'}"
[PROOF STATE]
proof (state)
this:
xs \<in> {ps'. ext ps ps'}

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
hence "xs\<noteq>[]" and "(butlast xs=ps)" and "adj_path v xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> {ps'. ext ps ps'}

goal (1 subgoal):
 1. xs \<noteq> [] &&& butlast xs = ps &&& adj_path v xs
[PROOF STEP]
using ext
[PROOF STATE]
proof (prove)
using this:
xs \<in> {ps'. ext ps ps'}
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')

goal (1 subgoal):
 1. xs \<noteq> [] &&& butlast xs = ps &&& adj_path v xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
butlast xs = ps
adj_path v xs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
butlast xs = ps
adj_path v xs
[PROOF STEP]
obtain q where "xs=ps@[q]"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
butlast xs = ps
adj_path v xs

goal (1 subgoal):
 1. (\<And>q. xs = ps @ [q] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis append_butlast_last_id)
[PROOF STATE]
proof (state)
this:
xs = ps @ [q]

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
hence "adjacent (last ps) q"
[PROOF STATE]
proof (prove)
using this:
xs = ps @ [q]

goal (1 subgoal):
 1. adjacent (last ps) q
[PROOF STEP]
using \<open>adj_path v xs\<close> False adj_path_app'
[PROOF STATE]
proof (prove)
using this:
xs = ps @ [q]
adj_path v xs
ps \<noteq> []
\<lbrakk>adj_path ?v (?ps @ [?q]); ?ps \<noteq> []\<rbrakk> \<Longrightarrow> adjacent (last ?ps) ?q

goal (1 subgoal):
 1. adjacent (last ps) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjacent (last ps) q

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>xs \<in> {ps'. ext ps ps'}; ps \<noteq> []\<rbrakk> \<Longrightarrow> xs \<in> app ` qs
[PROOF STEP]
thus "xs \<in> app ` qs"
[PROOF STATE]
proof (prove)
using this:
adjacent (last ps) q

goal (1 subgoal):
 1. xs \<in> app ` qs
[PROOF STEP]
using qs
[PROOF STATE]
proof (prove)
using this:
adjacent (last ps) q
qs = {n. if ps = [] then adjacent v n else adjacent (last ps) n}

goal (1 subgoal):
 1. xs \<in> app ` qs
[PROOF STEP]
by (metis (lifting, full_types) False \<open>xs = ps @ [q]\<close> app imageI mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
xs \<in> app ` qs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?xs \<in> {ps'. ext ps ps'} \<Longrightarrow> ?xs \<in> app ` qs

goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> app ` qs \<Longrightarrow> ?xs \<in> {ps'. ext ps ps'}
?xs \<in> {ps'. ext ps ps'} \<Longrightarrow> ?xs \<in> app ` qs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?xs \<in> app ` qs \<Longrightarrow> ?xs \<in> {ps'. ext ps ps'}
?xs \<in> {ps'. ext ps ps'} \<Longrightarrow> ?xs \<in> app ` qs

goal (1 subgoal):
 1. app ` qs = {ps'. ext ps ps'}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
app ` qs = {ps'. ext ps ps'}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
app ` qs = {ps'. ext ps ps'}

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
app ` qs = {ps'. ext ps ps'}

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
have "inj_on app qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on app qs
[PROOF STEP]
using app
[PROOF STATE]
proof (prove)
using this:
app = (\<lambda>q. ps @ [q])

goal (1 subgoal):
 1. inj_on app qs
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
app = (\<lambda>q. ps @ [q])

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

goal (1 subgoal):
 1. \<And>ps. ps \<in> {ps. length ps = n \<and> adj_path v ps} \<Longrightarrow> card {ps'. ext ps ps'} = k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
app ` qs = {ps'. ext ps ps'}
inj_on app qs
[PROOF STEP]
show "card {ps'. ext ps ps'}=k"
[PROOF STATE]
proof (prove)
using this:
app ` qs = {ps'. ext ps ps'}
inj_on app qs

goal (1 subgoal):
 1. card {ps'. ext ps ps'} = k
[PROOF STEP]
by (metis \<open>card qs = k\<close> card_image)
[PROOF STATE]
proof (state)
this:
card {ps'. ext ps ps'} = k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
have "\<forall>ps1 ps2. ps1\<noteq>ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n}={}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}
[PROOF STEP]
using ext
[PROOF STATE]
proof (prove)
using this:
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')

goal (1 subgoal):
 1. \<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
have "finite {ps. length ps = n \<and> adj_path v ps}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
using Suc.hyps assms
[PROOF STATE]
proof (prove)
using this:
card {ps. length ps = n \<and> adj_path v ps} = k ^ n
?v \<in> V \<Longrightarrow> card {n. adjacent ?v n} = k
v \<in> V
finite V
0 < k

goal (1 subgoal):
 1. finite {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
by (auto intro: card_ge_0_finite)
[PROOF STATE]
proof (state)
this:
finite {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k
\<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}
finite {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
have "card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n})
      = k * card {ps. length ps = n \<and> adj_path v ps}"
[PROOF STATE]
proof (prove)
using this:
\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k
\<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}
finite {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
using card_partition'[of "{ps. length ps = n \<and> adj_path v ps}" ext k] \<open>k>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>ps\<in>{ps. length ps = n \<and> adj_path v ps}. card {ps'. ext ps ps'} = k
\<forall>ps1 ps2. ps1 \<noteq> ps2 \<longrightarrow> {n. ext ps1 n} \<inter> {n. ext ps2 n} = {}
finite {ps. length ps = n \<and> adj_path v ps}
\<lbrakk>\<forall>v\<in>{ps. length ps = n \<and> adj_path v ps}. card {n. ext v n} = k; 0 < k; finite {ps. length ps = n \<and> adj_path v ps}; \<forall>v1 v2. v1 \<noteq> v2 \<longrightarrow> {n. ext v1 n} \<inter> {n. ext v2 n} = {}\<rbrakk> \<Longrightarrow> card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
0 < k

goal (1 subgoal):
 1. card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
have "{ps. length ps = n+1 \<and> adj_path v ps}
      =(\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
have "\<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow>
          xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
assume "xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}"
[PROOF STATE]
proof (state)
this:
xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
hence "length xs = n +1" and "adj_path v xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}

goal (1 subgoal):
 1. length xs = n + 1 &&& adj_path v xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs = n + 1
adj_path v xs

goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
hence "butlast xs \<in>{ps. length ps = n \<and> adj_path v ps}"
[PROOF STATE]
proof (prove)
using this:
length xs = n + 1
adj_path v xs

goal (1 subgoal):
 1. butlast xs \<in> {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
using adj_path_butlast length_butlast mem_Collect_eq
[PROOF STATE]
proof (prove)
using this:
length xs = n + 1
adj_path v xs
adj_path ?v ?ps \<Longrightarrow> adj_path ?v (butlast ?ps)
length (butlast ?xs) = length ?xs - 1
(?a \<in> Collect ?P) = ?P ?a

goal (1 subgoal):
 1. butlast xs \<in> {ps. length ps = n \<and> adj_path v ps}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
butlast xs \<in> {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. \<And>xs. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
thus "xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})"
[PROOF STATE]
proof (prove)
using this:
butlast xs \<in> {ps. length ps = n \<and> adj_path v ps}

goal (1 subgoal):
 1. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
using \<open>adj_path v xs\<close> \<open>length xs = n + 1\<close> UN_iff  ext length_greater_0_conv
              mem_Collect_eq
[PROOF STATE]
proof (prove)
using this:
butlast xs \<in> {ps. length ps = n \<and> adj_path v ps}
adj_path v xs
length xs = n + 1
(?b \<in> \<Union> (?B ` ?A)) = (\<exists>x\<in>?A. ?b \<in> ?B x)
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')
(0 < length ?xs) = (?xs \<noteq> [])
(?a \<in> Collect ?P) = ?P ?a

goal (1 subgoal):
 1. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> ?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> ?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
have "\<And>xs . xs\<in>(\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow>
          xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
assume "xs\<in>(\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})"
[PROOF STATE]
proof (state)
this:
xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
obtain ys where "length ys=n" "adj_path v ys" "ext ys xs"
[PROOF STATE]
proof (prove)
using this:
xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. (\<And>ys. \<lbrakk>length ys = n; adj_path v ys; ext ys xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length ys = n
adj_path v ys
ext ys xs

goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
hence "length xs=n+1"
[PROOF STATE]
proof (prove)
using this:
length ys = n
adj_path v ys
ext ys xs

goal (1 subgoal):
 1. length xs = n + 1
[PROOF STEP]
using ext
[PROOF STATE]
proof (prove)
using this:
length ys = n
adj_path v ys
ext ys xs
ext = (\<lambda>ps ps'. ps' \<noteq> [] \<and> butlast ps' = ps \<and> adj_path v ps')

goal (1 subgoal):
 1. length xs = n + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs = n + 1

goal (1 subgoal):
 1. \<And>xs. xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
thus "xs\<in>{ps. length ps = n + 1 \<and> adj_path v ps}"
[PROOF STATE]
proof (prove)
using this:
length xs = n + 1

goal (1 subgoal):
 1. xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
by (metis (lifting, full_types) \<open>ext ys xs\<close> ext mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> ?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}

goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> ?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> ?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps} \<Longrightarrow> ?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
?xs \<in> (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'}) \<Longrightarrow> ?xs \<in> {ps. length ps = n + 1 \<and> adj_path v ps}

goal (1 subgoal):
 1. {ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. \<And>nat. card {ps. length ps = nat \<and> adj_path v ps} = k ^ nat \<Longrightarrow> card {ps. length ps = Suc nat \<and> adj_path v ps} = k ^ Suc nat
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
{ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
[PROOF STEP]
show "card {ps. length ps = (Suc n) \<and> adj_path v ps} = k ^ (Suc n)"
[PROOF STATE]
proof (prove)
using this:
card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
{ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})

goal (1 subgoal):
 1. card {ps. length ps = Suc n \<and> adj_path v ps} = k ^ Suc n
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
card (\<Union>v\<in>{ps. length ps = n \<and> adj_path v ps}. {n. ext v n}) = k * card {ps. length ps = n \<and> adj_path v ps}
{ps. length ps = n + 1 \<and> adj_path v ps} = (\<Union>ps\<in>{ps. length ps = n \<and> adj_path v ps}. {ps'. ext ps ps'})
card {ps. length ps = n \<and> adj_path v ps} = k ^ n

goal (1 subgoal):
 1. card {ps. length ps = Suc n \<and> adj_path v ps} = k ^ Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {ps. length ps = Suc n \<and> adj_path v ps} = k ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma piecewise_differentiable_cases:
  fixes c::real
  assumes "f piecewise_differentiable_on {a..c}"
          "g piecewise_differentiable_on {c..b}"
           "a \<le> c" "c \<le> b" "f c = g c"
  shows "(\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
obtain S T where st: "finite S" "finite T"
               and fd: "\<And>x. x \<in> {a..c} - S \<Longrightarrow> f differentiable at x within {a..c}"
               and gd: "\<And>x. x \<in> {c..b} - T \<Longrightarrow> g differentiable at x within {c..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S T. \<lbrakk>finite S; finite T; \<And>x. x \<in> {a..c} - S \<Longrightarrow> f differentiable at x within {a..c}; \<And>x. x \<in> {c..b} - T \<Longrightarrow> g differentiable at x within {c..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f piecewise_differentiable_on {a..c}
g piecewise_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c

goal (1 subgoal):
 1. (\<And>S T. \<lbrakk>finite S; finite T; \<And>x. x \<in> {a..c} - S \<Longrightarrow> f differentiable at x within {a..c}; \<And>x. x \<in> {c..b} - T \<Longrightarrow> g differentiable at x within {c..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: piecewise_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
finite S
finite T
?x \<in> {a..c} - S \<Longrightarrow> f differentiable at ?x within {a..c}
?x \<in> {c..b} - T \<Longrightarrow> g differentiable at ?x within {c..b}

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
have finabc: "finite ({a,b,c} \<union> (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({a, b, c} \<union> (S \<union> T))
[PROOF STEP]
by (metis \<open>finite S\<close> \<open>finite T\<close> finite_Un finite_insert finite.emptyI)
[PROOF STATE]
proof (state)
this:
finite ({a, b, c} \<union> (S \<union> T))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
have "continuous_on {a..c} f" "continuous_on {c..b} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..c} f &&& continuous_on {c..b} g
[PROOF STEP]
using assms piecewise_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
f piecewise_differentiable_on {a..c}
g piecewise_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c
?f piecewise_differentiable_on ?i \<equiv> continuous_on ?i ?f \<and> (\<exists>S. finite S \<and> (\<forall>x\<in>?i - S. ?f differentiable at x within ?i))

goal (1 subgoal):
 1. continuous_on {a..c} f &&& continuous_on {c..b} g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_on {a..c} f
continuous_on {c..b} g

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a..c} f
continuous_on {c..b} g
[PROOF STEP]
have "continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..c} f
continuous_on {c..b} g

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
[PROOF STEP]
using continuous_on_cases [OF closed_real_atLeastAtMost [of a c],
                               OF closed_real_atLeastAtMost [of c b],
                               of f g "\<lambda>x. x\<le>c"]  assms
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..c} f
continuous_on {c..b} g
\<lbrakk>continuous_on {a..c} f; continuous_on {c..b} g; \<forall>x. x \<in> {a..c} \<and> \<not> x \<le> c \<or> x \<in> {c..b} \<and> x \<le> c \<longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> continuous_on ({a..c} \<union> {c..b}) (\<lambda>x. if x \<le> c then f x else g x)
f piecewise_differentiable_on {a..c}
g piecewise_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
[PROOF STEP]
by (force simp: ivl_disj_un_two_touch)
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
assume x: "x \<in> {a..b} - ({a,b,c} \<union> (S \<union> T))"
[PROOF STATE]
proof (state)
this:
x \<in> {a..b} - ({a, b, c} \<union> (S \<union> T))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
have "(\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}" (is "?diff_fg")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
proof (cases x c rule: le_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> c \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
 2. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
case le
[PROOF STATE]
proof (state)
this:
x \<le> c

goal (2 subgoals):
 1. x \<le> c \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
 2. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
show ?diff_fg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
proof (rule differentiable_transform_within [where d = "dist x c"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. ?f differentiable at x within {a..b}
 2. 0 < dist x c
 3. x \<in> {a..b}
 4. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> ?f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
have "f differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f differentiable at x
[PROOF STEP]
using x le fd [of x] at_within_interior [of x "{a..c}"]
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - ({a, b, c} \<union> (S \<union> T))
x \<le> c
x \<in> {a..c} - S \<Longrightarrow> f differentiable at x within {a..c}
x \<in> interior {a..c} \<Longrightarrow> at x within {a..c} = at x

goal (1 subgoal):
 1. f differentiable at x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f differentiable at x

goal (4 subgoals):
 1. ?f differentiable at x within {a..b}
 2. 0 < dist x c
 3. x \<in> {a..b}
 4. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> ?f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f differentiable at x
[PROOF STEP]
show "f differentiable at x within {a..b}"
[PROOF STATE]
proof (prove)
using this:
f differentiable at x

goal (1 subgoal):
 1. f differentiable at x within {a..b}
[PROOF STEP]
by (simp add: differentiable_at_withinI)
[PROOF STATE]
proof (state)
this:
f differentiable at x within {a..b}

goal (3 subgoals):
 1. 0 < dist x c
 2. x \<in> {a..b}
 3. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
qed (use x le st dist_real_def in auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}

goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
case ge
[PROOF STATE]
proof (state)
this:
c \<le> x

goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
show ?diff_fg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}
[PROOF STEP]
proof (rule differentiable_transform_within [where d = "dist x c"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. ?f differentiable at x within {a..b}
 2. 0 < dist x c
 3. x \<in> {a..b}
 4. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> ?f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
have "g differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g differentiable at x
[PROOF STEP]
using x ge gd [of x] at_within_interior [of x "{c..b}"]
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - ({a, b, c} \<union> (S \<union> T))
c \<le> x
x \<in> {c..b} - T \<Longrightarrow> g differentiable at x within {c..b}
x \<in> interior {c..b} \<Longrightarrow> at x within {c..b} = at x

goal (1 subgoal):
 1. g differentiable at x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g differentiable at x

goal (4 subgoals):
 1. ?f differentiable at x within {a..b}
 2. 0 < dist x c
 3. x \<in> {a..b}
 4. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> ?f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g differentiable at x
[PROOF STEP]
show "g differentiable at x within {a..b}"
[PROOF STATE]
proof (prove)
using this:
g differentiable at x

goal (1 subgoal):
 1. g differentiable at x within {a..b}
[PROOF STEP]
by (simp add: differentiable_at_withinI)
[PROOF STATE]
proof (state)
this:
g differentiable at x within {a..b}

goal (3 subgoals):
 1. 0 < dist x c
 2. x \<in> {a..b}
 3. \<And>x'. \<lbrakk>x' \<in> {a..b}; dist x' x < dist x c\<rbrakk> \<Longrightarrow> g x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
qed (use x ge st dist_real_def in auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b}

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> {a..b} - ({a, b, c} \<union> (S \<union> T)) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2 within {a..b}

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> {a..b} - ({a, b, c} \<union> (S \<union> T)) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2 within {a..b}
[PROOF STEP]
have "\<exists>S. finite S \<and>
                 (\<forall>x\<in>{a..b} - S. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b})"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> {a..b} - ({a, b, c} \<union> (S \<union> T)) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2 within {a..b}

goal (1 subgoal):
 1. \<exists>S. finite S \<and> (\<forall>x\<in>{a..b} - S. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b})
[PROOF STEP]
by (meson finabc)
[PROOF STATE]
proof (state)
this:
\<exists>S. finite S \<and> (\<forall>x\<in>{a..b} - S. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b})

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
\<exists>S. finite S \<and> (\<forall>x\<in>{a..b} - S. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
\<exists>S. finite S \<and> (\<forall>x\<in>{a..b} - S. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x within {a..b})

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}
[PROOF STEP]
by (simp add: piecewise_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) piecewise_differentiable_on {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lambert_W_pos_iff [simp]: "Lambert_W x > 0 \<longleftrightarrow> x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
proof (cases "x \<ge> -exp (-1)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
 2. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> x

goal (2 subgoals):
 1. - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
 2. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) \<le> x

goal (1 subgoal):
 1. (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
using Lambert_W_less_iff[of 0 x]
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) \<le> x
\<lbrakk>- exp (- 1) \<le> 0; - exp (- 1) \<le> x\<rbrakk> \<Longrightarrow> (Lambert_W 0 < Lambert_W x) = (0 < x)

goal (1 subgoal):
 1. (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
by (simp del: Lambert_W_less_iff)
[PROOF STATE]
proof (state)
this:
(0 < Lambert_W x) = (0 < x)

goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> - exp (- 1) \<le> x

goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
hence "x < - exp(-1)"
[PROOF STATE]
proof (prove)
using this:
\<not> - exp (- 1) \<le> x

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

goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x < - exp (- 1)

goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
have "\<dots> \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> 0

goal (1 subgoal):
 1. \<not> - exp (- 1) \<le> x \<Longrightarrow> (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < 0

goal (1 subgoal):
 1. (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
x < 0
\<not> - exp (- 1) \<le> x

goal (1 subgoal):
 1. (0 < Lambert_W x) = (0 < x)
[PROOF STEP]
by (auto simp: Lambert_W_le_minus_one)
[PROOF STATE]
proof (state)
this:
(0 < Lambert_W x) = (0 < x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_partial_insertion_le_mpoly: "degree (partial_insertion \<alpha> x p) \<le> degree (mpoly_to_mpoly_poly x p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.degree (partial_insertion \<alpha> x p) \<le> Polynomial.degree (mpoly_to_mpoly_poly x p)
[PROOF STEP]
unfolding partial_insertion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.degree (map_poly (insertion \<alpha>) (mpoly_to_mpoly_poly x p)) \<le> Polynomial.degree (mpoly_to_mpoly_poly x p)
[PROOF STEP]
by (rule degree_map_poly_le)


[STATEMENT]
lemma one_less_exp_iff [simp]: "1 < exp x \<longleftrightarrow> 0 < x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < exp x) = (0 < x)
[PROOF STEP]
using exp_less_cancel_iff [where x = 0 and y = x]
[PROOF STATE]
proof (prove)
using this:
(exp 0 < exp x) = (0 < x)

goal (1 subgoal):
 1. (1 < exp x) = (0 < x)
[PROOF STEP]
by simp


[STATEMENT]
lemma non_empty_cycle_root_rtc_tc:
  assumes "non_empty_cycle_root r x"
    shows "x\<^sup>\<star>;r = x\<^sup>+;r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> ; r = x\<^sup>+ ; r
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x\<^sup>\<star> ; r \<le> x\<^sup>+ ; r
 2. x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r
[PROOF STEP]
have "r \<le> x\<^sup>+;r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; r
[PROOF STEP]
using assms many_strongly_connected_iff_7 non_empty_cycle_root_loop non_empty_cycle_root_msc
[PROOF STATE]
proof (prove)
using this:
non_empty_cycle_root r x
many_strongly_connected ?x = (?x\<^sup>T\<^sup>+ = ?x\<^sup>+)
non_empty_cycle_root ?r ?x \<Longrightarrow> ?r \<le> ?x\<^sup>T\<^sup>+ ; ?r
non_empty_cycle_root ?r ?x \<Longrightarrow> many_strongly_connected ?x

goal (1 subgoal):
 1. r \<le> x\<^sup>+ ; r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r \<le> x\<^sup>+ ; r

goal (2 subgoals):
 1. x\<^sup>\<star> ; r \<le> x\<^sup>+ ; r
 2. x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r
[PROOF STEP]
thus "x\<^sup>\<star>;r \<le> x\<^sup>+;r"
[PROOF STATE]
proof (prove)
using this:
r \<le> x\<^sup>+ ; r

goal (1 subgoal):
 1. x\<^sup>\<star> ; r \<le> x\<^sup>+ ; r
[PROOF STEP]
using sup_absorb2
[PROOF STATE]
proof (prove)
using this:
r \<le> x\<^sup>+ ; r
?x \<le> ?y \<Longrightarrow> ?x + ?y = ?y

goal (1 subgoal):
 1. x\<^sup>\<star> ; r \<le> x\<^sup>+ ; r
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> ; r \<le> x\<^sup>+ ; r

goal (1 subgoal):
 1. x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r
[PROOF STEP]
show "x\<^sup>+;r \<le> x\<^sup>\<star>;r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r
[PROOF STEP]
by (simp add: mult_isor)
[PROOF STATE]
proof (state)
this:
x\<^sup>+ ; r \<le> x\<^sup>\<star> ; r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uniform_limit_cong':
  fixes f g :: "'a \<Rightarrow> 'b \<Rightarrow> ('c :: metric_space)" and h i :: "'b \<Rightarrow> 'c"
  assumes "\<And>y x. x \<in> X \<Longrightarrow> f y x = g y x"
  assumes "\<And>x. x \<in> X \<Longrightarrow> h x = i x"
  shows   "uniform_limit X f h F \<longleftrightarrow> uniform_limit X g i F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit X f h F = uniform_limit X g i F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> X \<Longrightarrow> f ?y ?x = g ?y ?x
?x \<in> X \<Longrightarrow> h ?x = i ?x

goal (1 subgoal):
 1. uniform_limit X f h F = uniform_limit X g i F
[PROOF STEP]
by (intro uniform_limit_cong always_eventually) blast+


[STATEMENT]
lemma reindex_bij_witness:
  assumes witness:
    "\<And>a. a \<in> S \<Longrightarrow> i (j a) = a"
    "\<And>a. a \<in> S \<Longrightarrow> j a \<in> T"
    "\<And>b. b \<in> T \<Longrightarrow> j (i b) = b"
    "\<And>b. b \<in> T \<Longrightarrow> i b \<in> S"
  assumes eq:
    "\<And>a. a \<in> S \<Longrightarrow> h (j a) = g a"
  shows "F g S = F h T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
have "bij_betw j S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw j S T
[PROOF STEP]
using bij_betw_byWitness[where A=S and f=j and f'=i and A'=T] witness
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>a\<in>S. i (j a) = a; \<forall>a'\<in>T. j (i a') = a'; j ` S \<subseteq> T; i ` T \<subseteq> S\<rbrakk> \<Longrightarrow> bij_betw j S T
?a1 \<in> S \<Longrightarrow> i (j ?a1) = ?a1
?a1 \<in> S \<Longrightarrow> j ?a1 \<in> T
?b1 \<in> T \<Longrightarrow> j (i ?b1) = ?b1
?b1 \<in> T \<Longrightarrow> i ?b1 \<in> S

goal (1 subgoal):
 1. bij_betw j S T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw j S T

goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw j S T

goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
have "F g S = F (\<lambda>x. h (j x)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F g S = F (\<lambda>x. h (j x)) S
[PROOF STEP]
by (intro cong) (auto simp: eq)
[PROOF STATE]
proof (state)
this:
F g S = F (\<lambda>x. h (j x)) S

goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw j S T
F g S = F (\<lambda>x. h (j x)) S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw j S T
F g S = F (\<lambda>x. h (j x)) S

goal (1 subgoal):
 1. F g S = F h T
[PROOF STEP]
by (simp add: reindex_bij_betw)
[PROOF STATE]
proof (state)
this:
F g S = F h T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_nth_append_upt[simp]:
  assumes "a \<ge> length xs"
  shows "map ((!) (xs @ ys)) [a..<b] = map ((!) ys) [a - length xs..<b - length xs]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((!) (xs @ ys)) [a..<b] = map ((!) ys) [a - length xs..<b - length xs]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs \<le> a

goal (1 subgoal):
 1. map ((!) (xs @ ys)) [a..<b] = map ((!) ys) [a - length xs..<b - length xs]
[PROOF STEP]
by (auto intro!: nth_equalityI simp: nth_append)


[STATEMENT]
lemma extreme_point_of_convex_hull_2:
  fixes x :: "'a::euclidean_space"
  shows "x extreme_point_of (convex hull {a,b}) \<longleftrightarrow> x = a \<or> x = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x extreme_point_of convex hull {a, b}) = (x = a \<or> x = b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x extreme_point_of convex hull {a, b}) = (x = a \<or> x = b)
[PROOF STEP]
have "x extreme_point_of (convex hull {a,b}) \<longleftrightarrow> x \<in> {a,b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x extreme_point_of convex hull {a, b}) = (x \<in> {a, b})
[PROOF STEP]
by (intro extreme_point_of_convex_hull_affine_independent affine_independent_2)
[PROOF STATE]
proof (state)
this:
(x extreme_point_of convex hull {a, b}) = (x \<in> {a, b})

goal (1 subgoal):
 1. (x extreme_point_of convex hull {a, b}) = (x = a \<or> x = b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x extreme_point_of convex hull {a, b}) = (x \<in> {a, b})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x extreme_point_of convex hull {a, b}) = (x \<in> {a, b})

goal (1 subgoal):
 1. (x extreme_point_of convex hull {a, b}) = (x = a \<or> x = b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x extreme_point_of convex hull {a, b}) = (x = a \<or> x = b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Levy_Inversion_aux2:
  fixes a b t :: real
  assumes "a \<le> b" and "t \<noteq> 0"
  shows "cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * t)) \<le> b - a" (is "?F \<le> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
have "?F = cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) = cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t))
[PROOF STEP]
using \<open>t \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> 0

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) = cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t))
[PROOF STEP]
by (intro arg_cong[where f=norm]) (simp add: field_simps exp_diff exp_minus)
[PROOF STATE]
proof (state)
this:
cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) = cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t))

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) = cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t))

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
have "\<dots> = cmod (iexp (t * (b - a)) - 1) / abs t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t)) = cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar>
[PROOF STEP]
unfolding norm_divide norm_mult norm_exp_i_times
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * cmod (iexp (t * (b - a)) - 1) / (cmod \<i> * cmod (complex_of_real t)) = cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar>
[PROOF STEP]
using \<open>t \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> 0

goal (1 subgoal):
 1. 1 * cmod (iexp (t * (b - a)) - 1) / (cmod \<i> * cmod (complex_of_real t)) = cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar>
[PROOF STEP]
by (simp add: complex_eq_iff norm_mult)
[PROOF STATE]
proof (state)
this:
cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t)) = cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar>

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (iexp (t * a) * (iexp (t * (b - a)) - 1) / (\<i> * complex_of_real t)) = cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar>

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
have "\<dots> \<le> abs (t * (b - a)) / abs t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar> \<le> \<bar>t * (b - a)\<bar> / \<bar>t\<bar>
[PROOF STEP]
using iexp_approx1 [of "t * (b - a)" 0]
[PROOF STATE]
proof (prove)
using this:
cmod (iexp (t * (b - a)) - (\<Sum>k\<le>0. (\<i> * complex_of_real (t * (b - a))) ^ k / fact k)) \<le> \<bar>t * (b - a)\<bar> ^ Suc 0 / fact (Suc 0)

goal (1 subgoal):
 1. cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar> \<le> \<bar>t * (b - a)\<bar> / \<bar>t\<bar>
[PROOF STEP]
by (intro divide_right_mono) (auto simp add: field_simps eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar> \<le> \<bar>t * (b - a)\<bar> / \<bar>t\<bar>

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (iexp (t * (b - a)) - 1) / \<bar>t\<bar> \<le> \<bar>t * (b - a)\<bar> / \<bar>t\<bar>

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
have "\<dots> = b - a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>t * (b - a)\<bar> / \<bar>t\<bar> = b - a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> b
t \<noteq> 0

goal (1 subgoal):
 1. \<bar>t * (b - a)\<bar> / \<bar>t\<bar> = b - a
[PROOF STEP]
by (auto simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>t * (b - a)\<bar> / \<bar>t\<bar> = b - a

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a

goal (1 subgoal):
 1. cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cmod ((iexp (t * b) - iexp (t * a)) / (\<i> * complex_of_real t)) \<le> b - a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma and_mask_no: "numeral i AND mask n = word_of_int (take_bit n (numeral i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral i AND mask n = word_of_int (take_bit n (numeral i))
[PROOF STEP]
unfolding word_numeral_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_int (numeral i) AND mask n = word_of_int (take_bit n (numeral i))
[PROOF STEP]
by (rule and_mask_wi)


[STATEMENT]
lemma (in linorder) sorted_wrt_map_rev_linord [simp] :
  "sorted_wrt (\<lambda>(x::'a \<times> 'b) y. fst x \<ge> fst y) l
  \<longleftrightarrow> sorted (rev (map fst l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<lambda>x y. fst y \<le> fst x) l = sorted (rev (map fst l))
[PROOF STEP]
by (induct l) (auto simp add: sorted_append)


[STATEMENT]
lemma truncate_down_nonneg_iff[simp]: "truncate_down p x \<ge> 0 \<longleftrightarrow> x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> truncate_down p x) = (0 \<le> x)
[PROOF STEP]
using truncate_down_less_zero_iff[of p x] truncate_down_nonneg[of x p]
[PROOF STATE]
proof (prove)
using this:
(truncate_down p x < 0) = (x < 0)
0 \<le> x \<Longrightarrow> 0 \<le> truncate_down p x

goal (1 subgoal):
 1. (0 \<le> truncate_down p x) = (0 \<le> x)
[PROOF STEP]
by linarith


[STATEMENT]
lemma \<Delta>\<Phi>_merge:
  assumes "h1 = Node hs1 x1 Leaf" "h2 = Node hs2 x2 Leaf"
  shows "\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (size h1 + size h2) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
let ?hs = "Node hs1 x1 (Node hs2 x2 Leaf)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
have "\<Phi> (merge h1 h2) = \<Phi> (link ?hs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) = \<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
h1 = \<langle>hs1, x1, \<langle>\<rangle>\<rangle>
h2 = \<langle>hs2, x2, \<langle>\<rangle>\<rangle>

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) = \<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) = \<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>)

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) = \<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>)

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
have "\<dots> = \<Phi> hs1 + \<Phi> hs2 + log 2 (size hs1 + size hs2 + 1) + log 2 (size hs1 + size hs2 + 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> (link \<langle>hs1, x1, \<langle>hs2, x2, \<langle>\<rangle>\<rangle>\<rangle>) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
have "\<dots> = \<Phi> hs1 + \<Phi> hs2 + log 2 (size hs1 + size hs2 + 1) + log 2 (size h1 + size h2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2)) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
h1 = \<langle>hs1, x1, \<langle>\<rangle>\<rangle>
h2 = \<langle>hs2, x2, \<langle>\<rangle>\<rangle>

goal (1 subgoal):
 1. \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2)) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size hs1 + size hs2 + 2)) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Phi> (merge h1 h2) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))
[PROOF STEP]
have "\<Phi> (merge h1 h2) = \<dots>"
[PROOF STATE]
proof (prove)
using this:
\<Phi> (merge h1 h2) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) = \<Phi> hs1 + \<Phi> hs2 + log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
have "\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 =
   log 2 (size hs1 + size hs2 + 1) + log 2 (size h1 + size h2)
   - log 2 (size hs1 + 1) - log 2 (size hs2 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 = log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
h1 = \<langle>hs1, x1, \<langle>\<rangle>\<rangle>
h2 = \<langle>hs2, x2, \<langle>\<rangle>\<rangle>

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 = log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 = log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 = log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1))

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
have "\<dots> \<le> log 2 (size h1 + size h2) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1)) \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
using ld_le_2ld[of "size hs1" "size hs2"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> real (size hs1); 0 \<le> real (size hs2)\<rbrakk> \<Longrightarrow> log 2 (1 + real (size hs1) + real (size hs2)) \<le> 1 + log 2 (1 + real (size hs1)) + log 2 (1 + real (size hs2))
h1 = \<langle>hs1, x1, \<langle>\<rangle>\<rangle>
h2 = \<langle>hs2, x2, \<langle>\<rangle>\<rangle>

goal (1 subgoal):
 1. log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1)) \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
log 2 (real (size hs1 + size hs2 + 1)) + log 2 (real (size h1 + size h2)) - log 2 (real (size hs1 + 1)) - log 2 (real (size hs2 + 1)) \<le> log 2 (real (size h1 + size h2)) + 1

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1

goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma downset_set_idem [simp]: "\<Down> \<circ> \<Down> = \<Down>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Down> \<circ> \<Down> = \<Down>
[PROOF STEP]
unfolding fun_eq_iff downset_set_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. {y. Bex {y. Bex x ((\<le>) y)} ((\<le>) y)} = {y. Bex x ((\<le>) y)}
[PROOF STEP]
using order_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. \<forall>x. {y. Bex {y. Bex x ((\<le>) y)} ((\<le>) y)} = {y. Bex x ((\<le>) y)}
[PROOF STEP]
by auto


[STATEMENT]
lemma eSuc_numeral [simp]: "eSuc (numeral k) = numeral (k + Num.One)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eSuc (numeral k) = numeral (k + num.One)
[PROOF STEP]
by (simp only: eSuc_plus_1 numeral_plus_one)


[STATEMENT]
theorem open_euler2:
  assumes et: "euler_trail u p v" and "u \<noteq> v"
  shows "connected G \<and>
    (\<forall>w \<in> verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and>
    in_degree G u + 1 = out_degree G u \<and>
    out_degree G v + 1 = in_degree G v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v
[PROOF STEP]
from et
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p v
[PROOF STEP]
have *: "trail u p v" "u \<in> verts G" "v \<in> verts G"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p v

goal (1 subgoal):
 1. trail u p v &&& u \<in> verts G &&& v \<in> verts G
[PROOF STEP]
by (auto simp: euler_trail_def trail_def awalk_hd_in_verts)
[PROOF STATE]
proof (state)
this:
trail u p v
u \<in> verts G
v \<in> verts G

goal (1 subgoal):
 1. Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v
[PROOF STEP]
from et
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p v
[PROOF STEP]
have [simp]: "\<And>u. card (in_arcs G u \<inter> set p) = in_degree G u"
      "\<And>u. card (out_arcs G u \<inter> set p) = out_degree G u"
[PROOF STATE]
proof (prove)
using this:
euler_trail u p v

goal (1 subgoal):
 1. (\<And>u. card (in_arcs G u \<inter> set p) = in_degree G u) &&& (\<And>u. card (out_arcs G u \<inter> set p) = out_degree G u)
[PROOF STEP]
by (auto simp: in_degree_def out_degree_def euler_trail_def intro: arg_cong[where f=card])
[PROOF STATE]
proof (state)
this:
card (in_arcs G ?u2 \<inter> set p) = in_degree G ?u2
card (out_arcs G ?u2 \<inter> set p) = out_degree G ?u2

goal (1 subgoal):
 1. Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v
[PROOF STEP]
from assms *
[PROOF STATE]
proof (chain)
picking this:
euler_trail u p v
u \<noteq> v
trail u p v
u \<in> verts G
v \<in> verts G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
euler_trail u p v
u \<noteq> v
trail u p v
u \<in> verts G
v \<in> verts G

goal (1 subgoal):
 1. Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v
[PROOF STEP]
by (auto simp: arc_set_balance_def elim: trail_arc_balanceE
        intro: euler_imp_connected)
[PROOF STATE]
proof (state)
this:
Digraph_Component.connected G \<and> (\<forall>w\<in>verts G. u \<noteq> w \<longrightarrow> v \<noteq> w \<longrightarrow> in_degree G w = out_degree G w) \<and> in_degree G u + 1 = out_degree G u \<and> out_degree G v + 1 = in_degree G v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setdist_eq_0_closedin:
  shows "\<lbrakk>closedin (top_of_set U) S; x \<in> U\<rbrakk>
         \<Longrightarrow> (setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closedin (top_of_set U) S; x \<in> U\<rbrakk> \<Longrightarrow> (setdist {x} S = 0) = (S = {} \<or> x \<in> S)
[PROOF STEP]
by (auto simp: closedin_limpt setdist_eq_0_sing_1 closure_def)


[STATEMENT]
lemma resr_dist: "x \<rightarrow> (y \<sqinter> z) = (x \<rightarrow> y) \<sqinter> (x \<rightarrow> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<rightarrow> y \<sqinter> z = (x \<rightarrow> y) \<sqinter> (x \<rightarrow> z)
[PROOF STEP]
by (metis local.resr_eq local.residuated_inf local.residuated_multr)


[STATEMENT]
lemma SUP_diff_ennreal:
  "c < top \<Longrightarrow> (SUP i\<in>I. f i - c :: ennreal) = (SUP i\<in>I. f i) - c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < top \<Longrightarrow> (SUP i\<in>I. f i - c) = Sup (f ` I) - c
[PROOF STEP]
by (auto intro!: SUP_eqI ennreal_minus_mono SUP_least intro: SUP_upper
           simp: ennreal_minus_cancel_iff ennreal_minus_le_iff less_top[symmetric])


[STATEMENT]
lemma complex_number_code_post[code_post]:
  shows "Complex a 0 = complex_of_real a"
    and "complex_of_real 0 = 0"
    and "complex_of_real 1 = 1"
    and "complex_of_real (a/b) = complex_of_real a / complex_of_real b"
    and "complex_of_real (numeral n) = numeral n"
    and "complex_of_real (-r) = - complex_of_real r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex a 0 = complex_of_real a &&& complex_of_real 0 = 0 &&& complex_of_real 1 = 1) &&& complex_of_real (a / b) = complex_of_real a / complex_of_real b &&& complex_of_real (numeral n) = numeral n &&& complex_of_real (- r) = - complex_of_real r
[PROOF STEP]
using complex_eq_cancel_iff2
[PROOF STATE]
proof (prove)
using this:
(Complex ?x ?y = complex_of_real ?xa) = (?x = ?xa \<and> ?y = 0)

goal (1 subgoal):
 1. (Complex a 0 = complex_of_real a &&& complex_of_real 0 = 0 &&& complex_of_real 1 = 1) &&& complex_of_real (a / b) = complex_of_real a / complex_of_real b &&& complex_of_real (numeral n) = numeral n &&& complex_of_real (- r) = - complex_of_real r
[PROOF STEP]
by auto


[STATEMENT]
lemma powreal_minus_one: "0 \<le> a \<Longrightarrow> a pow\<^sub>\<real> -1 = inverse a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a \<Longrightarrow> a pow\<^sub>\<real> - 1 = inverse a
[PROOF STEP]
by (simp add: powa_minus_one powreal_def real_inverse_ge_one_lemma)