| nil : Arches [] []
| skip (a : α) {l E} : Arches l E→Arches (a :: l) E
| pair (a b : α) {LREF} : ArchesLE→ArchesRF→Arches (a :: (L ++ b :: R)) ((a,b) :: (E ++ F))
lemmaArches.endpoints {l : List α} {E} (h : Arches l E) :
∀ e ∈E, e.1∈ l ∧ e.2∈ l :=by
proof · 13
lines
induction h with
| nil => simp
| skip a h ih =>
intro e he
exact ⟨List.mem_cons_of_mem _ (ih e he).1,List.mem_cons_of_mem _ (ih e he).2⟩
| pair a b hL hR ihL ihR =>
intro e he
rcases List.mem_cons.mp he with he | he
· subst e
simp
· rcases List.mem_append.mp he with he | he
· exact ⟨by simp [(ihL e he).1],by simp [(ihL e he).2]⟩
· exact ⟨by simp [(ihR e he).1],by simp [(ihR e he).2]⟩
lemmaturns_fixed (E : List (α × α)) {x : α}
(hx : ∀ e ∈E, x ≠ e.1∧ x ≠ e.2) : turns E x = x :=by
proof · 6
lines
induction Ewith
| nil => rfl
| cons e E ih =>
rw [turns_cons,mul_apply,swap_apply_of_ne_of_ne (hx e List.mem_cons_self).1
(hx e List.mem_cons_self).2]
exact ih (fun e he => hx e (List.mem_cons_of_mem _ he))
lemmacut_local_action (p : Perm α) (a b : α) (LR : List α)
(hn : ((a :: L) ++ (b :: R)).Nodup)
(hp : ∀ x ∈ (a :: L) ++ (b :: R), p x = ((a :: L) ++ (b :: R)).formPerm x) :
(∀ x ∈a :: L, (swap a b * p) x = (a :: L).formPerm x) ∧
(∀ x ∈b :: R, (swap a b * p) x = (b :: R).formPerm x) :=by
proof · 14
lines
havehd : List.Disjoint (a :: L) (b :: R) :=List.disjoint_iff_ne.mpr (List.nodup_append.mp hn).2.2
constructor
· intro x hx
havehxr : x ∉b :: R:=fun hh =>List.disjoint_left.mp hd hx hh
have hh := congrArg (funu : Perm α => u x) (swap_mul_formPerm_cut a b LR hn)
simpa only [mul_apply,hp x (List.mem_append_left _ hx),List.cons_append,
List.formPerm_apply_of_notMem hxr] using hh
· intro x hx
havehxl : (b :: R).formPerm x ∉a :: L:=fun hh =>List.disjoint_left.mp hd hh (List.formPerm_apply_mem_of_mem hx)
have hh := congrArg (funu : Perm α => u x) (swap_mul_formPerm_cut a b LR hn)
simpa only [mul_apply,hp x (List.mem_append_right _ hx),List.cons_append,
List.formPerm_apply_of_notMem hxl] using hh
Stack/noncrossing chords attain the maximum possible cycle count.
The unused initial string is arbitrary, so this also handles skipped darts
and the end/start seam of a rooted tour.
theoremArches.card_orbits_turns [Fintype α] {l : List α} {E}
(h : Arches l E) (Z : List α) (p : Perm α)
(hn : (Z ++ l).Nodup)
(hp : ∀ x ∈Z ++ l, p x = (Z ++ l).formPerm x) :
Nat.card (Orbits (turns E * p)) = Nat.card (Orbits p) + E.length :=by
proof · 50
lines
induction h generalizing Z p with
| nil => simp
| @skip a l E h ih =>havehe : Z ++ a :: l = (Z ++ [a]) ++ l :=by simp
exact ih (Z ++ [a]) p (he ▸ hn) (by simpa only [he] using hp)
| @pair a b LREF hL hR ihL ihR =>letC:= (a :: L) ++ (b :: (R ++ Z))
havehC : C.Nodup:=by
change ((a :: L) ++ (b :: (R ++ Z))).Nodup
simpa only [List.cons_append,List.append_assoc] using
(List.nodup_append_comm.mp hn)
havehe : (Z ++ a :: (L ++ b :: R)).formPerm = C.formPerm :=by
rw [formPerm_append_comm _ _ hn]
simp only [C,List.cons_append,List.append_assoc]
have hpC (x : α) (hx : x ∈C) : p x = C.formPerm x :=by
rw [← he]
apply hp
simpa only [C,List.mem_append,List.mem_cons,or_assoc,or_comm,or_left_comm] using hx
havehab : a ≠ b :=fun h => hC.notMem (by simp [h])
havehsame : p.SameCycle a b := sameCycle_of_list p hC hpC (by simp [C]) (by simp [C])
have hzero := card_orbits_swap_of_sameCycle p hab hsame
have hcut := cut_local_action p a b L (R ++ Z) hC hpC
havehnL : ([a] ++ L).Nodup:= (List.nodup_append.mp hC).1have hE := ihL [a] (swap a b * p) hnL hcut.1havehnR : ((Z ++ [b]) ++ R).Nodup:=byhave ht := (List.nodup_append.mp hC).2.1havehh : (b :: (R ++ Z)) = (b :: R) ++ Z:=by simp
rw [hh] at ht
simpa only [List.append_assoc,List.singleton_append] using
(List.nodup_append_comm.mp ht)
have hother (x : α) (hx : x ∈ (Z ++ [b]) ++ R) :
(turns E * (swap a b * p)) x = ((Z ++ [b]) ++ R).formPerm x :=byhavehxR : x ∈b :: (R ++ Z) :=by
simpa only [List.mem_append,List.mem_cons,List.mem_singleton,List.not_mem_nil,or_false,false_or,or_assoc,or_comm,
or_left_comm] using hx
have hpx := hcut.2 x hxR
havehpxR : (swap a b * p) x ∈b :: (R ++ Z) :=by
rw [hpx]; exact List.formPerm_apply_mem_of_mem hxR
have hnLR := (List.nodup_append.mp hC).2.2havehnot : (swap a b * p) x ∉L:=fun hh =>
hnLR _ (List.mem_cons_of_mem _ hh) _ hpxR rfl
rw [mul_apply,hL.turns_fixed hnot,hpx]
haveht : (Z ++ (b :: R)).Nodup:=by simpa using hnR
have hh := formPerm_append_comm Z (b :: R) ht
simpa only [List.append_assoc,List.singleton_append,List.cons_append,List.nil_append] using
(congrArg (funu : Perm α => u x) hh).symm
have hF := ihR (Z ++ [b]) (turns E * (swap a b * p)) hnR hother
simp only [turns_cons,turns_append,List.length_cons,List.length_append]
rw [mul_assoc,mul_assoc,hF,hE,hzero]
omega
lemmaArches.append {l r : List α} {EF : List (α×α)}
(h : Arches l E) (h' : Arches r F) : Arches (l++r) (E++F) :=by
proof · 5
lines
induction h with
| nil => simpa using h'
| skip a h ih => simpa usingArches.skip a ih
| pair a b hL hR ihL ihR =>
simpa only [List.cons_append,List.append_assoc] usingArches.pair a b hL ihR
lemmacons_sublist_split {a : α} {l r : List α} (h : a::l<+r) :
∃ s t,r=s++a::t ∧ l<+t :=by
proof · 8
lines
induction r with
| nil => simp at h
| cons b r ih =>
cases h with
| cons _ h =>
obtain ⟨s,t,rfl,ht⟩ := ih h
exact ⟨b::s,t,rfl,ht⟩
| cons_cons _ h => exact ⟨[],r,rfl,h⟩
lemmaArches.mono {l r : List α} {E : List (α×α)} (h : Arches l E)
(hlr : l<+r) : Arches r E:=by
proof · 11
lines
induction h generalizing r with
| nil => exact Arches.empty r
| skip a h ih => exact ih (List.sublist_of_cons_sublist hlr)
| pair a b hL hR ihL ihR =>
obtain ⟨S,T,rfl,hT⟩ := cons_sublist_split hlr
obtain ⟨U,V,rfl,hU,hV⟩ :=List.append_sublist_iff.mp hT
obtain ⟨Q,R,rfl,hR'⟩ := cons_sublist_split hV
have hu := (ihL hU).append (Arches.empty Q)
have hp :=Arches.pair a b (by simpa using hu) (ihR hR')
have hf := (Arches.empty S).append hp
simpa only [List.nil_append,List.append_nil,List.append_assoc] using hf
Flatten the pair endpoints without imposing an artificial pair order.
lemmaendpoints_append (EF : List (α×α)) : endpoints (E++F)=endpoints E++endpoints F:=by
proof · 1
line
simp [endpoints]
Every Dyck path, on an arbitrary ordered list of positions, has a complete
noncrossing arch pairing. This is a constructive existence statement, not a
planarity assumption on a map.
theoremdyck_arches (p : DyckWord) (l : List α) (f : α→DyckStep)
(hl : l.map f=p.toList) :
∃E : List (α×α), Arches l E∧ (endpoints E).Perm l ∧∀ e∈E,f e.1=.U∧ f e.2=.D:=by
proof · 53
lines
induction hp : p.semilength usingNat.strong_induction_on generalizing p l with
| h n ih =>by_cases hz : p=0
· subst p
havehm : l.map f=[] := hl
havehn : l=[] :=List.map_eq_nil_iff.mp hm
subst l
exact ⟨[],.nil,.refl _,by simp⟩
· have hdec := p.nest_insidePart_add_outsidePart hz
havehe : p.toList = DyckStep.U::(p.insidePart.toList++DyckStep.D::p.outsidePart.toList) :=byhave hh := (congrArg DyckWord.toList hdec).symm
change p.toList = ([DyckStep.U]++p.insidePart.toList++[DyckStep.D])++p.outsidePart.toList at hh
simpa only [List.append_assoc,List.singleton_append,List.cons_append,List.nil_append] using hh
cases l with
| nil => rw [he] at hl; simp at hl
| cons a l =>
rw [he,List.map_cons,List.cons.injEq] at hl
obtain ⟨ha,hl⟩ := hl
havehlen : p.insidePart.toList.length<l.length :=byhave hc := congrArg List.length hl
simp only [List.length_map,List.length_append,List.length_cons] at hc
omega
let j := p.insidePart.toList.length
letL:= l.take j
let b := l[j]
letR:= l.drop (j+1)
havehl' : l=L++b::R:=by
dsimp [L,b,R,j]
rw [←List.drop_eq_getElem_cons hlen,List.take_append_drop]
havehL : L.map f=p.insidePart.toList :=by
dsimp [L,j]
rw [List.map_take,hl,List.take_append_of_le_length (by rfl)]
simp
havehBR : (b::R).map f=DyckStep.D::p.outsidePart.toList :=by
rw [hl',List.map_append,hL] at hl
exact List.append_cancel_left hl
simp only [List.map_cons,List.cons.injEq] at hBR
obtain ⟨hb,hR⟩ := hBR
obtain ⟨E,hE,hEp,hEf⟩ := ih p.insidePart.semilength
(by rw [← hp]; exact p.semilength_insidePart_lt hz) _ _ hL rfl
obtain ⟨F,hF,hFp,hFf⟩ := ih p.outsidePart.semilength
(by rw [← hp]; exact p.semilength_outsidePart_lt hz) _ _ hR rfl
refine ⟨(a,b)::(E++F),?_,?_,?_⟩
· rw [hl']; exact Arches.pair a b hE hF
· rw [endpoints_cons,endpoints_append,hl']
have hh := hEp.append hFp
exact (hh.cons b |>.cons a).trans (List.Perm.cons a (List.perm_middle.symm))
· intro e he
rcases List.mem_cons.mp he with rfl | he
· exact ⟨ha,hb⟩
· rcases List.mem_append.mp he with he | he
· exact hEf e he
· exact hFf e he
lemmaturns_sublist_apply {EF : List (α×α)} (hn : (endpoints F).Nodup)
(hEF : E<+F) {x : α} (hx : x∈endpoints E) : turns E x=turns F x :=by
proof · 5
lines
havehs : (endpoints E)<+(endpoints F) := hEF.flatMap _
have he := hn.sublist hs
obtain ⟨e,he',rfl|rfl⟩ := mem_endpoints.mp hx
· rw [(turns_pair he e he').1,(turns_pair hn e (hEF.subset he')).1]
· rw [(turns_pair he e he').2,(turns_pair hn e (hEF.subset he')).2]