I have a language that describe a domain by predicates of arbitrary arity. For example, in first-order logic I can write the following rule:
PersonlivesInCountry(x,y) <-> person(x), PersonlivesInState(x,z), StateisInCountry(z,y)
In this exampple, all the pair in PersonLivesInCountry are exactly those who match the other restrictions. The key point here is to express the join between the other restriction, for example the z in common with PersonLivesInState and StateIsInCountry predicates. In my language, I always have this structure so I need to write a grammar to express this join condition. Is it possible to ensure that each exit index of a relation is in a (inner) join with the successor?