- 
                Notifications
    
You must be signed in to change notification settings  - Fork 37
 
Description
Subject of the issue
If I parse an axiom (:derived (P ?v - mytype) (Q ?v))), the two occurrences of ?v are different variables. I am not sure whether I consider this a bug but it is definitively surprising and it took me a while to figure out why my code does not work as expected.
I did not check how it is with action parameters and variables occurring in the precondition and effect, but the situation is analogous.
Steps to reproduce
You can use the following PDDL domain (remove .txt suffix):
domain_same_variable_different.pddl.txt
import pddl
domain = pddl.parse_domain("domain_same_variable_different.pddl")
axiom = next(iter(domain.derived_predicates))
print(axiom)
var1 = axiom.predicate.terms[0]
var2 = axiom.condition.terms[0]
print("var1:", var1, "var2:", var2)
print("Is this the same variable?", var1 == var2)
print("Why not?") 
print("Type tags of var1:", var1.type_tags)
print("Type tags of var2:", var2.type_tags)
The output is:
(:derived (P ?v) (Q ?v))
var1: ?v var2: ?v
Is this the same variable? False
Why not?
Type tags of var1: frozenset({'mytype'})
Type tags of var2: frozenset()
Expected behaviour
I would have expected that the variables in the axiom condition assume the same type requirements as set in the head, so that the variables are actually equal.
Actual behaviour
They variables from the body have empty type tags and are thus different from the ones in the head.