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

[CN] simplify guards in each terms in state output #351

Open
peterohanley opened this issue Jun 25, 2024 · 3 comments · May be fixed by #569
Open

[CN] simplify guards in each terms in state output #351

peterohanley opened this issue Jun 25, 2024 · 3 comments · May be fixed by #569
Labels
cn ui/ux Issue with presentation or user experience

Comments

@peterohanley
Copy link

I got a program with this term in the Available resources: each(u64 j; (((j < 4u64) && (!(j == 0u64))) && (!(true && (j < 2u64)))) && (!(j == 2u64))) {Block<struct instrumentation_state>(&instrumentation + j * 44u64 /* 0x2c */)}(ii) (same type)

I simplified (((j < 4u64) && (!(j == 0u64))) && (!(true && (j < 2u64)))) && (!(j == 2u64)) to ((j < 4u64) && (j >= 3u64)) manually. This is much easier to read. I might have made a mistake.

Simplifying terms in general might be tricky but at least
(!(true && (j < 2u64))) should be amenable to local simplification to (j >= 2u64).

@cp526
Copy link
Collaborator

cp526 commented Jun 25, 2024

Agreed.

This particular simplification would be easy to add. We might want to see if we can replace CN's (somewhat adhoc) term simplifier with simplification using the SMT solver, which would be much better at it.

@bcpierce00
Copy link
Collaborator

bcpierce00 commented Jun 26, 2024 via email

@dc-mak dc-mak added the cn label Jun 26, 2024
@dc-mak dc-mak changed the title [CN] simplify predicates in each terms in state output [CN] simplify guards in each terms in state output Jul 5, 2024
@yav yav self-assigned this Aug 5, 2024
@yav
Copy link
Collaborator

yav commented Aug 5, 2024

I believe the constraint in this case should just simplify to j = 3.
Both CVC5 and Z3 have a simplify command (it's not standard SMTLIB I think, but since it works in both, it's probably OK to use). I tried it on this example, and this is what both of them come up with:

(! (j >= 4)) && (! (j == 0)) && (j >= 2) &&  (! (j == 2))

This is really not much different from the original, it pretty much jsut removed the true &&.

Also translating to the solver makes some things into uninterpreted functions, which probably are less amenable to simplification than if we know the meaning of the terms. So I suspect we'd need some manual simplificaiton anyways, but it'd be interesting if we can also use the solver to help.

@yav yav removed their assignment Aug 7, 2024
@yav yav linked a pull request Sep 11, 2024 that will close this issue
@yav yav added the ui/ux Issue with presentation or user experience label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cn ui/ux Issue with presentation or user experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants