-
Notifications
You must be signed in to change notification settings - Fork 0
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
Lute/reification step4 testing ast #39
Lute/reification step4 testing ast #39
Conversation
@jorgefandinno Okay, I've found some problems with how we are parsing strong negated and negated atoms when using reification. I just realized the issue of using "-" + name on the reify strong negation. Now, the expected program is an UnaryOperator, but the parsed program returns a function of name "-a" which I believe is incorrect. I believe that I'll have to make some changes on top of the previous reification changes to do it correctly, and to test for equal programs instead of strings. |
It makes sense
…On Fri, Sep 9, 2022 at 10:28 Lute Lillo ***@***.***> wrote:
@jorgefandinno <https://github.com/jorgefandinno> Okay, I've found some
problems with how we are parsing strong negated and negated atoms when
using reification. I just realized the issue of using "-" + name on the
reify strong negation. Now, the expected program is an UnaryOperator, but
the parsed program returns a function of name "-a" which I believe is
incorrect.
I believe that I'll have to make some changes on top of the previous
reification changes to do it correctly, and to test for equal programs
instead of strings.
—
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADF3ZUXKMMM3QBRK4PR6JEDV5NJRJANCNFSM6AAAAAAQHFY3SY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
if self.reification: | ||
return ast.UnaryOperation(location, 0, atom) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finally solved that issue when using reification. The problem was the declaration of the name "-a" of the Function when it should have been an UnaryOperation that had an ast.Function as argument with the name "a".
sorted_program = sorted(program) | ||
expected_program.sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, now I'm trying to figure out some issues for the asserting case of the lists being equal. While they are equal, they are being ordered in the wrong order and that is causing tests to fail. I'll look into it tomorrow
tests/test_reification.py
Outdated
def test_epistemic_atom_with_default_negation(self): | ||
self.assert_equal_program( | ||
parse_program(":- &k{ not a}."), | ||
":- k(not1(u(a))). not1(u(a)) :- not u(a). {k(not1(u(a)))} :- not1(u(a)).", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specially, I've seen it happening here. The tests with a #Fail above are the ones facing this issue. The rest of the tests are passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are each of them ordered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There you can see how the sorted program (which is the reference correctly parsed program) first has the rule not1(u(a)) :- ... while the expected program (The one we are parsing from the expected string) has the conditional Literal first
The first part of the tests that were failing due to the bug are now failing. However, I'm having some issues with these ones: eclingo/tests/test_reification.py Lines 215 to 238 in facbdc1
I'll check them later, but it may have something to do with the newly introduced transformer. Pylint is also failing, but I do not see where the error is. |
For the tests: def test_parameters01(self):
I'm getting another error, which the sorted program evaluates the Interval 1..n, as being Symbolic term of number 1 and another Symbolic term of a clingo Function with name 'n'. However, the way the Transformer is set, is that the 2nd Symbolic term is being transformed to an AST.Function of name 'n' and therefore failing the test. |
The idea I've had is to create another visit_Interval after this Transformer is being parsed and re-do the conversion of the interval components to Symbolic Terms, would that work? |
SymbolicTerm to Function Transformer.
Tests still needed to verify all working.