Replies: 17 comments
-
Summaryhttps://github.com/MelindaFang-code/bril/blob/main/assignment/task13/foo.py Hardest PartThe most challenging part of this task is to define the grammar of array and represent array as constraint. We studied and experimented with Lark a lot to define the grammar of array. After defined array, we have to represent array access as arithmetic expressions. TestingFor testing, we constructs some manual test cases. This covers cases such as array index being an variable and array elements being accessed as variables. |
Beta Was this translation helpful? Give feedback.
-
Vivian and I worked on lesson 13 together. Summary
Implementation details
What was the hardest part of the task? How did you solve this problem?
crashed Vivian's computer, while
returned almost instantly.
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
SummaryDetailsI extended the synthesizer from the tutorial with imperative assignments. Each program consists of a sequence of assignments to variables followed by evaluation of an expression representing the result of the program. For example, the following program swaps
Given an appropriate sketch, the synthesizer can come up with the equivalent XOR-swap version:
The solver discharges the goal instantly. DifficultiesMostly just keeping track of the Z3 variables: which ones needed to be the same across programs, and which ones are bound at any given point in time. |
Beta Was this translation helpful? Give feedback.
-
SummaryFor this assignment, I modified the ex2.py program to include the exponent operator, for constant exponents. This required some changes to the grammar and the interpreter, but was overall fairly straightforward to implement. My code can be accessed here. Hardest partThe most challenging part of this assignment is that Z3 does not support non-linear constraints. I can get around this by encoding x^n as x * x n times, which means I can support this for constant exponent values. TestingI created some handwritten test cases. Despite the fact that holes and variables cannot be placed as the exponent, I was able to come up with some interested examples that the synthesizer was able to solve. Given more time in the future, I would love to mess around with using Z3 and an interpreter to come up with some more interesting programs. Perhaps some sort of IMP language, where the synthesizer can look through the entire search space (this might explode really fast with a language like IMP) to find equivalent programs. |
Beta Was this translation helpful? Give feedback.
-
I worked with @obhalerao on this assignment. We were inspired by the discussion of strength reduction in our compilers class and wanted to see if this library could be used to search for strength reductions automatically. ImplementationWe came up with two improvements to the code:
TestingTo demonstrate the first improvement, we used the following testcase on bitvectors of width 8:
The expected output is something like For the second improvement, we changed the width to 32 and used the following testcase:
Based on Wikipedia, we expect that for a value of This part of the assignment was the most fun, we did some more reading on general magic division but didn't have time to implement a more fleshed out pipeline. |
Beta Was this translation helpful? Give feedback.
-
SummaryI modified ex2.py to include a sketch-like disjunction of expressions which is basically sugar for nested condtionals. So for example, TestingI added a few sketches, first starting with rewriting
I also wrote some sketches testing the new bitwise operators such as this one which Z3 solved instantly
|
Beta Was this translation helpful? Give feedback.
-
Summary
DetailsI used the Testing/Evaluation and Difficulties
But this would not work:
|
Beta Was this translation helpful? Give feedback.
-
Summarize what you did.
Explain how you know your implementation works—how did you test it? Which test inputs did you use? Do you have any quantitative results to report?
What was the hardest part of the task? How did you solve this problem?
|
Beta Was this translation helpful? Give feedback.
-
@xalbt , he-andy, and I worked together on lesson 13. SummaryImplementation
DifficultiesOur biggest difficulties were with Testing
the corresponding
the corresponding bonus:
|
Beta Was this translation helpful? Give feedback.
-
A very simple synthesizer using Z3. I have added exponentiation via the operator The only challenge I faced was the one mentioned by Benny as well: I had to implement |
Beta Was this translation helpful? Give feedback.
-
@rcplane and @zachary-kent worked together SummaryWe extended the grammar of minisynth to include mutable Implementation
Tests and Results
Difficulties
Generative AI
|
Beta Was this translation helpful? Give feedback.
-
SummaryI wrote two small snippets for this week's assignment.
I read that there are functions in Z3 from the Z3py documentation and wanted to try it out. Perhaps not the most exciting example, but I found it a little surprising that it didn't spit out the same formula but instead rewrote it slightly
ChallengesI feel like I have only scratched the surface of Z3. I see that it is able to solve sudoku and eight queens, a flavor of subset-sum etc. but it is not easy to formulate a problem in Z3 terms. I tried to solve 3-sum (see if there are three elements in an array that sum to a target) but ran into an issue
|
Beta Was this translation helpful? Give feedback.
-
Summary
Implementation
Testing
Difficult partLearning z3 is the biggest headache for me. I actually started with adding logic operations to the example grammar but later realized that symbolic values can not be used with python's |
Beta Was this translation helpful? Give feedback.
-
SummaryI worked on this with @emwangs. See the repo here. ImplementationWe added more arithmetic operations to the example from class - we were both a bit busy this week so we opted not to do anything super ambitious. It was simple enough though - we just had to modify the grammar, interpreter, and pretty printer a bit to support operations such as MOD and XOR. Testing/EvaluationI wrote one test per new instruction added. One of the interesting ones was MOD:
which gave:
DifficultiesNone! We found this one to be pretty fun :) |
Beta Was this translation helpful? Give feedback.
-
SummaryIn this assignment, I worked from ex2.py and supported more binary operations. Implementation and TestingI added implementation and updated the grammar to support more binary operations, namely |
Beta Was this translation helpful? Give feedback.
-
@20ashah and I implemented the following here Implementation The main features we added to the language were simply the boolean operators
However, we wanted to be able to verify the equivalence of slightly more complex expressions such as De Morgan’s Law:
The desired output would be To implement this functionality, we modified the Next, the Z3 Testing De Morgan’s Law Input:
Output:
Distributive Input:
Output
Absorption Input:
Output:
Challenges The Input:
When running this example, our synthesizer would hang until we aborted the program. We weren’t sure if this was an example you discussed where Z3 would take a while or if there was an issue on our end. It seemed like our program should’ve been able to support this but my guess is that we’re still missing something. Either way - this was a fun task! |
Beta Was this translation helpful? Give feedback.
-
The tasks for the program synthesis lesson are extremely open-ended: just do something interesting on top of the basic synthesizer that we built in class!
Beta Was this translation helpful? Give feedback.
All reactions