Client state and proofs
Keep app state transitions in pure Lean functions so theorems can refer to the executed definitions. Your agent can write the proof; you still need to review its statement and assumptions.
A type-correct reducer does not automatically satisfy your domain rules. Lean checks the propositions you state and prove. It does not check every possible application state against an unstated requirement.
This site's src/Example/Checkout.lean keeps the state transition and its invariant proof right next to each other in the same file:
This proves that no sequence of applyDiscount or charge actions can exceed the subtotal or charge an order twice in the model. It does not prove that a remote payment gateway honors your idempotency key; network boundaries still need integration tests.
Where proofs can live
There is no special filename or extension rule for proofs. You can put theorem declarations in:
lakeport check . checks every .lean and .lp module in your project roots regardless of filename. Lean erases every Prop proof before C and WebAssembly codegen, so proofs add zero bytes to your runtime binary. Keeping cross-module proofs in a separate .lean file is purely an optional convention: it lets you edit UI files without re-checking unrelated proofs and gives you direct Lean Infoview feedback.
App theorems do not establish browser storage durability, host renderer correctness, CSS layout, or remote API behavior. Review those boundaries and test them separately.