Answer extraction is useful (and meaningful only) when there are existential quantifiers at the outermost level of a conjecture. In this situation the conjecture can be considered to a question for which an answer is required, in the form of the values that instantiate the existentially quantified variables. This proposal describes how such instantiations can be returned in a standard and useful way.
fof(xyz,question, ? [X,Y,Z] : p(X,Y,Z)).
... and if the user wants values for only X and Z ...
fof(xyz,question, ? [X,Z] : ? [Y] : p(X,Y,Z)).
In THF there can be universally quantified variables outside the existentially quantified
variables, e.g., ...
thf(lambda,question, ! [A: $int,B: $int] : ? [R: $int] : ( ($difference @ A @ R) = B ) ).
... in which case the answer is a lambda term.
fof(some_p,axiom,? [X] : p(X) ).
fof(is_there_some_p,questions,? [X] : p(X) ).
The answer output lines are in the same style as SZS status and output lines.
fof(abc,axiom,p(a,b,c). fof(def,axiom,p(d,e,f). fof(xyz,question,? [X,Y,Z] : p(X,Y,Z) ).One answer:
% SZS answers Tuple [[bind(X,a),bind(Y,b),bind(Z,c)]]All answers
% SZS answers Tuple [[bind(X,a),bind(Y,b),bind(Z,c)],[bind(X,d),bind(Y,e),bind(Z,f)]]
Examples:
| Axioms | Question | Answer |
|---|---|---|
| | ||
| p(a,b,c) p(d,e,f) | ? [X,Y,Z] : p(X,Y,Z) | [[bind(X,a),bind(Y,b),bind(Z,c)]] One answer [[bind(X,a),bind(Y,b),bind(Z,c)],[bind(X,d),bind(Y,e),bind(Z,f)]] All answers |
| | ||
| p(a) p(b) a = b | ? [X] : ( p(X) & X != a ) | No answer (but compare with ? [X] : ( p(X) & ~$unify(X,a) ) below) |
| | ||
| ! [X] : p(X) | ? [Y] : p(Y) | [[bind(Y,X)]] |
| | ||
| ? [X] : p(X) | ? [X] : p(X) | No answer (Skolem's not permitted). This one is interesting - as a conjecture it's provable, but as a question it's not answerable. I like that! |
| | ||
| ! [Z] : p(Z) | ? [X] : p(f(X)) | [bind(X,Z1)] |
| | ||
| p(f(a)) | ? [X] : p(f(X)) | [bind(X,a)] |
| | ||
| Axioms for arrays, Swap array elements, array, indices i, j | ? [X: $o] : (X => (array[i] != array[j])) Switch the contents of array[i] and array[j] such that the resultant array is different. | [bind(X,(i != j) & (array[i] != array[j])] |
| | ||
| ! [X] : mul(inv(X),X) = id ! [X] : mul(id,X) = X ! [X,Y,Z] : mul(X,mul(Y,Z)) = mul(mul(X,Y),Z) | ? [X] : mul(e1,X) = id | [bind(X,inv(e1))] |
| | ||
| ! [X] : mul(inv(X),X) = id ! [X] : mul(id,X) = X ! [X,Y,Z] : mul(X,mul(Y,Z)) = mul(mul(X,Y),Z) ! [X] : mul(X,id) = X | ? [Z] : ( (mul(e1,e2) = Y) => (mul(Z,Z) != id) ) | [bind(Z,
$ite(mul(e1,mul(e2,e1)) = e2,
e1,
$ite(id = mul(e2,mul(e1,e2))),
e1,
mul(e1,e2))))]
|
| | ||
! [A: $int,B: $int] : ? [R: $int] : ( ($difference @ A @ R) = B ) | [^ [A: $int,B: $int] : bind(R,$uminus($sum($uminus(A),B)))] | |
| | ||
Examples:
| Axioms | Question | Answer |
|---|---|---|
| | ||
| p(a) p(b) p(c) | ? [X] : ( p(X) & ( $unify(X,a) | $unify(X,d) ) ) | [bind(X,a)] |
| | ||
| p(a) p(b) a = b | ? [X] : ( p(X) & ~$unify(X,a) ) | [bind(X,b)] |
| | ||
| ! [Z] : p(Z) | ? [X] : ( p(X) & ? [Y] : $unify(X,f(Y)) ) | [bind(X,Z)] |
| | ||
| p(f(a)) | ? [X] : (p(X) & ? [Y] : $unify(X,f(Y))) | [bind(X,f(a))] |
| | ||
| Axioms | Question | Answer |
|---|---|---|
| | ||
| sunday | monday monday => workshop(vampire) sunday => workshop(arcade) | ? [X]: workshop(X) | [bind(X,$ite(workshop(vampire),vampire,arcade))] |
| | ||
| sunday | monday monday => workshop(vampire) sunday => workshop(arcade) | ? [X]: ( workshop(X) & ~$contains(X,workshop) ) | [bind(X,vampire)] | [bind(X,arcade)] |
| | ||
| ! [X] : mul(inv(X),X) = id ! [X] : mul(id,X) = X ! [X,Y,Z] : mul(X,mul(Y,Z)) = mul(mul(X,Y),Z) | ? [X]: mul(X, mul(inv(a), inv(b))) != id | [bind(X,inv(mul(inv(a), inv(b)))] |
| | ||
| ! [X] : mul(inv(X),X) = id ! [X] : mul(id,X) = X ! [X,Y,Z] : mul(X,mul(Y,Z)) = mul(mul(X,Y),Z) | ? [X]: ( mul(X, mul(inv(a), inv(b))) != id & ~contains(X,inv) ) | [bind(X,TBA)] |
| | ||