drop anonymous variables when considering if negation is safe
parent
e8aa5eb333
commit
7a4c963ee7
|
@ -89,6 +89,7 @@ isNegationSafe (Rule _ body_) =
|
|||
|> (\{ positive, negative } ->
|
||||
negative
|
||||
|> Set.dropIf (Set.memberOf positive)
|
||||
|> Set.dropIf ((==) Term.Anonymous)
|
||||
|> Set.isEmpty
|
||||
)
|
||||
|
||||
|
|
|
@ -38,6 +38,14 @@ ruleTest =
|
|||
, negative (atom "reachable" [ variable "a", variable "b" ])
|
||||
]
|
||||
|> Expect.ok
|
||||
, test "negative terms which are introduced outside the head are still allowed if they appear in positive form" <|
|
||||
\_ ->
|
||||
rule
|
||||
(atom "peopleWithoutEmails" [ variable "Name" ])
|
||||
[ positive (atom "people" [ variable "Id", variable "Name" ])
|
||||
, negative (atom "peopleToEmails" [ variable "Id", anonymous ])
|
||||
]
|
||||
|> Expect.ok
|
||||
, test "negative terms are not allowed if they don't also appear in a positive form" <|
|
||||
\_ ->
|
||||
rule
|
||||
|
|
Reference in New Issue