Skip to content

Parse and lift the SMT counterexamples to LExpr#495

Merged
shigoel merged 18 commits intomainfrom
jlee/smt-cex
Mar 3, 2026
Merged

Parse and lift the SMT counterexamples to LExpr#495
shigoel merged 18 commits intomainfrom
jlee/smt-cex

Conversation

@aqjune-aws
Copy link
Copy Markdown
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
atomb
atomb previously approved these changes Feb 27, 2026
Comment thread Strata/Languages/Core/Verifier.lean
Comment thread Strata/DDM/Elab.lean
Comment thread Strata/DL/Imperative/SMTUtils.lean
Comment thread StrataTest/Languages/Core/CounterExampleLiftTest.lean
Comment thread Strata/DL/SMT/CexParser.lean Outdated
Comment thread Strata/DL/Imperative/SMTUtils.lean
Comment thread Strata/DL/SMT/DDMTransform/Translate.lean Outdated
Comment thread Strata/DL/SMT/DDMTransform/Translate.lean Outdated
Comment thread Strata/Languages/Core/Verifier.lean Outdated
Comment thread Strata/Languages/Core/Verifier.lean Outdated
Comment thread StrataTest/Languages/Core/PolymorphicProcedureTest.lean
@aqjune-aws
Copy link
Copy Markdown
Contributor Author

Fixed the latest failure after #496 by updating DDM's Parser to also correspondingly recognize '$'. :)

@shigoel shigoel added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 7781813 Mar 3, 2026
15 checks passed
@shigoel shigoel deleted the jlee/smt-cex branch March 3, 2026 23:35
kondylidou pushed a commit to abdoo8080/Strata that referenced this pull request Mar 5, 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.

---

strata-org#482 and this pull request have overlapping edits. Merging strata-org#482 does not
introduce merge conflict, but tests need updates. Would be great if strata-org#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.
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