Replies: 2 comments 1 reply
-
I don't think that it makes sense to make such predicate, for exactly same reason as you've mentioned yourself – the only thing I see is to use when/2 to delay it... |
Beta Was this translation helpful? Give feedback.
-
It would help to look at the applications you have in mind. The easiest way to check if a predicate may have a declarative meaning is to see if its entire meaning can be derived from just considering ground literals. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ISO Prolog (with Cor.2) has the predicate
subsumes_term/2
. You can read the definition in the link, but it basically encodes the concept of a term being "more general" than another. It is clearly not monotonic, but it also isn't transitive:term_instance/2
resolves the transitivity problem by copying one of the terms before callingsubsumes_term/2
:This effectively makes it decouple the variables from one argument from the variables of the other, and therefore only looks at the "shape of the holes" left by the variables to see if they fit into each other. By being reflexive (every term is an instance of itself) and transitive, it induces a preorder in the set of Prolog terms. Up to isomorphism this gives us a partial order. I've been thinking deeply about the nature of monotonicity of entailment and how to properly formalize the concept of monotonicity in the context of Prolog, and I'm quite confident that the preorder that
term_instance/2
induces is essential for that. It also seems useful for implementing "pattern matching" (the normal language kind, not general unification), which is what made me think about this again recently (see bakaq/bakage#22 (comment)).Unfortunately, it is still not monotonic:
The problem I want to solve then is the following: is it possible to make an
_si
version ofterm_instance/2
that is sufficiently useful? That is, a predicate that throws instantiation errors when it can't properly guarantee monotonicity. Equivalently, what is the set of conditions that the arguments need to satisfy so that no answers are lost by the rawterm_instance/2
?My intuition is that this is not possible to do for the same reasons that a
var_si/1
predicate is quite absurd, but I really want to be wrong because this would be an incredibly useful building block for many things. If a good behavior forterm_instance_si/2
can be found, we can then do_t
(for use withif_/3
) and maybe even_c
(constraints) based on it.A first observation is that if this is indeed possible to do, the examples I used above for non-monotonicity should give:
Beta Was this translation helpful? Give feedback.
All reactions