Common path-table scripts. The prefix of the digit stream attached
to an endpoint will be assembled with repeated stationary queries from
the initiation. use steps=0 for the plain cap kernel.
let (q,o,s,i):=a
let v:=Jet.cap s
let t:=aft s
let α:=p.journey x (q,t)
letH:= hint α v
let work :=fun z=> going o (Jet.tug t z) + 1ifJet.band v=0then (1,p.ask.f x (α,Jet.port v), if i=0then0else work (Jet.jik v 1 i 0))
elseifJet.band v=1then (2,p.before.f x H,work (Jet.jik v 2 (Jet.rune v) i))
elseifJet.band v=2thenif p.haskid.f x Hthen
purec (going o (Jet.tug (Jet.tug t (Jet.turn v 3)) (p.readyJ x (p.other.f x H,p.passp.f x H)))+1)
else purec (work (Jet.turn v 4))
elseifJet.band v=4then (2,p.knot.f x H,work (Jet.turn v 5))
elseifJet.band v=5thenif t≤1then purec (done o+1)
else purec (going o (Jet.tug (aft t) (Jet.turn (Jet.cap t) 4))+1)
else purec 0
let (q,v,h):=a
let (b,o,i,w):=v
if b=0then purec (if o<p.ports.f x q then tell o 01+1else0)
elseif b=1thenif i<p.steps.f x q then (1,p.dress.f x (q,o,i),tell o (i+1) (cord h w)+1)
elselet z:=p.scent.f x (q,w)
purec (going z (Jet.tug 1 (p.readyJ x (p.alpha.f x q,o)))+1)
elseif b=2then p.inprog x (q,o,w,h)
else purec 0
⟨⟨fun x a=> (p.reader x a).1, p.readerK.left⟩,⟨fun x a=> (p.reader x a).2.1, p.readerK.right.left⟩,
⟨fun x a=> (p.loom x a).2.2,p.loomK.right.right⟩,
⟨_,peelK⟩,⟨_,p.stripeK⟩⟩
Settings for local correctness at a contour invocation.
lemmateam {v i w j} (h:u.Tidy) (hv:u.Cush v i) (hw:u.Cush w j) (hi:i≤u.H+u.B.w+1)
(hj:j≤u.H+u.B.w+1)(he:i≤4*j) (hf:j≤4*i):
Mill.fitting u.p u.s v w := ⟨u.prepaid h hv hi,u.prepaid h hw hj,u.team0 h hv hw he,u.team0 h hw hv hf⟩
lemmachain_size {p c} (h:u.Tidy)(e:u.Gown p c){i}(hi:i≤u.H) :
i+1≤ lb (u.chainR p c i) ∧ lb (u.chainR p c i) ≤1+3*u.k*i ∧1≤u.chainR p c i:=by
proof · 10
lines
induction i with
| zero=>change 0+1≤lb 1∧ lb 1≤_ ∧1≤1; rw [lb_one]; omega
| succ i ih=>
rw [u.chain_next]; obtain ⟨ha,hb,hc⟩:=ih (by omega)
have hz:=lb_cord (u.s.echo (u.garnish p i) c) _ hc
rw [hz]
have hw:= lb_pos (u.s.echo (u.garnish p i) c)
have hk:= e.lens i hi
have hf:= h.gain
refine ⟨by omega,by nlinarith,(cord_fine ..).2.2.le⟩
lemmaprepared {p c}(h:u.Tidy) (g:u.Gown p c)(he:c∈u.s.domain):
u.Track (prime p,c) (tell p u.H (u.chainR p c u.H),c):=by
proof · 25
lines
havee0: u.Cr (prime p,c) (tell p 01,c):=byhave hk0 := u.pointing h g (Nat.zero_le _)
change u.Cush (tell p 01) (0+1) at hk0
apply u.p.meets0 u.s h.reserve
(u.team h (u.capPrime h g.lengthp) hk0 (by omega) (by omega) (by omega) (by omega)) _ _ he
· rw [u.deco]; rfl
rw [u.stable]; simp [Aq,Bow.air,g.known,Bow.purec]
sufficesh:∀ i≤ u.H,u.Track (prime p,c) (tell p i (u.chainR p c i),c) by exact h _ le_rfl
intro i hi
induction i with
| zero=> exact Relation.ReflTransGen.single e0
| succ i ih=>
apply Relation.ReflTransGen.tail (ih (by omega))
have hz:=u.pointing h g (show i≤u.Hby omega); let w:=tell p i (u.chainR p c i)
havehi': i < u.b.steps.f u.x0 u.q:=hi
havehp0:u.p.slipk u.s w=u.garnish p i:=by unfold w; rw [u.tripk]; simp [Aq,Bow.air,hi',garnish]
apply u.p.meets1 u.s h.reserve (u.team h hz (u.pointing h g hi) (by omega) (by omega) (by omega) (by omega)) _ _ _ he
· rw [u.deco]; simp [Aq,Bow.air,hi']
· have hx:=hp0; unfold w at hx
rw [hx,u.stable]
simp [Aq,Bow.air,hi',u.chain_next]
· obtain ⟨ha,hb,hc⟩:= g.law0 i hi
change u.p.afoot u.s w
unfold Mill.afoot; rw [hp0]
exact ⟨hc,u.score_pay h hz ha hb⟩
insured : a≤u.ceiling
positive : 1≤u.grit a
reach : u.grit a ≤ u.bulk a
littleR : u.little a (u.fill a p)
get : u.v.tap.f u.x0 (u.hear a p)=trueheat : u.calm a (u.hear a p)
before0 : u.little a (u.kidJ a p h 01)
passed : ∀ i ≤5, u.little a (u.kidJ a p h e i)
forward0 : u.Orders a (u.callB a p h) e
post : u.Orders a (u.callP a p h) 0
canonical path selection supplies a coherent and costed path, not just a
validity bit.
hr : u.Rating a p
kin : u.Bolts a p h e
hx : c∈u.s.domain
hz : z∈u.s.domain
hy : y∈u.s.domain
hw : w∈u.s.domain
chosen : u.s.echo (u.hear a p) c=h
extant : h≠0peak : u.s.stream (u.callB a p h) e true c=some z
erode : u.s.stream (u.callP a p h) 0true y=some w
| solo {a p h e c z w} (h0:u.Chess a p h e c z z w) (hd:u.dives a p h=false):
Herd a p c h e w
| pair {a p h e c z y w f g} (hr:u.Chess a p h e c z y w) (hv:u.dives a p h=true)
(hd:u.bulk (u.lower a p h)+u.grit a ≤ u.bulk a)
(hy:u.grit (u.lower a p h) ≤2*u.grit a)
(he:Herd (u.lower a p h) (u.portD a p h) z f g y):
Herd a p c h e w
lemmaHerd.on {u:Quill} {a p c h e w} (hh:u.Herd a p c h e w) :
u.Rating a p ∧ u.Bolts a p h e:=by cases hh with | solo h0 _=> exact ⟨h0.hr,h0.kin⟩ | pair hr _ _ _ _=>exact ⟨hr.hr,hr.kin⟩
| dry (hr:u.Rating a p) (hc:c∈u.s.domain) (hh:u.s.echo (u.hear a p) c=0) :
Lane a p c none
| born {h e w} (hs:u.Herd a p c h e w) : Lane a p c (some w)
lemmacoal {l a m p o f} (h:u.Tidy)(hx:u.Rating a p)(hh:u.Course l a m)
(hv:u.little a f)(hz:u.Stringent o):
u.Cush (cart o l f) (u.H+(m+u.grit a)+1) :=by
proof · 5
lines
apply inProgG u h hz.1 hz.2
· rw [wagon, measure_mesh]; have:= hv.1; have:= hh.room0; omega
· rw [wagon, measure_mesh]; have:= hv.2; have:= hh.room1
have he:=hx.positive; have hp:=h.gain
nlinarith
lemmagoto {l a m p h t} {f:Jet} (ht:u.Tidy)(hp:u.Rating a p)
(hz:u.Course l a m) (hy:u.Rating (u.lower a p h) t)
(he:u.bulk (u.lower a p h)+u.grit a ≤ u.bulk a)
(hi:u.little a f) (hh:Jet.rune f=h)(hk:Jet.port f=p):
u.Course (enc f::l) (u.lower a p h) (m+u.grit a) :=by
proof · 8
lines
obtain ⟨h1,h2,h3,h4⟩:=hz
refine ⟨by omega,?_,?_,?_⟩
· rw [measure_mesh]; have hz:=hi.1; omega
· rw [measure_mesh]; have hz:=hi.2; have hg:=ht.gain; have hh:=hp.positive
nlinarith
rw [List.reverse_cons]
exact Grid.Scan.snatch h4 (by
simp [Bow.along,Bow.hint,hk,hh,lower,tagH]) hy.insured
lemmaprice1 {l a m p t} (hx:u.Rating a p)(hh:u.Course l a m) (hz:u.calm a t) :
u.v.depth.f u.x0 t+1≤u.B.w ∧
u.H+(m+u.grit a)+1≤ u.H+(u.B.w-u.v.depth.f u.x0 t)+1:=by
proof · 1
line
have he:=hx.positive; have hv:=hh.dimensional; have ha:=hz.2; omega
lemmatimeok {t l a m p f o} (h:u.Tidy)(hx:u.Rating a p)(he:u.Course l a m)
(hy:u.little a f) (ho:u.Stringent o)
(hh:u.calm a t): Mill.faith u.p u.s (cart o l f) t :=
proof · 2
lines
let hz:=u.price1 hx he hh
u.structure_pay h (u.coal h hx he hy ho) hz.2 hz.1 hh.1
lemmaresultv {l o i f m a} (he:u.Course l a m):
u.b.loom u.x0 (u.q,cart o l f,i) =
let t:=mesh l
proof · 19
lines
let v:=f
let α:=a
let _:=u.q
let x:=u.x0
letH:=Bow.hint α v
let p:=u.b
let work :=fun z=> going o (Jet.tug t z)+1ifJet.band v=0then (1,p.ask.f x (α,Jet.port v), if i=0then0else work (Jet.jik v 1 i 0))
elseifJet.band v=1then (2,p.before.f x H,work (Jet.jik v 2 (Jet.rune v) i))
elseifJet.band v=2thenif p.haskid.f x HthenBow.purec (going o (Jet.tug (Jet.tug t (Jet.turn v 3)) (p.readyJ x (p.other.f x H,p.passp.f x H)))+1)
elseBow.purec (work (Jet.turn v 4))
elseifJet.band v=4then (2,p.knot.f x H,work (Jet.turn v 5))
elseifJet.band v=5thenif t≤1thenBow.purec (done o+1)
elseBow.purec (going o (Jet.tug (aft t) (Jet.turn (Jet.cap t) 4))+1)
elseBow.purec 0:=by
rw [u.ae]; simp only [Bow.inprog,wagon_eq,Jet.cap_tug,Jet.aft_tug,u.aloft he]
lemmataking {l a m p o v w}(ht:u.Tidy)(hp:u.Rating a p)
(hx:u.Course l a m)(hy:u.Stringent o) (hz:u.little a v)(hh:u.little a w):
Mill.fitting u.p u.s (cart o l v) (cart o l w):=
proof · 1
line
u.team ht (u.coal ht hp hx hz hy) (u.coal ht hp hx hh hy) (u.rag hp hx) (u.rag hp hx) (by omega) (by omega)
lemmaore0 {l a m} (hp:u.Course l a m) (o p i:ℕ):
u.b.loom u.x0 (u.q,cart o l (u.fill a p),i)=
(1,u.hear a p,if i=0then0else future1 o l (u.kidJ a p i 01)):=by
proof · 1
line
rw [u.resultv hp]; simp only [Jet.band,fill,Bow.readyJ,ite_true]; rfl
lemmaore1 {l a m} (hp:u.Course l a m) (o p h i:ℕ):
u.b.loom u.x0 (u.q,cart o l (u.kidJ a p h 01),i)=
(2,u.callB a p h, future1 o l (u.kidJ a p h i 2)):=by
proof · 1
line
rw [u.resultv hp]; simp only [kidJ,Jet.band,Jet.jik,OfNat.one_ne_ofNat,one_ne_zero,ite_false,ite_true]; rfl
lemmaore4 {l a m} (hp:u.Course l a m) (o p h e i:ℕ):
u.b.loom u.x0 (u.q,cart o l (u.kidJ a p h e 4),i)=
(2,u.callP a p h, future1 o l (u.kidJ a p h e 5)):=by
lemmafirst0 {l a m p o c} (_:u.Tidy)(_:u.Rating a p)(hc:u.Course l a m)(_:u.Stringent o)
(he:u.s.echo (u.hear a p) c=0):
u.p.mate u.s (cart o l (u.fill a p),c):=by
proof · 7
lines
apply u.p.cinder1
· exact congrArg Prod.fst (u.ore0 hc o p 0)
intro i
havehS: u.p.slipk u.s (cart o l (u.fill a p))=u.hear a p:=
congrArg (fun x=> x.2.1) (u.ore0 hc o p 0)
rw [hS,he]
exact congrArg (fun x=>x.2.2) (u.ore0 hc o p 0)
lemmahelm {l a m p o h e c z y w} (ht:u.Tidy)(hp:u.Chess a p h e c z y w)
(hx:u.Course l a m)(ho:u.Stringent o):
u.Cr (cart o l (u.fill a p),c) (cart o l (u.kidJ a p h 01),c):=by
proof · 10
lines
let v:=cart o l (u.fill a p)
have h1:=u.ore0 hx o p
havehs:u.p.slipk u.s v=u.hear a p:=congrArg (fun x=>x.2.1) (h1 0)
change u.Cr (v,c) _
apply u.p.meets1 u.s ht.reserve (u.taking ht hp.hr hx ho hp.hr.littleR hp.kin.before0) ?_ ?_ ?_ hp.hx
· exact congrArg Prod.fst (h1 0)
· rw [hs,hp.chosen]
exact (congrArg (fun x=>x.2.2) (h1 h)).trans (ite_eq_right hp.extant)
unfold Mill.afoot; rw [hs]
exact ⟨hp.hr.get, u.timeok ht hp.hr hx hp.hr.littleR ho hp.hr.heat⟩
lemmaswift0 {l a m p f o t r} (ht:u.Tidy)(hr:u.Rating a p)
(hx:u.Course l a m) (hv:u.little a f) (ho:u.Stringent o)
(he:u.p.slipk u.s (cart o l f)=t)(h:u.Orders a t r):
u.p.swift u.s (cart o l f) r:=by
lemmaprowl {l a m p o h e c z y w} (ht:u.Tidy)(hp:u.Chess a p h e c z y w)
(hx:u.Course l a m)(ho:u.Stringent o):
u.Cr (cart o l (u.kidJ a p h 01),c) (cart o l (u.kidJ a p h e 2),z):=by
proof · 9
lines
let f:=u.kidJ a p h 01let v:=cart o l f; have hq:=u.ore1 hx o p h
havehs:u.p.slipk u.s v=u.callB a p h:=congrArg (fun x=>x.2.1) (hq 0)
change u.Cr (v,c) _
apply u.p.meets2 u.s ht.reserve (u.taking ht hp.hr hx ho hp.kin.before0 (hp.kin.passed 2 (by omega)))
(congrArg Prod.fst (hq 0)) (u.pairTok2 ..).symm (congrArg (fun x=>x.2.2) (hq e))
(u.swift0 ht hp.hr hx hp.kin.before0 ho hs hp.kin.forward0) hp.hx hp.hz
rw [hs]
exact hp.peak
lemmashiver {l a m p o h e c z y w} (ht:u.Tidy)(hp:u.Chess a p h e c z y w)
(hx:u.Course l a m)(ho:u.Stringent o):
u.Cr (cart o l (u.kidJ a p h e 4),y) (cart o l (u.kidJ a p h e 5),w):=by
proof · 8
lines
let f:=u.kidJ a p h e 4; let v:=cart o l f; have hq:=u.ore4 hx o p h e
havehs:u.p.slipk u.s v=u.callP a p h:=congrArg (fun x=>x.2.1) (hq 0)
change u.Cr (v,y) _
apply u.p.meets2 u.s ht.reserve
(u.taking ht hp.hr hx ho (hp.kin.passed 4 (by omega)) (hp.kin.passed 5 (by omega)))
(congrArg Prod.fst (hq 0)) (u.pairTok5 ..).symm (congrArg (fun x=>x.2.2) (hq 0))
(u.swift0 ht hp.hr hx (hp.kin.passed 4 (by omega)) ho hs hp.kin.post) hp.hy hp.hw
rw [hs]; exact hp.erode
lemmaore2 {l a m} (hp:u.Course l a m) (o p h e i:ℕ):
u.b.loom u.x0 (u.q,cart o l (u.kidJ a p h e 2),i)=
if u.dives a p h thenBow.purec (future1 o (nextJ u a p h e::l) (u.fill (u.lower a p h) (u.portD a p h)))
elseBow.purec (future1 o l (u.kidJ a p h e 4)):=by
lemmadownfit {l S a m alpha p p' o v w}(ht:u.Tidy)(hp:u.Rating a p)
(hx:u.Course l a m)(hy:u.Stringent o) (hz:u.little a v)
(hr:u.Rating alpha p')(hk:u.CourseS alpha (m+u.grit a))
(hm:u.little alpha w) (hh:u.grit alpha ≤2*u.grit a):
Mill.fitting u.p u.s (cart o l v) (cart o S w) :=
proof · 2
lines
u.team ht (u.coal ht hp hx hz hy) (u.coal ht hr hk hm hy) (u.rag hp hx) (u.rag hr hk)
(by omega) (by omega)
lemmapop5 {l f a m} (hp:u.Course (enc f::l) a m)
(o p h g i:ℕ): u.b.loom u.x0 (u.q,cart o (enc f::l) (u.kidJ a p h g 5),i)=
Bow.purec (future1 o l (Jet.turn f 4)) :=by
lemmapopped_only {a} (hp:u.Course [] a 0) (o p h g):
u.b.loom u.x0 (u.q,cart o [] (u.kidJ a p h g 5),0)=Bow.purec (done o+1):=by rw [u.resultv hp]; rfl
lemmaflagdown {l a m p h e o c z y w}(ht:u.Tidy)(hp:u.Chess a p h e c z y w)
(hx:u.Course l a m) (ho:u.Stringent o) (hy:u.dives a p h=false):
u.Cr (cart o l (u.kidJ a p h e 2),z) (cart o l (u.kidJ a p h e 4),z):=
proof · 2
lines
u.blink0 ht ((u.ore2 hx o p h e 0).trans (ite_eq_right (by simp [hy])))
(u.taking ht hp.hr hx ho (hp.kin.passed 2 (by omega)) (hp.kin.passed 4 (by omega))) hp.hz
lemmaladder {a m p l o h e c w} (ht:u.Tidy) (hp:u.Herd a p c h e w)
(hx:u.Course l a m) (ho:u.Stringent o):
u.Track (cart o l (u.fill a p),c) (cart o l (u.kidJ a p h e 5),w) :=by
proof · 21
lines
induction hp generalizing l m with
| solo hr h1=>
exact ReflTransGen.tail (.tail (.tail (.single (u.helm ht hr hx ho)) (u.prowl ht hr hx ho))
(u.flagdown ht hr hx ho h1)) (u.shiver ht hr hx ho)
| @pair a p h e c z y w f g hr hv hd hy he ih=>letS:=nextJ u a p h e :: l
obtain ⟨hf,hh⟩:=he.on
havehy' : u.CourseS (u.lower a p h) (m+u.grit a) :=
u.goto ht hr.hr hx hf hd (hr.kin.passed 3 (by omega)) rfl rfl
have ht1:= ih hy'
have hu0:= u.ore2 hx o p h e 0have hs:= u.downfit ht hr.hr hx ho (hr.kin.passed 2 (by omega)) hf hy' hf.littleR hy
have hs2:= u.downfit ht hr.hr hx ho (hr.kin.passed 4 (by omega)) hf hy' (hh.passed 5 (by omega)) hy
havehp1: u.Cr (cart o l (u.kidJ a p h e 2),z) (cart o S (u.fill (u.lower a p h) (u.portD a p h)),z):=
u.blink0 ht (hu0.trans (ite_eq_left hv)) hs hr.hz
havehp5:u.b.loom u.x0 (u.q,cart o S (u.kidJ (u.lower a p h) (u.portD a p h) f g 5),0)=
Bow.purec (future1 o l (u.kidJ a p h e 4)):=
u.pop5 hy' o (u.portD a p h) f g 0have hpf := u.blink0 ht hp5 (reverse_fit _ _ hs2) hr.hy
exact .tail (.tail ((ReflTransGen.tail (.tail (.single (u.helm ht hr hx ho))
(u.prowl ht hr hx ho)) hp1).trans ht1) hpf) (u.shiver ht hr hx ho)
lemmacool {p c}(ht:u.Tidy)(he:u.Gown p c)(hk:u.Rating u.child p)(hx:c∈u.s.domain):
u.Track (prime p,c) (cart (u.scent p c) [] (u.fill u.child p),c) :=by
proof · 10
lines
let hz:=u.prepared ht he hx
apply ReflTransGen.tail hz
have hv:=u.pointing ht he (i:=u.H) le_rfl
have hs:=u.coal ht hk (u.dawn ht hk) hk.littleR he.hair
haveheF:u.b.loom u.x0 (u.q,tell p u.H (u.chainR p c u.H),0)= Bow.purec (cart (u.scent p c) [] (u.fill u.child p)+1):=by
rw [u.Ax]; simp [Aq,Bow.air,H]
rfl
have hg := ht.steady; have hu:=ht.run.wp
change 1≤ u.B.w at hu
apply u.blink0 ht heF (u.team ht hv hs (by omega) (by omega) (by omega) (by omega)) hx
lemmaonion {p c h e w} (ht:u.Tidy)(he:u.Gown p c)
(hc:c∈u.s.domain) (hw:w∈u.s.domain)
(hk:u.Herd u.child p c h e w):
u.Track (prime p,c) (done (u.scent p c),w):=by
proof · 10
lines
obtain ⟨ha,hb⟩:=hk.on
have hs:=u.dawn ht ha
have hh:=u.ladder ht hk hs he.hair
apply ReflTransGen.tail ((u.cool ht he ha hc).trans hh)
let v:=u.coal ht ha hs (hb.passed 5 (by omega)) he.hair
have he:=u.capDone ht he.hair.1 he.hair.2have hp:=ht.steady; have hr:=ht.run.wp
change 1≤ u.B.w at hr
exact u.blink0 ht (u.popped_only hs ..)
(u.team ht v he (by omega) (by omega) (by omega) (by omega)) hw
lemmacasing (h:u.Tidy){v: Gem}(he:(snag u.p).p.check (u.hall h) v=true):
(∃ o c,v=gem0 (done o) c) ∨∃ p c,v=gem0 (prime p) c ∧ p<u.b.ports.f u.x0 u.q:=by
proof · 12
lines
rcases v with ⟨⟨v,c⟩,j⟩
let o:=(dec v:Card).2.1
change (if j=0thenif v=done o thentrueelseif v=prime o then decide (o < u.b.ports.f u.x0 u.q)
elsefalseelsefalse)=true at he
split at he
· next hw=>
split at he
· next hh=> exact Or.inl ⟨o,c,by unfold gem0; rw [hh,hw]⟩
split at he
· next hh=> exact Or.inr ⟨o,c,by unfold gem0; rw [hh,hw],of_decide_eq_true he⟩
contradiction
contradiction
lemmatogether (h:u.Tidy){r a b} (hr:(u.upG h).up r=none) (ha:u.Track a b):
u.Budded h r a ↔ u.Budded h r b:=by
proof · 12
lines
induction ha with
| refl=>rfl
| @tail a b hx e ih=>
rw [ih]
have he:= (u.up_act h).2 e
constructor
· rintro ⟨n,hn⟩
cases hn with
| node=> grind
| above h hz hh=> rw [he] at hz; obtain rfl :=Option.some.inj hz; exact ⟨_,hh⟩
rintro ⟨n,hb⟩
exact ⟨_,.above ((u.forge h).twig.pairs e).1 he hb⟩
lemmato_entry {h:u.Tidy}{o c a p s} (ho:u.Stringent o)(hc:c∈u.s.domain)(ha:a∈u.s.domain)
(he:u.Lane u.child p a s)(hr:u.Gown p a):
u.Budded h (done o,c) (prime p,a) ↔ s=some c ∧ o=u.scent p a:=by
proof · 25
lines
havehu:(u.upG h).up (done o,c)=none:=u.blocked (u.shut)
cases he with
| dry hx hk hw=>
rw [u.together h hu (u.cool h hr hx ha)]
refine ⟨fun h0=>?_,by simp⟩
have hv:=u.first0 h hx (u.dawn h hx) hr.hair hw
have h1:=u.unite h0 (u.blocked hv)
have h2:=congrArg Prod.fst h1
exact False.elim (different h2)
| born hw=>
rename_i i j b
havehe:b∈u.s.domain:=by
cases hw with
| solo hr _=> exact hr.hw
| pair hr _ _ _ _=> exact hr.hw
rw [u.together h hu (u.onion h hr ha he hw)]
constructor
· intro hv
have h1:=u.unite hv (u.blocked u.shut)
havehg : done (u.scent p a)=done o:=congrArg Prod.fst h1
have hg2:=congrArg (fun x=>(dec x:Card).2.1) hg
simp only [done,decname] at hg2
exact ⟨congrArg some (congrArg Prod.snd h1),hg2.symm⟩
rintro ⟨e,h1⟩; obtain rfl:=Option.some.inj e; rw [← h1]
exact ⟨0,.node (u.root_ok ho hc)⟩
lemmaarrival {h:u.Tidy} {o c f y} (hs:u.Suite f)(ho:u.Stringent o)(hc:c∈u.s.domain):
u.ent f o c y ↔
(u.upG h).nest (done o,c) y ∧
(snag u.p).p.check (u.hall h) y=true∧ y ≠ gem0 (done o) c:=by
proof · 12
lines
constructor
· rintro ⟨a,ha,i,hi,rfl,e,hx⟩
obtain ⟨hl,hw⟩:= hs.row a ha i hi
obtain ⟨n,hk⟩:= (u.to_entry ho hc ha hl hw).2 ⟨e,hx⟩
exact ⟨⟨⟨hk.on,Nat.zero_le _⟩,_,hk⟩,(u.marked hi).1,fun e=>priority i o
(congrArg (fun x=>x.1.1) e)⟩
rintro ⟨hv,hx,hz⟩
rcases u.casing h hx with ⟨v,w,rfl⟩ | ⟨p,a,rfl,hp⟩
· exact False.elim (hz (congrArg (funx:Dot=>(x,0)) (u.unite hv.2 (u.blocked u.shut))))
havehe:a∈u.s.domain:=u.domain_ok hv.1.1
obtain ⟨hr,ht⟩:=hs.row a he p hp
exact ⟨a,he,p,hp,rfl,(u.to_entry ho hc he hr ht).1 hv.2⟩
front : Stripe (Flare ((u.upG h).march true) ((snag u.p).p.check (u.hall h)))
(gem0 (done o) c) l (gem0 (done o) c)
aft : Stripe (Flare ((u.upG h).march false) ((snag u.p).p.check (u.hall h)))
(gem0 (done o) c) l.reverse (gem0 (done o) c)
unique : l.Nodupmembers : ∀ y,y∈l↔u.ent f o c y
lemmabeat (h:u.Tidy){f o c}(hp:u.Suite f)(ho:u.Stringent o)(hc:c∈u.s.domain) :
∃ l,u.Wheel h f o c l:=by
proof · 9
lines
obtain ⟨l,hl,hz,h1,h2⟩:= (u.upG h).streak (u.root_ok ho hc) (u.blocked u.shut)
((snag u.p).p.check (u.hall h)) (u.capped h o c).1
refine ⟨l,h1,h2,(List.nodup_cons.1 hl).2,fun y=>?_⟩
rw [u.arrival (h:=h) hp ho hc]
have hg:= (List.nodup_cons.1 hl).1have hh:=hz y
unfold gem0
rw [List.mem_cons] at hh
grind