Skip to content

Parse and lift the SMT counterexamples to LExpr#495

Open
aqjune-aws wants to merge 9 commits intomainfrom
jlee/smt-cex
Open

Parse and lift the SMT counterexamples to LExpr#495
aqjune-aws wants to merge 9 commits intomainfrom
jlee/smt-cex

Conversation

@aqjune-aws
Copy link
Contributor

@aqjune-aws aqjune-aws commented Feb 27, 2026

This patch

  • Parses the output of SMT solver containing counterexample using SMTDDM,
  • Lifts SMTDDM.Term to SMT.Term, then to LExpr, and
  • Let Core.verify properly print the counterexample using the new printer of Core.

To implement this,

  • A new parseCategoryFromDialect function is added to DDM. It parses a string using a specific syntax category.
  • A bug in SpaceSepBy making only odd'th symbols to be parsed was fixed. It seems SpaceSepBy was only used by SMTDDM.
  • The old CexParser.lean is erased.

A new StrataTest/Languages/Core/CounterExampleLiftTest.lean test shows a handful of interesting results.


#482 and this pull request have overlapping edits. Merging #482 does not introduce merge conflict, but tests need updates. Would be great if #482 is reviewed first! :)


Thanks to Kiro :)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aqjune-aws aqjune-aws marked this pull request as ready for review February 27, 2026 21:15
@aqjune-aws aqjune-aws requested a review from a team February 27, 2026 21:15
/--
A counterexample expressed as Core `LExpr` values, suitable for display
using Core's expression formatter and for future use as program metadata.
-/
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

throw (IO.userError errMsg)

/--
Parse a single syntax category from a loaded dialect set.
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, nice! I was thinking we'd need something like this eventually.

directly, which avoids the ambiguity that arises when parsing at the
`Command` level.

Returns a list of (key-string, value-Term) pairs on success.
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Property: assert
Result: ❌ fail
Model:
($__xs1, Cons(0, Nil))
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

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