Theory PlaneProps
section "Further Plane Graph Properties"
theory PlaneProps
imports Invariants
begin
subsection βΉ@{const final}βΊ
lemma plane_final_facesAt:
assumes "inv g" "final g" "v : π± g" "f β set (facesAt g v)" shows "final f"
proof -
from assms(1,3,4) have "f β β± g" by(blast intro: minGraphProps inv_mgp)
with assms(2) show ?thesis by (rule finalGraph_face)
qed
lemma finalVertexI:
"β¦ inv g; final g; v β π± g β§ βΉ finalVertex g v"
by (auto simp add: finalVertex_def nonFinals_def filter_empty_conv plane_final_facesAt)
lemma setFinal_notin_finals:
"β¦ f β β± g; Β¬ final f; minGraphProps g β§ βΉ setFinal f β set (finals g)"
apply(drule minGraphProps11)
apply(cases f)
apply(fastforce simp:finals_def setFinal_def normFaces_def normFace_def
verticesFrom_def minVertex_def inj_on_def distinct_map
split:facetype.splits)
done
subsection βΉ@{const degree}βΊ
lemma planeN4: "inv g βΉ f β β± g βΉ 3 β€ |vertices f|"
apply(subgoal_tac "2 < | vertices f |")
apply arith
apply(drule inv_mgp)
apply (erule (1) minGraphProps2)
done
lemma degree_eq:
assumes pl: "inv g" and fin: "final g" and v: "v : π± g"
shows "degree g v = tri g v + quad g v + except g v"
proof -
have dist: "distinct(facesAt g v)" using pl v by simp
have 3: "βf β set(facesAt g v). |vertices f| = 3 β¨ |vertices f| = 4 β¨
|vertices f| β₯ 5"
proof
fix f assume f: "f β set (facesAt g v)"
hence "|vertices f| β₯ 3"
using minGraphProps5[OF inv_mgp[OF pl] v f] planeN4[OF pl] by blast
thus "|vertices f| = 3 β¨ |vertices f| = 4 β¨ |vertices f| β₯ 5" by arith
qed
have "degree g v = |facesAt g v|" by(simp add:degree_def)
also have "β¦ = card(set(facesAt g v))" by (simp add:distinct_card[OF dist])
also have "set(facesAt g v) = {f β set(facesAt g v). |vertices f| = 3} βͺ
{f β set(facesAt g v). |vertices f| = 4} βͺ
{f β set(facesAt g v). |vertices f| β₯ 5}"
(is "_ = ?T βͺ ?Q βͺ ?E")
using 3 by blast
also have "card(?T βͺ ?Q βͺ ?E) = card ?T + card ?Q + card ?E"
apply (subst card_Un_disjoint)
apply simp
apply simp
apply fastforce
apply (subst card_Un_disjoint)
apply simp
apply simp
apply fastforce
apply simp
done
also have "β¦ = tri g v + quad g v + except g v" using fin
by(simp add:tri_def quad_def except_def
distinct_card[symmetric] distinct_filter[OF dist]
plane_final_facesAt[OF pl fin v] cong:conj_cong)
finally show ?thesis .
qed
lemma plane_fin_exceptionalVertex_def:
assumes pl: "inv g" and fin: "final g" and v: "v : π± g"
shows "exceptionalVertex g v =
( | [f β facesAt g v . 5 β€ |vertices f| ] | β 0)"
proof -
have "βf. f β set (facesAt g v) βΉ final f"
by(rule plane_final_facesAt[OF pl fin v])
then show ?thesis by (simp add: filter_simp exceptionalVertex_def except_def)
qed
lemma not_exceptional:
"inv g βΉ final g βΉ v : π± g βΉ f β set (facesAt g v) βΉ
Β¬ exceptionalVertex g v βΉ |vertices f| β€ 4"
by (auto simp add: plane_fin_exceptionalVertex_def except_def filter_empty_conv)
subsection βΉMiscβΊ
lemma in_next_plane0I:
assumes "g' β set (generatePolygon n v f g)" "f β set (nonFinals g)"
"v β π± f" "3 β€ n" "n < 4+p"
shows "g' β set (next_plane0βpβ g)"
proof -
from assms have
"βnβ{3..<4 + p}. g' β set (generatePolygon n v f g)"
by auto
with assms have
"βvβπ± f. βnβ{3..<4 + p}. g' β set (generatePolygon n v f g)"
by auto
with assms have
"βfβset (nonFinals g). βvβπ± f. βnβ{3..<4 + p}. g' β set (generatePolygon n v f g)"
by auto
moreover have "Β¬ final g" using assms(2)
by (auto simp: nonFinals_def finalGraph_def filter_empty_conv)
ultimately show ?thesis
by (simp add: next_plane0_def)
qed
lemma next_plane0_nonfinals: "g [next_plane0βpβ]β g' βΉ nonFinals g β []"
by(auto simp:next_plane0_def finalGraph_def)
lemma next_plane0_ex:
assumes a: "g [next_plane0βpβ]β g'"
shows "βfβ set(nonFinals g). βv β π± f. βi β set([3..<Suc(maxGon p)]).
g' β set (generatePolygon i v f g)"
proof -
from a have "Β¬ final g" by (auto simp add: next_plane0_def)
with a show ?thesis
by (auto simp add: next_plane0_def nonFinals_def)
qed
lemma step_outside2:
"inv g βΉ g [next_plane0βpβ]β g' βΉ Β¬ final g' βΉ |faces g'| β 2"
apply(frule inv_two_faces)
apply(frule inv_finals_nonempty)
apply(drule inv_mgp)
apply(insert len_faces_sum[of g] len_faces_sum[of g'])
apply(subgoal_tac "|nonFinals g| β 0")
prefer 2 apply(drule next_plane0_nonfinals) apply simp
apply(subgoal_tac "|nonFinals g'| β 0")
prefer 2 apply(simp add:finalGraph_def)
apply(drule (1) next_plane0_incr_faces)
apply(case_tac "|faces g| = 2")
prefer 2 apply arith
apply(subgoal_tac "|finals g| β 0")
apply arith
apply simp
done
subsectionβΉIncreasing final facesβΊ
lemma set_finals_splitFace[simp]:
"β¦ f β β± g; Β¬ final f β§ βΉ
set(finals(snd(snd(splitFace g u v f vs)))) = set(finals g)"
apply(auto simp add:splitFace_def split_def finals_def
split_face_def)
apply(drule replace5)
apply(clarsimp)
apply(erule replace4)
apply clarsimp
done
lemma next_plane0_finals_incr:
"g [next_plane0βpβ]β g' βΉ f β set(finals g) βΉ f β set(finals g')"
apply(auto simp:next_plane0_def generatePolygon_def split:if_split_asm)
apply(erule subdivFace_pres_finals)
apply (simp add:nonFinals_def)
done
lemma next_plane0_finals_subset:
"g' β set (next_plane0βpβ g) βΉ
set (finals g) β set (finals g')"
by (auto simp add: next_plane0_finals_incr)
lemma next_plane0_final_mono:
"β¦ g' β set (next_plane0βpβ g); f β β± g; final f β§ βΉ f β β± g'"
apply(drule next_plane0_finals_subset)
apply(simp add:finals_def)
apply blast
done
subsectionβΉIncreasing verticesβΊ
lemma next_plane0_vertices_subset:
"β¦ g' β set (next_plane0βpβ g); minGraphProps g β§ βΉ π± g β π± g'"
apply(rule next_plane0_incr)
apply(erule (1) subset_trans)
apply(simp add: vertices_makeFaceFinal)
defer apply assumption+
apply (auto simp: splitFace_def split_def vertices_graph)
done
subsectionβΉIncreasing vertex degreesβΊ
lemma next_plane0_incr_faceListAt:
"β¦ g' β set (next_plane0βpβ g); minGraphProps g β§
βΉ |faceListAt g| β€ |faceListAt g'| β§
(βv < |faceListAt g|. |faceListAt g ! v| β€ |faceListAt g' ! v| )"
(is "_ βΉ _ βΉ ?Q g g'")
apply(rule next_plane0_incr[where Q = ?Q])
prefer 4 apply assumption
prefer 4 apply assumption
apply(rule conjI) apply fastforce
apply(clarsimp)
apply(erule allE, erule impE, assumption)
apply(erule_tac x = v in allE, erule impE) apply force
apply force
apply(simp add: makeFaceFinal_def makeFaceFinalFaceList_def)
apply (simp add: splitFace_def split_def nth_append nth_list_update)
done
lemma next_plane0_incr_degree:
"β¦ g' β set (next_plane0βpβ g); minGraphProps g; v β π± g β§
βΉ degree g v β€ degree g' v"
apply(frule (1) next_plane0_incr_faceListAt)
apply(frule (1) next_plane0_vertices_subset)
apply(simp add:degree_def facesAt_def)
apply(frule minGraphProps4)
apply(simp add:vertices_graph)
done
subsectionβΉIncreasing @{const except}βΊ
lemma next_plane0_incr_except:
assumes "g' β set (next_plane0βpβ g)" "inv g" "v β π± g"
shows "except g v β€ except g' v"
proof (unfold except_def)
note inv' = invariantE[OF inv_inv_next_plane0, OF assms(1,2)]
note mgp = inv_mgp[OF assms(2)] and mgp' = inv_mgp[OF inv']
note dist = distinct_filter[OF mgp_dist_facesAt[OF mgp βΉv : π± gβΊ]]
have "v β π± g'"
using assms(3) next_plane0_vertices_subset[OF assms(1) mgp] by blast
note dist' = distinct_filter[OF mgp_dist_facesAt[OF mgp' βΉv : π± g'βΊ]]
have "|[fβfacesAt g v . final f β§ 5 β€ |vertices f| ]| =
card{fβ set(facesAt g v) . final f β§ 5 β€ |vertices f|}"
(is "?L = card ?M") using distinct_card[OF dist] by simp
also have "?M = {fβ β± g. v β π± f β§ final f β§ 5 β€ |vertices f|}"
by(simp add: minGraphProps_facesAt_eq[OF mgp assms(3)])
also have "β¦ = {f β set(finals g) . v β π± f β§ 5 β€ |vertices f|}"
by(auto simp:finals_def)
also have "card β¦ β€ card{f β set(finals g'). v β π± f β§ 5 β€ |vertices f|}"
(is "_ β€ card ?M")
apply(rule card_mono)
apply simp
using next_plane0_finals_subset[OF assms(1)] by blast
also have "?M = {fβ β± g' . v β π± f β§ final f β§ 5 β€ |vertices f|}"
by(auto simp:finals_def)
also have "β¦ = {f β set(facesAt g' v) . final f β§ 5 β€ |vertices f|}"
by(simp add: minGraphProps_facesAt_eq[OF mgp' βΉv β π± g'βΊ])
also have "card β¦ =
|[f β facesAt g' v . final f β§ 5 β€ |vertices f| ]|" (is "_ = ?R")
using distinct_card[OF dist'] by simp
finally show "?L β€ ?R" .
qed
subsectionβΉIncreasing edgesβΊ
lemma next_plane0_set_edges_subset:
"β¦ minGraphProps g; g [next_plane0βpβ]β g' β§ βΉ edges g β edges g'"
apply(rule next_plane0_incr)
apply(erule (1) subset_trans)
apply(simp add: edges_makeFaceFinal)
apply(erule snd_snd_splitFace_edges_incr)
apply assumption+
done
subsectionβΉIncreasing final verticesβΊ
declare atLeastLessThan_iff[iff]
lemma next_plane0_incr_finV:
"β¦g' β set (next_plane0βpβ g); minGraphProps g β§
βΉ βv β π± g. v β π± g' β§
((βfββ± g. v β π± f βΆ final f) βΆ
(βfββ± g'. v β π± f βΆ f β β± g))" (is "_ βΉ _ βΉ ?Q g g'")
apply(rule next_plane0_incr[where Q = ?Q and g=g and g'=g'])
prefer 4 apply assumption
prefer 4 apply assumption
apply fast
apply(clarsimp simp:makeFaceFinal_def vertices_graph makeFaceFinalFaceList_def)
apply(drule replace5)
apply(erule disjE)apply blast
apply(simp add:setFinal_def)
apply(unfold pre_splitFace_def)
apply(clarsimp simp:splitFace_def split_def vertices_graph)
apply(rule conjI)
apply(clarsimp simp:split_face_def vertices_graph atLeastLessThan_def)
apply(blast dest:inbetween_inset)
apply(clarsimp)
apply(erule disjE[OF replace5]) apply blast
apply(clarsimp simp:split_face_def vertices_graph)
apply(blast dest:inbetween_inset)
done
lemma next_plane0_finalVertex_mono:
"β¦g' β set (next_plane0βpβ g); inv g; u β π± g; finalVertex g u β§
βΉ finalVertex g' u"
apply(frule (1) invariantE[OF inv_inv_next_plane0])
apply(subgoal_tac "u β π± g'")
prefer 2 apply(blast dest:next_plane0_vertices_subset inv_mgp)
apply(clarsimp simp:finalVertex_def minGraphProps_facesAt_eq[OF inv_mgp])
apply(blast dest:next_plane0_incr_finV inv_mgp)
done
subsectionβΉPreservation of @{const facesAt} at final verticesβΊ
lemma next_plane0_finalVertex_facesAt_eq:
"β¦g' β set (next_plane0βpβ g); inv g; v β π± g; finalVertex g v β§
βΉ set(facesAt g' v) = set(facesAt g v)"
apply(frule (1) invariantE[OF inv_inv_next_plane0])
apply(subgoal_tac "v β π± g'")
prefer 2 apply(blast dest:next_plane0_vertices_subset inv_mgp)
apply(clarsimp simp:finalVertex_def minGraphProps_facesAt_eq[OF inv_mgp])
by(blast dest:next_plane0_incr_finV next_plane0_final_mono inv_mgp)
lemma next_plane0_len_filter_eq:
assumes "g' β set (next_plane0βpβ g)" "inv g" "v β π± g" "finalVertex g v"
shows "|filter P (facesAt g' v)| = |filter P (facesAt g v)|"
proof -
note inv' = invariantE[OF inv_inv_next_plane0, OF assms(1,2)]
note mgp = inv_mgp[OF assms(2)] and mgp' = inv_mgp[OF inv']
note dist = distinct_filter[OF mgp_dist_facesAt[OF mgp βΉv : π± gβΊ]]
have "v β π± g'"
using assms(3) next_plane0_vertices_subset[OF assms(1) mgp] by blast
note dist' = distinct_filter[OF mgp_dist_facesAt[OF mgp' βΉv : π± g'βΊ]]
have "|filter P (facesAt g' v)| = card{f β set(facesAt g' v) . P f}"
using distinct_card[OF dist'] by simp
also have "β¦ = card{f β set(facesAt g v) . P f}"
by(simp add: next_plane0_finalVertex_facesAt_eq[OF assms])
also have "β¦ = |filter P (facesAt g v)|"
using distinct_card[OF dist] by simp
finally show ?thesis .
qed
subsectionβΉProperties of @{const subdivFace'}βΊ
lemma new_edge_subdivFace':
"βf v n g.
pre_subdivFace' g f u v n ovs βΉ minGraphProps g βΉ f β β± g βΉ
subdivFace' g f v n ovs = makeFaceFinal f g β¨
(βf' β β± (subdivFace' g f v n ovs) - (β± g - {f}).
βe β β° f'. e β β° g)"
proof (induct ovs)
case Nil thus ?case by simp
next
case (Cons ov ovs)
note IH = Cons(1) and pre = Cons(2) and mgp = Cons(3) and fg = Cons(4)
have uf: "u β π± f" and vf: "v β π± f" and distf: "distinct (vertices f)"
using pre by(simp add:pre_subdivFace'_def)+
note distFg = minGraphProps11'[OF mgp]
show ?case
proof (cases ov)
case None
have pre': "pre_subdivFace' g f u v (Suc n) ovs"
using None pre by (simp add: pre_subdivFace'_None)
show ?thesis using None
by (simp add: IH[OF pre' mgp fg])
next
case (Some w)
note pre = pre[simplified Some]
have uvw: "before (verticesFrom f u) v w"
using pre by(simp add:pre_subdivFace'_def)
have uw: "u β w" using pre by(clarsimp simp: pre_subdivFace'_def)
{ assume w: "f β v = w" and n: "n = 0"
have pre': "pre_subdivFace' g f u w 0 ovs"
using pre Some n using [[simp_depth_limit = 5]] by (simp add: pre_subdivFace'_Some2)
note IH[OF pre' mgp fg]
} moreover
{ let ?vs = "[countVertices g..<countVertices g + n]"
let ?fdg = "splitFace g v w f ?vs"
let ?fβ©1 = "fst ?fdg" and ?fβ©2 = "fst(snd ?fdg)" and ?g' = "snd(snd ?fdg)"
let ?g'' = "subdivFace' ?g' ?fβ©2 w 0 ovs"
let ?fvw = "between(vertices f) v w" and ?fwv = "between(vertices f) w v"
assume a: "f β v = w βΆ 0 < n"
have fsubg: "π± f β π± g"
using mgp fg by(simp add: minGraphProps_def faces_subset_def)
have pre_fdg: "pre_splitFace g v w f ?vs"
apply (rule pre_subdivFace'_preFaceDiv[OF pre fg _ fsubg])
using a by (simp)
hence "v β w" and "w β π± f" by(unfold pre_splitFace_def)simp+
have fβ©1: "?fβ©1= fst(split_face f v w ?vs)"
and fβ©2: "?fβ©2 = snd(split_face f v w ?vs)"
by(auto simp add:splitFace_def split_def)
note pre_split = pre_splitFace_pre_split_face[OF pre_fdg]
have Eβ©1: "β° ?fβ©1 = Edges (w # rev ?vs @ [v]) βͺ Edges (v # ?fvw @ [w])"
using fβ©1 by(simp add:edges_split_face1[OF pre_split])
have Eβ©2: "β° ?fβ©2 = Edges (v # ?vs @ [w]) βͺ Edges (w # ?fwv @ [v])"
by(simp add:splitFace_def split_def
edges_split_face2[OF pre_split])
note mgp' = splitFace_holds_minGraphProps[OF pre_fdg mgp]
note distFg' = minGraphProps11'[OF mgp']
have pre': "pre_subdivFace' ?g' ?fβ©2 u w 0 ovs"
by (rule pre_subdivFace'_Some1[OF pre fg _ fsubg HOL.refl HOL.refl])
(simp add:a)
note f2inF = splitFace_add_f21'[OF fg]
have 1: "βe β β° ?fβ©1. e β β° g"
proof cases
assume "rev ?vs = []"
hence "(w,v) β β° ?fβ©1 β§ (w,v) β β° g" using pre_fdg Eβ©1
by(unfold pre_splitFace_def) (auto simp:Edges_Cons)
thus ?thesis by blast
next
assume "rev ?vs β []"
then obtain x xs where rvs: "rev ?vs = x#xs"
by(auto simp only:neq_Nil_conv)
hence "(w,x) β β° ?fβ©1" using Eβ©1 by (auto simp:Edges_Cons)
moreover have "(w,x) β β° g"
proof -
have "x β set(rev ?vs)" using rvs by simp
hence "x β₯ countVertices g" by simp
hence "x β π± g" by(induct g) (simp add:vertices_graph_def)
thus ?thesis
by (auto simp:edges_graph_def)
(blast dest: in_edges_in_vertices minGraphProps9[OF mgp])
qed
ultimately show ?thesis by blast
qed
have 2: "βe β β° ?fβ©2. e β β° g"
proof cases
assume "?vs = []"
hence "(v,w) β β° ?fβ©2 β§ (v,w) β β° g" using pre_fdg Eβ©2
by(unfold pre_splitFace_def) (auto simp:Edges_Cons)
thus ?thesis by blast
next
assume "?vs β []"
then obtain x xs where vs: "?vs = x#xs"
by(auto simp only:neq_Nil_conv)
hence "(v,x) β β° ?fβ©2" using Eβ©2 by (auto simp:Edges_Cons)
moreover have "(v,x) β β° g"
proof -
have "x β set ?vs" using vs by simp
hence "x β₯ countVertices g" by simp
hence "x β π± g" by(induct g) (simp add:vertices_graph_def)
thus ?thesis
by (auto simp:edges_graph_def)
(blast dest: in_edges_in_vertices minGraphProps9[OF mgp])
qed
ultimately show ?thesis by blast
qed
have fdg: "(?fβ©1,?fβ©2,?g') = splitFace g v w f ?vs" by auto
hence Fg': "β± ?g' = {?fβ©1,?fβ©2} βͺ (β± g - {f})"
using set_faces_splitFace[OF mgp fg pre_fdg] by blast
have "βf' β β± ?g'' - (β± g - {f}). βe β β° f'. e β β° g"
proof (clarify)
fix f' assume f'g'': "f' β β± ?g''" and f'ng: "f' β β± g - {f}"
from IH[OF pre' mgp' f2inF]
show "βe β β° f'. e β β° g"
proof
assume "?g'' = makeFaceFinal ?fβ©2 ?g'"
hence "f' = setFinal ?fβ©2 β¨ f' = ?fβ©1" (is "?A β¨ ?B")
using f'g'' Fg' f'ng
by(auto simp:makeFaceFinal_def makeFaceFinalFaceList_def
distinct_set_replace[OF distFg'])
thus ?thesis
proof
assume ?A thus ?thesis using 2 by(simp)
next
assume ?B thus ?thesis using 1 by blast
qed
next
assume A: "βf' β β± ?g'' - (β± ?g' - {?fβ©2}).
βe β β° f'. e β β° ?g'"
show ?thesis
proof cases
assume "f' β {?fβ©1,?fβ©2}"
thus ?thesis using 1 2 by blast
next
assume "f' β {?fβ©1,?fβ©2}"
hence "βeββ° f'. e β β° ?g'"
using A f'g'' f'ng Fg' by simp
with splitFace_edges_incr[OF pre_fdg fdg]
show ?thesis by blast
qed
qed
qed
}
ultimately show ?thesis using Some by(auto simp: split_def)
qed
qed
lemma dist_edges_subdivFace':
"pre_subdivFace' g f u v n ovs βΉ minGraphProps g βΉ f β β± g βΉ
subdivFace' g f v n ovs = makeFaceFinal f g β¨
(βf' β β± (subdivFace' g f v n ovs) - (β± g - {f}). β° f' β β° f)"
apply(drule (2) new_edge_subdivFace')
apply(erule disjE)
apply blast
apply(rule disjI2)
apply(clarify)
apply(drule bspec)
apply fast
apply(simp add:edges_graph_def)
by(blast)
lemma between_last: "β¦ distinct(vertices f); u β π± f β§ βΉ
between (vertices f) u (last (verticesFrom f u)) =
butlast(tl(verticesFrom f u))"
apply(drule split_list)
apply (fastforce dest: last_in_set
simp: between_def verticesFrom_Def split_def
last_append butlast_append fst_splitAt_last)
done
lemma final_subdivFace': "βf u n g. minGraphProps g βΉ
pre_subdivFace' g f r u n ovs βΉ f β β± g βΉ
(ovs = [] βΆ n=0 β§ u = last(verticesFrom f r)) βΉ
βf' β set(finals(subdivFace' g f u n ovs)) - set(finals g).
(fβ-1β β r,r) β β° f' β§ |vertices f'| =
n + |ovs| + (if r=u then 1 else |between (vertices f) r u| + 2)"
proof (induct ovs)
case Nil show ?case (is "βf' β ?F. ?P f'")
proof
show "?P (setFinal f)" (is "?A β§ ?B")
proof
show "?A" using Nil
by(simp add:pre_subdivFace'_def prevVertex_in_edges
del:is_nextElem_edges_eq)
show "?B"
using Nil mgp_vertices3[OF Nil(1,3)]
by(simp add: setFinal_def between_last pre_subdivFace'_def)
qed
next
show "setFinal f β ?F" using Nil
by(simp add:pre_subdivFace'_def setFinal_notin_finals minGraphProps11')
qed
next
case (Cons ov ovs)
note IH = Cons(1) and mgp = Cons(2) and pre = Cons(3) and fg = Cons(4)
and mt = Cons(5)
have "r β π± f" and "u β π± f" and distf: "distinct (vertices f)"
using pre by(simp add:pre_subdivFace'_def)+
show ?case
proof (cases ov)
case None
have pre': "pre_subdivFace' g f r u (Suc n) ovs"
using None pre by (simp add: pre_subdivFace'_None)
have "ovs β []" using pre None by (auto simp: pre_subdivFace'_def)
thus ?thesis using None IH[OF mgp pre' fg] by simp
next
case (Some v)
note pre = pre[simplified Some]
have ruv: "before (verticesFrom f r) u v" and "r β v"
using pre by(simp add:pre_subdivFace'_def)+
show ?thesis
proof (cases "f β u = v β§ n = 0")
case True
have pre': "pre_subdivFace' g f r v 0 ovs"
using pre True using [[simp_depth_limit = 5]] by (simp add: pre_subdivFace'_Some2)
have mt: "ovs = [] βΆ 0 = 0 β§ v = last (verticesFrom f r)"
using pre by(clarsimp simp:pre_subdivFace'_def)
show ?thesis using Some True IH[OF mgp pre' fg mt] βΉr β vβΊ
by(auto simp: between_next_empty[OF distf]
unroll_between_next2[OF distf βΉr β π± fβΊ βΉu β π± fβΊ])
next
case False
let ?vs = "[countVertices g..<countVertices g + n]"
let ?fdg = "splitFace g u v f ?vs"
let ?g' = "snd(snd ?fdg)" and ?fβ©2 = "fst(snd ?fdg)"
let ?fvu = "between (vertices f) v u"
have False': "f β u = v βΆ n β 0" using False by auto
have VfVg: "π± f β π± g" using mgp fg
by (simp add: minGraphProps_def faces_subset_def)
note pre_fdg = pre_subdivFace'_preFaceDiv[OF pre fg False' VfVg]
hence "u β v" and "v β π± f" and disj: "π± f β© set ?vs = {}"
by(unfold pre_splitFace_def)simp+
hence vvs: "v β set ?vs" by auto
have vfβ©2: "vertices ?fβ©2 = [v] @ ?fvu @ u # ?vs"
by(simp add:split_face_def splitFace_def split_def)
hence betuvfβ©2: "between (vertices ?fβ©2) u v = ?vs"
using splitFace_distinct1[OF pre_fdg]
by(simp add: between_back)
have betrvfβ©2: "r β u βΉ between (vertices ?fβ©2) r v =
between (vertices f) r u @ [u] @ ?vs"
proof -
assume "rβ u"
have r: "r β set (between (vertices f) v u)"
using βΉrβ uβΊ βΉrβ vβΊ βΉuβ vβΊ βΉv β π± fβΊ βΉr β π± fβΊ distf ruv
by(blast intro:rotate_before_vFrom before_between)
have "between (vertices f) v u =
between (vertices f) v r @ [r] @ between (vertices f) r u"
using split_between[OF distf βΉv β π± fβΊ βΉu β π± fβΊ r] βΉrβ vβΊ
by simp
moreover hence "v β set (between (vertices f) r u)"
using between_not_r1[OF distf, of v u] by simp
ultimately show ?thesis using vfβ©2 βΉrβ vβΊ βΉuβ vβΊ vvs
by (simp add: between_back between_not_r2[OF distf])
qed
note mgp' = splitFace_holds_minGraphProps[OF pre_fdg mgp]
note f2g = splitFace_add_f21'[OF fg]
note pre' = pre_subdivFace'_Some1[OF pre fg False' VfVg HOL.refl HOL.refl]
from pre_fdg have "v β π± f" and disj: "π± f β© set ?vs = {}"
by(unfold pre_splitFace_def, simp)+
have fr: "?fβ©2β-1β β r = fβ-1β β r"
proof -
note pre_split = pre_splitFace_pre_split_face[OF pre_fdg]
have rinfβ©2: "r β π± ?fβ©2"
proof cases
assume "r = u" thus ?thesis by(simp add:vfβ©2)
next
assume "r β u"
hence "r β set ?fvu" using distf βΉv : π± fβΊ βΉrβ vβΊ βΉr : π± fβΊ ruv
by(blast intro: before_between rotate_before_vFrom)
thus ?thesis by(simp add:vfβ©2)
qed
have Eβ©2: "β° ?fβ©2 = Edges (u # ?vs @ [v]) βͺ
Edges (v # ?fvu @ [u])"
by(simp add:splitFace_def split_def
edges_split_face2[OF pre_split])
moreover have "(?fβ©2β-1β β r, r) β β° ?fβ©2"
by(blast intro: prevVertex_in_edges rinfβ©2
splitFace_distinct1[OF pre_fdg])
moreover have "(?fβ©2β-1β β r, r) β Edges (u # ?vs @ [v])"
proof -
have "r β set ?vs" using βΉr : π± fβΊ disj by blast
thus ?thesis using βΉr β vβΊ
by(simp add:Edges_Cons Edges_append notinset_notinEdge2) arith
qed
ultimately have "(?fβ©2β-1β β r, r) β Edges (v # ?fvu @ [u])" by blast
hence "(?fβ©2β-1β β r, r) β β° f" using pre_split_face_symI[OF pre_split]
by(blast intro: Edges_between_edges)
hence eq: "f β (?fβ©2β-1β β r) = r" and inf: "?fβ©2β-1β β r β π± f"
by(simp add:edges_face_eq)+
have "?fβ©2β-1β β r = fβ-1β β (f β (?fβ©2β-1β β r))"
using prevVertex_nextVertex[OF distf inf] by simp
also have "β¦ = fβ-1β β r" using eq by simp
finally show ?thesis .
qed
hence mt: "ovs = [] βΆ 0 = 0 β§ v = last (verticesFrom ?fβ©2 r)"
using pre' pre by(auto simp:pre_subdivFace'_def splitFace_def
split_def last_vFrom)
from IH[OF mgp' pre' f2g mt] βΉr β vβΊ obtain f' :: face where
f: "f' β set(finals(subdivFace' ?g' ?fβ©2 v 0 ovs)) - set(finals ?g')"
and ff: "(?fβ©2β-1β β r, r) β β° f'"
"|vertices f'| = |ovs| + |between (vertices ?fβ©2) r v| + 2"
by simp blast
show ?thesis (is "βf' β ?F. ?P f'")
proof
show "f' β ?F" using f pre Some fg
by(simp add:False split_def pre_subdivFace'_def)
show "?P f'" using ff fr by(clarsimp simp:betuvfβ©2 betrvfβ©2)
qed
qed
qed
qed
lemma Seed_max_final_ex:
"βfβset (finals (Seed p)). |vertices f| = maxGon p"
by (simp add: Seed_def graph_max_final_ex)
lemma max_face_ex: assumes a: "Seedβpβ [next_plane0βpβ]β* g"
shows "βf β set (finals g). |vertices f| = maxGon p"
using a
proof (induct rule: RTranCl_induct)
case refl then show ?case using Seed_max_final_ex by simp
next
case (succs g g')
then obtain f where f: "fβset (finals g)" and "|vertices f| = maxGon p"
by auto
moreover from succs(1) f have "fβset (finals g')" by (rule next_plane0_finals_incr)
ultimately show ?case by auto
qed
end