Representing logical disjunctions in Constraint Handling Rules
问题 I am writing a constraint solver in Prolog that implements a simple logical formula: "(alive(A) and animal(A)) iff (awake(A) or asleep(A))" . I found one way to implement it in Constraint Handling Rules, but it is much more verbose than the original formula: :- use_module(library(chr)). :- chr_constraint is_true/1. is_true(A) \ is_true(A) <=> true. is_true(alive(A)),is_true(animal(A)) ==> is_true(awake(A));is_true(asleep(A)). is_true(awake(A)) ==> is_true(animal(A)),is_true(alive(A)). is_true