Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More consistent use of mkIte #281

Open
langston-barrett opened this issue Feb 4, 2025 · 0 comments
Open

More consistent use of mkIte #281

langston-barrett opened this issue Feb 4, 2025 · 0 comments
Labels
good first issue Good for newcomers

Comments

@langston-barrett
Copy link
Contributor

Many ite constructors in What4.Expr.Builder use mkIte, which encapsulates some trivial rewrites:

mkIte sym c x y)

= mkIte sym c x y

| otherwise -> mkIte sym p x y

floatIte sym c x y = mkIte sym c x y

but some don't:

r <- sbMakeExpr sym (BaseIte (SR.semiRingBase sr) sz c xr yr)

sbMakeExpr sym (BaseIte (SR.semiRingBase sr) sz c x y)

sbMakeExpr sb $ BaseIte BaseBoolRepr sz c x y

Perhaps worse still, some use it but reimplement its rewrites:

structIte sym p x y
| Just True <- asConstantPred p = return x
| Just False <- asConstantPred p = return y
| x == y = return x
| otherwise = mkIte sym p x y

We should use it consistently.

@langston-barrett langston-barrett added the good first issue Good for newcomers label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant