I’m looking for the best way to constrain variables to a set of terms in a similar way
freeze(X, member(X, [..values]) would. However, at some point later in the code I’d like to further refine these constraints in similar ways I would with CLP(FD), namely narrow the possible value set using eg.
dif or introduce rules like "if X is foo then Y must/cannot be baz`. I could just freeze multiple goals on the variables, but this seems messy, especially considering that compound terms would require me to deal with partial instantiation.
What I would rather do is use a solution similar to clp(fd). Some examples of how it would be used:
Tense in [praes, pf, fut], Mode in [ind, conj], Tense #= fut #==> Mode #\= conj. Decl in [1, 2, 3:a, 3:b], % ... Decl #= 3:_, Decl #/= 1. % etc
In general this problem looks much more difficult than FD because of (possibly cyclic) compounds. Since my domain is much simpler, I also thought about creating a dedicated solution using eg. CHR but I’m unsure if that’s a suitable tool for this kind of task, so any tips on that are appreciated.
Lastly, this has some common points with typing and type constraints, but the focus is on constraining the answer space not correctness checks.