let m:=p.r.mode.f x (axis x a)
let t:=p.r.slip.f x (axis x a)
let b:=p.r.token.f x a
let z:=fun u=>p.loan x (a.1,a.2.1,p.road u x a)
if m=0thentrueelse
(z true && z false) && (if m=1then p.v.tap.f x t else
p.v.voted.f x (t,b) && decide (p.r.next.f x (a.1,a.2.1,b)=a.2.2+1))
⟨s.l,p.O s.l.x s.q,p.v.D.f s.l.x s.q,s.q,p.price,
range (p.total s.l.x s.q),s.domain,s.hand,
fun v x=>s.echo (p.slipk s v) x, fun v=>s.stream (p.slipk s v)⟩
ax: 1≤ p.Awp : 1≤ (p.O s.l.x s.q).w
openL : ∀ q,s.l.book q=p.E0 s.l.x q
hands : ∀ i∈s.domain,s.hand i ≤ s.l.F.limit
ring : ∀ t,p.v.tap.f s.l.x t=true→ entitled p s t →∀ i∈s.domain,
Boots s.l.x s.l.F s.l.P t s.l.P (0,s.hand i) (s.echo t i,s.hand i)
rout : ∀ t z,p.v.voted.f s.l.x (t,z)=true→
(∀ b,entitled p s ((p.v.reach b).f s.l.x (t,z))) →∀ i∈s.domain,∀ b, Boots s.l.x s.l.F s.l.P ((p.v.reach b).f s.l.x (t,z)) s.l.P (0,s.hand i)
(motor s t z b i) ∧∀ j,s.stream t z b i=some j → j∈s.domain ∧ s.stream t z (!b) j=some i
uniq : ∀ {t i z y a b}, s.stream t z true i=some a → s.stream t y true i=some b →
z=y
have hx:=measure_pair x (a,b)
have hv:= measure_pair a b
havehe : Relay.measure x=1:=by cases x<;> rfl
change Relay.measure (x,a,b)+1≤Relay.measure a*2+Relay.measure b+7
omega
have hs:=p.lumax hA h
cases b
· change lb (enc (y,i,v))+1≤_
have he:= plusbase (a:=i) (b:=v) y
nlinarith [lb_pos v]
change lb (enc (y,v,i))+1≤_
have he:=plusbase (a:=v) (b:=i) y
nlinarith [lb_pos v]
lemmaapproved {v i} :
p.bud.ready (p.clay s) v i=true↔
(v∈(p.clay s).raw ∧ i∈(p.clay s).raw ∧ i < caplen v ^ p.A∧ v < caplen i ^ p.A) ∧
p.good0 s.l.x (view s v i)=true:=by
proof · 5
lines
change (((decide (i < p.total s.l.x s.q) && decide (i < caplen v ^ p.A)) &&
(decide (v < p.total s.l.x s.q) && decide (v < caplen i ^ p.A))) &&
p.good0 s.l.x (s.q, v, i)) = true↔ _
simp only [Bool.and_eq_true, decide_eq_true_eq, clay, mem_range]
tauto
lemmatilt (h:Fires p s): p.bud.Wall (p.clay s):=by
proof · 55
lines
let w:=p.O s.l.x s.q
let v:=p.clay s
change p.bud.Wall v
have hc := h.ax; havehw: 1≤ w.w:=h.wp
refine ⟨fun {a b} hz=>(p.approved s).1 hz|>.1,fun {a c} ha hs i hi b=>?_,fun {a b} hs he dir=>?_,
fun {a b} hs he x hx dir=>?_, fun {a b} hs he=>?_, ?_⟩
· change i ≤ caplen a ^p.A at hi
refine ⟨h.hands _ hs,?_⟩
replace ha: a<2^(charge p.A w.w w.t) :=
lt_of_lt_of_le (mem_range.1 ha) (min_le_right ..)
havehh : lb a≤ charge p.A w.w w.t:=modest ha (by unfold charge; nlinarith)
havehe:lb (enc ((b,a,i):Panel))+1≤(2*p.A+40)*lb a:=p.cheaply hc hi true b
have hl:=span_mono (show span p.A w.w w.t 0 (lb a) by unfold span charge at *; omega)
(D:=p.price) (by unfold price; nlinarith) hc
have hz:=lax (show span p.A w.w w.t 0 (lb a) by unfold span charge at *; omega) (m:=2*p.A+40)
(D:=p.price) (by unfold price; nlinarith) hc
change span p.price w.w w.t 0 (lb (enc ((b,a,i):Panel))+1)
havehv : p.price*p.A≤ p.price*p.price:=by unfold price; nlinarith
unfold span; nlinarith [Nat.mul_le_mul_right w.w hv]
· let f:=p.road dir s.l.x (view s a b)
let u:=p.E0 s.l.x f
obtain ⟨hh,ht⟩:= (p.approved s).1 hs
change p.compo s a≠0 at he
havehl: p.faith s a f:=byby_cases hx:p.compo s a=1
· rw [show f=p.slipk s a from p.stamp s dir hx]
exact ((p.bright s hx).1 ht).2havehg:2≤ p.compo s a:=by omega
rw [show f=p.swept s a (p.wherep s a b) dir from p.stampm s dir hg]
exact ((p.abroad s hg).1 ht).1.2 dir
change u.w+v.d≤w.w ∧ span p.A (w.w-u.w) w.t u.t (lb a+1) at hl
change s.l.jump p.price w v.d (enc ((false,(if dir then (a,b) else (b,a))):Panel)) f
unfold Lot.jump; rw [h.openL]; change u.w+v.d≤w.w ∧ _
have hz:= lax hl.2 (m:=2*p.A+40) (D:=p.price) (by unfold price; nlinarith) hc
havehv : p.price*p.A≤ p.price*p.price:=by unfold price; nlinarith
have hh1:= p.cheaply hc hh.2.2.1.le dir false
refine ⟨hl.1,?_⟩
change span p.price (w.w-u.w) w.t u.t (lb (enc ((false,Bud.invert dir (a,b)):Panel))+1)
unfold span; nlinarith [Nat.mul_le_mul_right (w.w-u.w) hv]
· change p.compo s a=1 at he
have hl:= (p.bright s he).1 ((p.approved s).1 hs).2have hs := h.ring (p.slipk s a) hl.1 ⟨_,hl.2⟩ x hx
change Boots s.l.x s.l.F s.l.P (p.road dir s.l.x (view s a b)) _ _ _
rw [p.stamp s dir he]
exact hs
· change 2≤ p.compo s a at he
have hp:= (p.abroad s he).1 ((p.approved s).1 hs).2
refine ⟨hp.2,fun x hx dir=>?_⟩
have hy:=h.rout _ _ hp.1.1 (fun b=> ⟨_,hp.1.2 b⟩) x hx dir
refine ⟨?_,hy.2⟩
change Boots s.l.x _ _ (p.road dir s.l.x (view s a b)) _ _ _
rw [p.stampm s dir he]; exact hy.1
· intro v i j _ _ _ x _ y z g e
exact h.uniq g e
lemmameets0 {v i x} (h:p.Reserve s) (he:fitting p s v i) (hh:p.compo s v=0)
(hk:p.label s v i 0=i+1) (hx:x∈s.domain) : minted p s (v,x) (i,x):=
proof · 4
lines
⟨(Bud.walled _).2 ⟨p.mem_of s h he.1,hx⟩,(Bud.walled _).2 ⟨p.mem_of s h he.2.1,hx⟩,
p.bid s h he (p.purity s hh),by
change (match p.compo s v with | 0=>_ | 1=>_ | _=>_)
rw [hh]; exact ⟨hk,rfl⟩⟩
lemmameets1 {v i x} (h:p.Reserve s) (he:fitting p s v i) (hh:p.compo s v=1)
(hk:p.label s v i (s.echo (p.slipk s v) x)=i+1) (hz:p.afoot s v)
(hx:x∈s.domain) : minted p s (v,x) (i,x):=
proof · 4
lines
⟨(Bud.walled _).2 ⟨p.mem_of s h he.1,hx⟩,(Bud.walled _).2 ⟨p.mem_of s h he.2.1,hx⟩,
p.bid s h he ((bright p s hh).2 hz),by
change (match p.compo s v with | 0=>_ | 1=>_ | _=>_)
rw [hh]; exact ⟨hk,rfl⟩⟩
lemmameets2 {v i x y b} (h:p.Reserve s) (he:fitting p s v i) (hh:p.compo s v=2)
(hz:b=p.wherep s v i) (hk:p.label s v i b=i+1) (hf:p.swift s v b)
(hx:x∈s.domain) (hy:y∈s.domain) (hr:s.stream (p.slipk s v) b true x=some y) :
minted p s (v,x) (i,y):=by
proof · 5
lines
subst b
exact ⟨(Bud.walled _).2 ⟨p.mem_of s h he.1,hx⟩,(Bud.walled _).2 ⟨p.mem_of s h he.2.1,hy⟩,
p.bid s h he ((abroad p s (by change 2≤ p.compo s v; omega)).2 ⟨hf,hk⟩),by
change (match p.compo s v with | 0=>_ | 1=>_ | _=>_)
rw [hh]; exact hr⟩
lemmacinder1 {v c} (h:p.compo s v=1) (hh:∀ i,p.label s v i (s.echo (p.slipk s v) c)=0) :
p.mate s (v,c) :=by
proof · 3
lines
rintro ⟨i,y⟩ ⟨-,hz,_,e⟩
change (match p.compo s v with| 0=> _| 1=>_|_=>_) at e
rw [h] at e; havehp:p.label s v i (s.echo (p.slipk s v) c)=i+1:= e.1; rw [hh] at hp; omega