Skip to content

Add Plausible integration (alternative to SlimCheck) - #82

Merged
samuelburnham merged 3 commits into
argumentcomputer:mainfrom
ngernest:plausible-integration
Jul 27, 2026
Merged

Add Plausible integration (alternative to SlimCheck)#82
samuelburnham merged 3 commits into
argumentcomputer:mainfrom
ngernest:plausible-integration

Conversation

@ngernest

@ngernest ngernest commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Hi! This PR is a follow-up to issue #81. This PR integrates Lean's Plausible property-based testing library with LSpec, so that users can use LSpec's test harnesses to test Plausible properties.

(For backwards compatibility reasons, this PR treats the Plausible integration as an addition to LSpec's existing SlimCheck integration, instead of replacing SlimCheck.)

The new code introduced in this PR is deliberately designed to be as similar as possible to the existing SlimCheck integration for consistency purposes. Here is how the existing SlimCheck functions map onto their Plausible-backed counterparts:

Function introduced in this PR SlimCheck equivalent (exists currently in LSpec)
runPlausibleSuiteAux SlimCheck.Checkable.runSuiteAux
runPlausibleSuite SlimCheck.Checkable.runSuite
runPlausibleSuiteIO SlimCheck.Checkable.checkIO
instTestableOfPlausible instTestableOfCheckable
checkPlausible check
checkPlausibleIO checkIO
checkPlausible' check'
checkPlausibleIO' checkIO'

Note: the dependency on Plausible in lakefile.toml has a specific commit hash specified as the rev, as the latest version of Plausible uses Lean 4.33, whereas LSpec currently uses 4.31.

(Feel free to suggest ways to change this PR! I am currently using a fork of LSpec with Plausible for testing my own Lean projects anyway, and I figured this may be useful to other LSpec users.)

ngernest added 3 commits July 24, 2026 16:26
Introduce LSpec/Plausible.lean providing checkPlausible / checkPlausible'
(compile-time) and checkPlausibleIO / checkPlausibleIO' (runtime), backed
by Lean's official Plausible library. These live alongside the existing
SlimCheck-based check/checkIO rather than replacing them, so existing code
is unaffected.

The harness (runPlausibleSuite{,Aux,IO}, instTestableOfPlausible) tracks the
number of trials that succeeded before a counterexample was found, and funnels
into the shared LSpec.Testable / TestSeq machinery for reporting.

Uses 'public meta import' / 'public meta section' to match Plausible's own
module-system markings (Gen.resize, TestResult.gaveUp, etc. are meta).

@arthurpaulino arthurpaulino left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The patch looks fine to me. @samuelburnham wdyt?

@samuelburnham samuelburnham left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, LGTM! We can add automation later to update the LSpec and plausible versions in lockstep.

@samuelburnham
samuelburnham merged commit fb195bc into argumentcomputer:main Jul 27, 2026
2 checks passed
@ngernest

Copy link
Copy Markdown
Contributor Author

Great, thank you both!

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.

3 participants