mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
Adds three definitions/lemmas at module scope in FixedPoint.lean,
before the Q16_16 namespace:
q16Clamp (i : Int) : Int
— pure-Int clamp to [q16MinRaw, q16MaxRaw]; no subtype, no proof field.
q16Clamp_monotone (a b : Int) (h : a ≤ b) : q16Clamp a ≤ q16Clamp b
— proved once by the by_cases / simp / dsimp / omega pattern;
all future monotonicity proofs inherit from here.
q16Clamp_id_of_inRange (i : Int) (hlo hhi) : q16Clamp i = i
— idempotence on in-range values; one simp call.
Inside Q16_16 namespace, replaces the 38-line ofRawInt_monotone case-split
with two short lemmas:
ofRawInt_toInt_eq_clamp (i : Int) : (ofRawInt i).toInt = q16Clamp i
— bridge between the subtype constructor and the pure-Int function;
proved by split_ifs <;> rfl.
ofRawInt_monotone (a b : Int) (h : a ≤ b) :
(ofRawInt a).toInt ≤ (ofRawInt b).toInt
— now a two-line proof: simp [ofRawInt_toInt_eq_clamp] + q16Clamp_monotone.
add_nonneg_monotone is unchanged; it still delegates to ofRawInt_monotone.
Full workspace build: 3570 jobs, 0 errors.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| conversions/hardware | ||
| external/OTOM | ||
| LeanGPT | ||
| Semantics | ||
| CHAIN_ALL_REVIEW_REPORT.md | ||