Documentation

CslibFrontier.Tactic.StrideOmega

Strided product, division, and power-of-two arithmetic for Word-RAM proofs #

omega treats nonlinear products a * s, variable-divisor quotients/remainders a / s and a % s, and powers 2 ^ e as opaque atoms. Word-RAM developments constantly discharge local nonlinear inequalities from the linear facts already in context:

All candidate pairs are drawn strictly from the syntactic atoms present in the goal and arithmetic hypotheses, with hard caps on atom/probe count and tight per-probe heartbeat budgets to avoid quadratic blowups on large contexts. The tactic first tries unfolding @[wram_arith] definitions as in wram_omega.

Main definitions #

theorem Cslib.Tactic.StrideOmega.mul_add_le_of_lt {a b s : ℕ} (h : a < b) :
a * s + s ≤ b * s

Step bound a * s + s ≤ b * s from a < b.

theorem Cslib.Tactic.StrideOmega.mul_trichotomy (a b s : ℕ) :
a < b ∧ a * s + s ≤ b * s ∨ a = b ∧ a * s = b * s ∨ b < a ∧ b * s + s ≤ a * s

Three-way step comparison for right-aligned products a * s and b * s.

theorem Cslib.Tactic.StrideOmega.two_mul_pow_le_of_lt {e₁ e₂ : ℕ} (h : e₁ < e₂) :
2 * 2 ^ e₁ ≤ 2 ^ e₂

Tight doubling bound 2 * 2 ^ e₁ ≤ 2 ^ e₂ from e₁ < e₂.

theorem Cslib.Tactic.StrideOmega.two_pow_trichotomy (e₁ e₂ : ℕ) :
e₁ < e₂ ∧ 2 * 2 ^ e₁ ≤ 2 ^ e₂ ∨ e₁ = e₂ ∧ 2 ^ e₁ = 2 ^ e₂ ∨ e₂ < e₁ ∧ 2 * 2 ^ e₂ ≤ 2 ^ e₁

Three-way order comparison for 2 ^ e₁ and 2 ^ e₂.

def Cslib.Tactic.StrideOmega.runOnGoal (g : Lean.MVarId) (extraTerms : Array Lean.Expr := #[]) (extraDefs : Lean.NameSet := ∅) (heartbeatCap? : Option ℕ := none) (allowBroad : Bool := true) :

Core solver: attempt to close g using stride_omega. extraTerms are additional proof terms passed in [h₁, h₂]. extraDefs are extra constant names to unfold alongside @[wram_arith]. When heartbeatCap? is set, caps the internal omega calls (for speculative callers like update_simp). Returns none on success or an error message on failure.

def Cslib.Tactic.StrideOmega.prove? (target : Lean.Expr) (extraDefs : Lean.NameSet := ∅) (extraHyps : Array Lean.Expr := #[]) (heartbeatCap : ℕ := 15000000) :

Silent MetaM prover for arithmetic goals, used by update_simp. Does not emit linter warnings and bounds every internal omega run by heartbeatCap.

Prove an arithmetic goal by linear arithmetic augmented with bounded nonlinear preprocessing: unfolds @[wram_arith] definitions and local bindings (like wram_omega), derives monotone strided-product facts a * s + s ≤ b * s / a * s ≤ b * s / mul_trichotomy across shared factors s, variable-divisor div/mod identities, and monotone 2 ^ e / a ^ k bounds strictly from syntactic atoms present in the goal and arithmetic hypotheses.

Optional [h₁, h₂] supplies extra hypothesis terms (like wram_omega [h₁, h₂]).