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

[FEATURE] Better constant propagation #197

Closed
konnov opened this issue Aug 5, 2020 · 2 comments
Closed

[FEATURE] Better constant propagation #197

konnov opened this issue Aug 5, 2020 · 2 comments
Assignees
Labels
FSMT Feature: Improvements in the SMT encoding help wanted new New issue to be triaged. optimization

Comments

@konnov
Copy link
Collaborator

konnov commented Aug 5, 2020

The current optimizer propagates constants, but fails to do so in some cases. For example:

---------------------------- MODULE Opt1 -------------------------------------  
VARIABLES S

A == "Foo"

Init ==
    S = 0

Next ==
    IF A = "Foo"
    THEN S' = 1
    ELSE S' = 2
==============================================================================

The output after the optimization step (as can be seen in out-opt.tla), is like this:

----- MODULE Opt1 -----                                                         
  
VARIABLE S

Init$0 == S' := 0

Next$0 == "Foo" = "Foo" /\ S' := 1

Next$1 == ~("Foo" = "Foo") /\ S' := 2
===============

It is not clear, why the optimizer did not rewrite "Foo" = "Foo" into TRUE.

The optimizer can be found in at.forsyte.apalache.tla.pp.passes.OptPassImpl.

@konnov konnov added new New issue to be triaged. help wanted optimization labels Aug 5, 2020
@konnov konnov added this to the v0.9-dev-encoding milestone Aug 5, 2020
@istoilkovska
Copy link

Equality simplification is defined only for ValEx(TlaInt) and NameEx here.

@konnov
Copy link
Collaborator Author

konnov commented Aug 5, 2020

True. That explains it :D

@konnov konnov added the FSMT Feature: Improvements in the SMT encoding label Dec 11, 2020
@konnov konnov modified the milestones: v0.15.0-dev-encoding, backlog2021 Dec 11, 2020
@konnov konnov self-assigned this Jan 19, 2021
@konnov konnov modified the milestones: backlog2021, January iteration Jan 19, 2021
@konnov konnov closed this as completed Jan 19, 2021
konnov added a commit that referenced this issue Jan 21, 2021
…452)

* closed #450 and #197: handling big integers and better preprocessing

Co-authored-by: Shon Feder <[email protected]>
This was referenced Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FSMT Feature: Improvements in the SMT encoding help wanted new New issue to be triaged. optimization
Projects
None yet
Development

No branches or pull requests

2 participants