-
Notifications
You must be signed in to change notification settings - Fork 75
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
Confusing synthesizer behavior (choosing integers vs. forms) #277
Comments
Just curious: the value of (I don't know what you want to do, so it could be that what you have is really what you want already... but in case you are modeling register assignment based on the previous state, what you currently have doesn't make sense to me) |
Quite right! Thanks for noticing that. Updated accordingly (same result) |
I have a working code on my laptop, but the battery ran out... I'll post it when I get back home. |
It's long ago that I read In any case, here's a repaired code that synthesizes
|
Thank you so much for your quick response and for providing a solution. I'm still not certain what rule I should apply in the future to avoid this mistake, though. Can you explain in more detail what was wrong with my original code? I have other working examples where the Also, is there a reason for the result? It's very odd that Rosette should provide a "sat" result and then supply a form that has the name of a grammar rule in it. How can that work? |
I found a small change to my original code that makes it work: ; PROBLEM AREA
(let ((srcno (??))
(dstno (??)))
; restrict values
(assert (and (>= dstno 0) (< dstno 3)
(>= srcno 0) (< srcno 3)))
(lambda (s)
; perform a move from A, B, or C to A, B, or C determined by two integers
(let ((src (if (= srcno 0) (state-A s)
(if (= srcno 1) (state-B s) (state-C s)))))
(state (if (= dstno 0) src (state-A s))
(if (= dstno 1) src (state-B s))
(if (= dstno 2) src (state-C s))))) Here the |
I am trying to synthesize choices of integers as well as forms inside a grammar, by using both the
??
and(choose ...
forms. I haven't been able to do it successfully yet. Below is a small test case. I am trying to map a struct consisting of three integers to another one where one of the integers has been copied to another. For example, I might specify that(A B C)
should become(A B B)
for all possible A, B, and C. The results are very strange. But first, the code:The result is quite peculiar:
(define (mover s) ((uop) s))
uop
is a label inside the grammar. What is it doing as part of the synthesized function? Did I do something wrong?If instead of asking the synthesizer to choose values for
srcno
anddstno
I replace the code labeled PROBLEM AREA (the lambda) with a(choose...
form that lists two possible implementations, it picks the correct one, anduop
does not appear in the result:Thanks for your help. I am excited to be getting started with Rosette.
The text was updated successfully, but these errors were encountered: