Implement unambiguous mapping for deterministic compiler#265
Implement unambiguous mapping for deterministic compiler#265
Conversation
|
To reproduce the problem in 25bacb0: this is the This is the problem file: This is the goal formula: Run: This produces: and problem: The planner cannot find the plan: However, when running it for the old compilation, it works:
Note that the new mapping with a smaller problem works well: where |
solved offline with @francescofuggitti |
| result: Set[When] = set() | ||
| for p in predicates: | ||
| if p.name.startswith("Y-"): | ||
| present_predicate = Predicate( | ||
| add_val_prefix(remove_yesterday_prefix(p.name)) | ||
| ) | ||
| past_predicate = p | ||
| else: | ||
| formula = mapping.inverse_mapping[p] | ||
| if isinstance(formula, Before): | ||
| arg_predicate = mapping.mapping[formula.argument] | ||
| present_predicate = Predicate(add_val_prefix(arg_predicate.name)) | ||
| past_predicate = p | ||
| else: | ||
| present_predicate = Predicate(add_val_prefix(p.name)) | ||
| past_predicate = p | ||
|
|
||
| positive_when = When(present_predicate, past_predicate) | ||
| negative_when = When(Not(present_predicate), Not(past_predicate)) | ||
| result.update({positive_when, negative_when}) | ||
| return result |
There was a problem hiding this comment.
we cannot just remove the "Y-" prefix since now we have quoted.
However, we still have some predicates as Y-quoted_0, which must be handled with the old approach.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #265 +/- ##
==========================================
- Coverage 90.95% 90.83% -0.12%
==========================================
Files 22 22
Lines 984 1037 +53
==========================================
+ Hits 895 942 +47
- Misses 89 95 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Since the mapping from predicate to formula now uses an incremental id with the "quoted_" prefix, the "Y-" prefix to denote yesterday formulas is not needed anymore.
Proposed changes
Continuation of #262 from the new tip of the project (i.e. after #264).