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

Fix lex issue in #456 #477

Merged
merged 10 commits into from
Mar 14, 2020
Merged

Fix lex issue in #456 #477

merged 10 commits into from
Mar 14, 2020

Conversation

fraser-dunlop
Copy link
Collaborator

I have added the failing examples from #456 as regression tests and fixed the underlying bug. The fix was relaxing the filter on rule_Flatten_Lex so that it no longer was activated for types that don't need flattening.

@fraser-dunlop
Copy link
Collaborator Author

All the tests should pass on this since the only failing case was the unexpected allDiff output in cyclic_graph.

@fraser-dunlop
Copy link
Collaborator Author

@ozgurakgun I suggest we merge this. Azure seems to be happy but it is not reporting completion through to the github hooks for some reason.

@ozgurakgun
Copy link
Collaborator

ozgurakgun commented Mar 4, 2020 via email

@@ -0,0 +1,3 @@
find A : set of int(1..10)
find B : set of int(1..10)
such that A .< B
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be testing for this in the input? I am sure we don't support .< between two different representations. You get away with it here thanks to compact.

Just do find s : set (size 2) of set of int(1..10) which would create .< constraints internally then refine them?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the rest of the files now I see there is a bunch of other .< constraints in the input.

Maybe we can group them in a tests/custom/dotless directory? I think these will eventually go and be replaced by just <.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the plan was to get .< working in the way we want < to be? Or should it only be supporting the core tree language?

There are lots of tests with .< I think. They will of course be changed to < when we upgrade its power.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to leave .< alone. It works by treating all of the variables of the representation as a block and putting lex between them. The two operands must have the same domain and must be represented in the same way.

We also want to leave ~< alone as well. This is a correct way of ordering anything independent of representation or domain. They must have the same type of course.

We want to implement < for all types using symmetryOrder etc. The hope is this new family of comparators will be as efficient as .< and as generic as ~<.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Currently I match on .< and flatten both sides. So I should instead do that with <?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I just want to conform to the spec. What do you mean by touching .< at all?

Do you want to revert to rule_DotLtLeq before it called symmetryOrdering and introduce a rule_LtLeq that does what rule_DotLtLeq currently does?

Copy link
Collaborator

@ozgurakgun ozgurakgun Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, AFAIK, before this PR the dot-less handling is correct. And we don't want to change it. We don't necessarily want to test it in this way either since it is generated as part of almost all tests and works correctly anyway.

Am I missing something?

And yes, the new implementation that will work on every operand should just work on <.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so if I remove the test on sets which doesn't make sense for .< and clean up the comments in the expected files we should be good to merge?

I'll work on the < implementation in a separate branch from this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! I am at work today so should be able to stay in the loop as you commit more stuff to this pr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

branching on [A_Occurrence, B_Occurrence]
such that [-toInt(A_Occurrence[q3]) | q3 : int(1..10)] <lex [-toInt(B_Occurrence[q4]) | q4 : int(1..10)]

$ Conjure's
Copy link
Collaborator

@ozgurakgun ozgurakgun Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like committing the comment lines as part of test results. Use head -n7 to filter them out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing.

flatten([flatten([[-toInt(A_1[q3]); int(1)], [-toInt(A_2[q3]); int(1)]; int(1..2)]) | q3 : int(0..1)]) <lex
flatten([flatten([[-toInt(B_1[q4]); int(1)], [-toInt(B_2[q4]); int(1)]; int(1..2)]) | q4 : int(0..1)])

$ Conjure's
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with the comment lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will have to go through the lot and apply a filter. Not a problem though.

Copy link
Collaborator

@ozgurakgun ozgurakgun Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want a generic filter see this.

@ozgurakgun
Copy link
Collaborator

Hi @fraser-dunlop - I am keen to merge this but I see the .< tests (and the comments in them) are still in the PR. Do you want to keep them? What's your plan?

I have a bunch of local changes that I'd like to push (shouldn't conflict with yours) but wanted to check with you first.

@fraser-dunlop
Copy link
Collaborator Author

Hi @fraser-dunlop - I am keen to merge this but I see the .< tests (and the comments in them) are still in the PR. Do you want to keep them? What's your plan?

I have a bunch of local changes that I'd like to push (shouldn't conflict with yours) but wanted to check with you first.

We can go ahead and merge I think. I used this to remove the comments

grep "^[^$]"

Which tests are you referring to? If it is a case of .< in the tests when it should be < then I think we can merge and deal with that in another PR.

@ozgurakgun
Copy link
Collaborator

@fraser-dunlop
Copy link
Collaborator Author

Sorry, must have missed those. They are all fine now I think...

@ozgurakgun ozgurakgun merged commit 2dfd8d2 into master Mar 14, 2020
@ozgurakgun ozgurakgun deleted the fix-lex branch March 14, 2020 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants