Skip to content

(WIP) Update generators to use SPMF type instead of SetGen - #29

Draft
ngernest wants to merge 8 commits into
mainfrom
spmf-refactor
Draft

ngernest wants to merge 8 commits into
mainfrom
spmf-refactor

Conversation

@ngernest

@ngernest ngernest commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

This PR updates this repo to use the SPMF type throughout, with SetGen removed. This is a fairly large PR but the changes are relatively mechanical.

@ngernest
ngernest marked this pull request as draft September 23, 2026 22:01
@ngernest ngernest changed the title Update generators to use SPMF type instead of SetGen (WIP) Update generators to use SPMF type instead of SetGen Sep 23, 2026
-- alternative wins on some of them. `unusedTactic` aggregates over all seven and reports the
-- `decide +kernel` of the middle alternative as a no-op, because on the goals that alternative wins,
-- `left; right` happens to close the goal by itself. Deleting it leaves the other goals unsolved.
set_option linter.unusedTactic false in

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally don't love setting options if we can avoid it. Is there a way to restructure the proof to avoid needing this, or does the proof become much worse?

Comment thread StrataGenerators/HasTypeAGen/Core.lean Outdated
module imports the full `Basalt` library, and so Mathlib. This file stays free of Mathlib, to keep
itself and the proof modules that import it cheap to build. The definition here is definitionally
equal to the one in Basalt, so a proof can unfold either one. -/
/-- A generator for a `Nat`. A local copy of Basalt's `Nat.arbitrary`, definitionally equal to it, so

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the local copy needed?

every combinator this package draws from, `Basalt/Laws.lean` has `IsSoundAndComplete`, and
`Basalt/Tactics.lean` has `support_simp`, the packaged `simp only` set for support inversion.

This file holds the three things Basalt does not.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to upstream them to Basalt eventually?

Comment thread StrataGenerators/GenSupport.lean Outdated

/-! ## The support API, unqualified

The proofs in this package name these lemmas without a prefix, and they long predate the move to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments should not be stateful; they should describe the code as it is right now, not talk about what changed from a previous version.

Comment thread StrataGenerators/GenSupport.lean Outdated
The equation compiler uses `WellFounded.fix` for a generator with `termination_by`, and the members
of a `mutual` block share one such fix over a `PSum` of their argument tuples. This lemma is
therefore what lifts a per-site fact to a whole block. -/
theorem wellFounded_fix_congr {α : Sort u} {r : α → α → Prop} {C : α → Sort v}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this theorem needed? It is just congrArg, right?

@@ -2099,8 +2078,16 @@ open StrataGenerators.IndirSupport in
application spine of an arity up to `K`. -/
abbrev genDepthBudget (K depth : Nat) : Nat := depthBudget K depth

set_option maxHeartbeats 1600000 in
set_option maxHeartbeats 6400000 in

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting heartbeats should be avoided if possible. Why is this needed here?

Comment thread StrataGenerators/TuningPrototypes.lean Outdated
@@ -0,0 +1,766 @@
/-
Copyright (c) 2026 Harrison Goldstein. All rights reserved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright statement should match the other files

| rfl); done)
| (simp; done)))

set_option maxHeartbeats 8000000 in

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need such a high maxHeartbeats?

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.

2 participants