Skip to content

refactor: make things monadic (rebased from PR #17)#22

Merged
GasStationManager merged 1 commit intomainfrom
pr17-rebase
Mar 7, 2026
Merged

refactor: make things monadic (rebased from PR #17)#22
GasStationManager merged 1 commit intomainfrom
pr17-rebase

Conversation

@GasStationManager
Copy link
Owner

Rebased port of #17 (monadic branch by Paul Lezeau) onto current main with all security hardening integrated.

Architecture

Three-layer monad stack: ReaderT Settings (ReaderT Decls (StateT State IO))

  • Settings — CLI config, allowed axioms (immutable)
  • Decls — parsed target/submission declarations (immutable after setup)
  • State — check outcomes + axiom violations (mutable)

Changes from original PR #17

  • All security checks integrated into monadic flow (import superset, Nat literal validation, Level/Expr rebuild, kernel re-verification, inductive/constructor checking)
  • Fixed axiom violation tracking (issue from review): violations are now recorded in State.axiomViolations and checked in runMain, so submissions using disallowed axioms correctly exit 1
  • checkAxioms and Info.toFailureMode take allowedAxioms as parameter (no global)
  • checkTargets reads from Decls context and writes outcomes to State
  • settingsFromParsed consolidates CLI argument parsing

Co-authored-by: Paul Lezeau

Supersedes #17.

Test results (13 cases)

All 12 standard tests pass + dedicated axiom violation test confirms fix.

Port of monadic branch onto current main with all security hardening.

Three-layer monad stack: ReaderT Settings (ReaderT Decls (StateT State IO))
- Settings: CLI config, allowed axioms (immutable)
- Decls: parsed target/submission declarations (immutable after setup)
- State: check outcomes + axiom violations (mutable)

Key changes from original PR #17:
- Integrated all security checks (import superset, Nat literal validation,
  Level/Expr rebuild, kernel re-verification, inductive/constructor checking)
- Fixed axiom violation tracking: violations are now recorded in State.axiomViolations
  and checked in runMain, so submissions using disallowed axioms correctly fail
  (previously they were only logged to stderr)
- checkAxioms and Info.toFailureMode take allowedAxioms as parameter
- checkTargets reads from Decls context and writes to State
- replayChallenges/replaySolutions read settings from ReaderT context
- settingsFromParsed consolidates CLI argument parsing

Co-authored-by: Paul Lezeau

Supersedes #17.
@GasStationManager GasStationManager merged commit 03a1a39 into main Mar 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant