Skip to content

Use auto unfold for some Logic operators#1014

Open
oskgo wants to merge 3 commits into
mainfrom
stdlib-auto-unfold
Open

Use auto unfold for some Logic operators#1014
oskgo wants to merge 3 commits into
mainfrom
stdlib-auto-unfold

Conversation

@oskgo
Copy link
Copy Markdown
Contributor

@oskgo oskgo commented May 21, 2026

As suggested in #431 (comment)

We do so for the following operators:

  • idfun
  • \o
  • \o2
  • pred0
  • predT
  • predC
  • pred1
  • predC1
  • rel0
  • relT
  • relC

These all share the property that they reduce down to an expression simpler than the original and should only be used as arguments to higher order functions like those in Bigop.

I also ran across a bug where declarations such as def foo (x y: int) / = true auto-unfolded after being given only one argument rather than requiring two. This PR fixes that as well. The fix is a one-liner, so it shouldn't be necessary to split up the PR IMO.

The library changes are a breaking change since it makes simplification more powerful, which can remove bindings. The breakage in the stdlib and examples is mostly due to the use of predT in bigops. I also fixed a few spurious errors due to smt calls failing, which might only be a difference between my machine and CI.

@oskgo
Copy link
Copy Markdown
Contributor Author

oskgo commented May 22, 2026

This is going go make a lot of unfolds useless. At the meeting we decided to also make a PR to warn on unfolds that don't do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant