Like, maybe it would be better to say:
check : in -> in -> in -> semidet.
synth : in -> in -> out -> semidet.
To say that both of those might fail, but are otherwise deterministic. Check with an output mode for the type would be:
check : in -> in -> out -> nondet.
Conversation
For more reading on how Mercury does it, you can have a look at the docs: mercurylang.org/information/do
1
Note that I'm not a Mercury developer, so I could be getting some of this wrong! knows more about this than me!
1
2
Yep. As says, each predicate may have more than one mode in Mercury, each mode has exactly one determinism (can fail, will not fail, may have multiple answers etc).
Each time you use a predicate the compiler can figure out which mode of that predicate you need.
1
2
In that way, the compiler knows statically the instantiation state of each variable at each moment of execution.
In Prolog this is dynamic and modes are provided mainly as documentation for humans. A variable you encounter may have a value, or no value, or a partial value.
1
2
or may have no value but may also be aliased with other variable with no value! Giving either a value gives the other the same value.
1
Thanks for the extra info! The added precision in those answers is most appreciated 🤩
1
2
NP. glad it helped. Happy to help with this stuff.
1
2
Just found 's nice docs on their mode headers, which might also be interesting for : swi-prolog.org/pldoc/man?sect
1
3
Hmm. I'd been wondering what happens in Makam if more than one of the :- lines [dunno right name, don't want to accidentally say wrong one] potentially applies. Is that the nondet/multi case here?
1
2


