Monotonicity vs magic #1007
Replies: 4 comments 1 reply
-
Epilogue: I now appreciate that whatever 'magic' there is in getting unexpected behavior from a program (in my application area at least!) is bad magic! So I have modernized my code to use the clean representation with |
Beta Was this translation helpful? Give feedback.
-
There is also a slightly different perspective. Many programs are written in such a manner that they accept "evaluable functors" some times and reject them by silent failure in other cases. This alone is not desirable regardless of the property of monotonicity. In your original case:
|
Beta Was this translation helpful? Give feedback.
-
Could someone explain to me, a new Prolog user, how this is a problem? It appears using negative numbers in a ℤ context will logically lead to weird behavior?... Thank you! Additionally it'd be nice to know why monotonicity is not the default already? Seems like the natural thing to do when implementing these types of things. |
Beta Was this translation helpful? Give feedback.
-
@lf94 : "Monotonicity" in this context refers to monotonicity of the logical consequence relation: Logically, weakening constraints that we impose on solutions can never lead to fewer solutions; it can at most lead to more solutions. If adding constraints to a program yields more solutions than before, then the program is not monotonic, and is not amenable to declarative reasoning methods that presuppose this basic logical property which holds in first order predicate logic. In the current default execution mode, ?- X #= 5. X = 5. So, according to this answer, But wait! What about the term ?- X = 2+3, X #= 5. X = 2+3. On the other hand, if we ask in a slightly different way, which logically ought to be equivalent, the system tells us that ?- X #= 5, X = 2+3. false. So, which is it? Is In the monotonic execution mode, these problems do not arise: ?- assertz(clpz:monotonic). true. ?- X #= 5. caught: error(instantiation_error,instantiation_error(unknown(_7721),1)) ?- X = 2+3, X #= 5. X = 2+3. ?- X #= 5, X = 2+3. caught: error(instantiation_error,instantiation_error(unknown(_7721),1)) Here, we get clean instantiation errors as an indication that too little is known at the moment to give a definite answer. In contrast to type and domain errors, instantiation errors cannot be replaced by silent failure. I have not yet enabled the monotonic execution mode by default in order to allow a smoother porting phase of existing programs to Scryer Prolog. However, with more applications depending on the monotonic execution mode due to safety considerations and the increasing necessity and demand for declarative debugging and reasoning methods about Prolog programs, enabling the monotonic execution mode by default becomes ever more tempting. To choose the best time for enabling the monotonic execution mode by default, I greatly appreciate input from Prolog programmers who use Scryer Prolog in their applications! |
Beta Was this translation helpful? Give feedback.
-
I'm very gradually coming to an understanding of the complaint about
clpz
's non-monotonicity, and am working toward appreciating its implications (if any) for my own applications to oncology dose-finding trials. After much discussion with @triska, my understanding is currently this: Our bare-minimum expectation for a system is that it will tell us "what holds" or "what there is." So a very worrisome behavior of a system would be that we ask it for "everything", it reports "everything" and then we ask whether a specific thing holds that wasn't in the report, and the system says "oh, yeah — that too."A system behaving like this loses our confidence, in much the same way as a taxpayer who acknowledges previously unreported income, when confronted with specific bank records.
Anyway ... as I consider
assertz(clpz:monotonic)
for my own Prolog code, I've undertaken this exploration, which I excerpt here:Beta Was this translation helpful? Give feedback.
All reactions