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:
- 2D / strided bounds across a shared factor
s: froma < b, deducea * s + s ≤ b * s(covering botha * sands * a), and froma ≤ b, deducea * s ≤ b * s. - Strided injectivity / distinctness across a shared factor
s: when Phase 1 (non-branching) does not close the goal, add the three-way trichotomy on(a, b)for unordered pairs sharing a factors, allowingomegato provea * s + r = b * s + r' → a = b ∧ r = r'anda * s + r ≠ b * s + r'wheneverr < sandr' < s. - Monotone powers of two
2 ^ e(and same-exponent powersa ^ k): for every2 ^ e, add0 < 2 ^ eande < 2 ^ e; for pairs(2 ^ e₁, 2 ^ e₂), comparee₁vse₂linearly (including product facts just derived) and add2 * 2 ^ e₁ ≤ 2 ^ e₂,2 ^ e₁ ≤ 2 ^ e₂, or2 ^ e₁ = 2 ^ e₂. - Variable-divisor
div/modbounds:s * (a / s) + a % s = a,a / s ≤ a,a % s ≤ a,0 < s → a % s < s,(a * s + r) / s = aand(a * s + r) % s = rwhenr < s, and monotonicity / comparison bridgesa / s < m ↔ a < m * sandm ≤ a / s ↔ m * s ≤ a.
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 #
stride_omega: close aℕ/ℤarithmetic goal using linear arithmetic augmented with bounded strided-product,div/mod, and monotone2 ^ kpreprocessing.Cslib.Tactic.StrideOmega.prove?: silentMetaMentry point returningOption Expr(no linter warnings, bounded heartbeats), used byupdate_simp.
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.
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₂]).