Research-Stack/0-Core-Formalism
Brandon Schneider 1db38040ac refactor(lean): factor q16Clamp into FixedPoint; ofRawInt_monotone becomes one-liner
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>
2026-05-26 23:59:00 -05:00
..
core Remove legacy Python prototypes superseded by Lean formalization 2026-05-19 15:34:17 +00:00
lean refactor(lean): factor q16Clamp into FixedPoint; ofRawInt_monotone becomes one-liner 2026-05-26 23:59:00 -05:00
otom Add Phys.org May 2026 source intake for bees, biocoatings, THz, and diamond membranes 2026-05-23 19:27:37 -05:00
receipts docs: add bio optical witness living light equations 2026-05-09 20:53:51 -05:00
rust/ftdi_gimbal initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00
README.md initial: sovereign research stack (consolidated, weightless, and lfs-optimized) 2026-05-04 18:11:36 -05:00

0-Core-Formalism

Purpose: Formal foundations for the entire Research Stack — Lean modules, bind primitive, Triumvirate consensus, core source.

No external dependencies. All other layers depend on this.

Contents (Target)

Source Destination
0-Core-Formalism/lean/Semantics/ 0-Core-Formalism/lean/Semantics/
core/ 0-Core-Formalism/core/

Concepts

  • bind — State → (State → Action) → State
  • TriumvirateClock — ternary consensus (ADD/PAUSE/SUBTRACT)
  • Builder/Judge/Warden — roles mapped to hardware registers
  • OTOM — Ordered Transformation & Orchestration Model

Build

cd "0-Core-Formalism"
lake build