CustomTheories

Hand-written theories (and their expected goal-to-solutions mappings), covering ->/2, ;/2 and member/2, consumed by TestSolver's testIfThen1/testIfThen2/testIfThenElse1/testIfThenElse2/testMember cases, as an alternative/complement to the standard-manual examples gathered in PrologStandardExampleTheories.

Properties

Link copied to clipboard

->/2 request goals over ifThenTheory1 and their expected Solutions, checking that the then (->/2) combinator commits to the first solution of its condition (here, a(1)) and never backtracks into it.

Link copied to clipboard

Same ->/2 request goals as ifThen1ToSolution, but run over ifThenTheory2 (a/1 clauses reversed).

Link copied to clipboard

then ... or ... (if-then-else) request goals over ifThenTheory1 and their expected Solutions, checking that the "then" branch is taken whenever the condition has a solution, and the "else" branch otherwise — again committing to the condition's first solution only.

Link copied to clipboard

Same if-then-else request goals as ifThenElse1ToSolution, but run over ifThenTheory2 (a/1 reversed).

Link copied to clipboard

A theory with two solutions for a/1 (a(1) and a(2), in this order) and a single fact each for b/1 (b(1)) and c/1 (c(2)), used together with ifThenTheory2 (which lists a/1's facts in the opposite order) to check that ->/2 and ;/2 commit to the first solution of their condition.

Link copied to clipboard

Same facts as ifThenTheory1, but with the two a/1 clauses in reverse order (a(2) before a(1)).

Link copied to clipboard

member/2 request goals and their expected Solutions: enumerating every element of a ground list via backtracking, and failing to unify against a list of non-matching structs.