Answer Extraction for TPTP

by Geoff Sutcliffe, Michael Rawson, Petra Hozzova, Mark Stickel, Stephan Schulz,


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.


Questions

The new question role is introduced to identify conjectures for which the bindings for the outermost existentially quantified variables are wanted. Questions are written like conjectures, but using the question role instead of the conjecture role. The outermost existentially quantified variables are the ones that the user wants values for, i.e., their sets of instatiations are the answer.
    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)).

Answers

Answers are bindings for the outermost existentially quantified variables.

For returning answers, two SZS answer forms are proposed:

The answer output lines must be preceded by an SZS status line.


Running Example

The following problem, from the problem file ANS001+1, is used as the running example ...
    fof(abc,axiom,p(a,b,c)).
    fof(def,axiom,p(d,e,f)).
    fof(ghi_or_jkl,axiom,( p(g,h,i) | p(j,k,l) )).
    fof(qq,axiom,! [U,V] : q(U,V) ).
    fof(xyz,question, ? [X,Y,Z] : ! [W] : ( p(X,Y,Z) & q(X,W) ) ).

The AnswerBindings Form

The tuple form is ...
    SZS output start AnswerBindings
    answer bindings one per line
    SZS output end AnswerBindings
... e.g., ...
    % SZS status Success for ANS001+1
    % SZS output start AnswerBindings
    [bind(X,a),bind(Y,b),bind(Z,c)]
    [bind(X,d),bind(Y,e),bind(Z,f)]
    % SZS output end AnswerBindings

Disjunctive answers can also be expressed, e.g., ...

    % SZS status Success for ANS001+1
    % SZS output start AnswerBindings for ANS001+1
    [bind(X,g),bind(Y,h),bind(Z,i)] | [bind(X,j),bind(Y,k),bind(Z,l)]
    % SZS output end InstantiatedFormulae for ANS001+1

A final line with variables indicates that there might be more answers than the preceding tuples, e.g., ...

    % SZS status Success for ANS001+1
    % SZS output start AnswerBindings
    [bind(X,a),bind(Y,b),bind(Z,c)]
    [bind(X,d),bind(Y,e),bind(Z,f)]
    [bind(X,X),bind(Y,Y),bind(Z,Z)]
    % SZS output end AnswerBindings

The InstantiatedFormulae Answer Form

The instantiated formulae form provides answers in the TPTP annotated formula format, so that answers can be used as input to other tools. The instantiated formulae form is ...
    % SZS answers start InstantiatedFormulae for ANS001+1
    instantiated annotated formulae
    % SZS answers end InstantiatedFormulae for ANS001+1
... e.g., ...
    % SZS status Success for ANS001+1
    % SZS output start InstantiatedFormulae for ANS001+1
    fof(xyz,answer, ! [W] : ( p(a,b,c) & q(a,W) ) ).
    fof(xyz,answer, ! [W] : ( p(d,e,f) & q(d,W) ) ).
    % SZS output end InstantiatedFormulae for ANS001+1
Disjunctive answers can also be expressed, e.g., ...
    % SZS status Success for ANS001+1
    % SZS output start InstantiatedFormulae for ANS001+1
    fof(xyz,answer, ! [W] : ( ( p(g,h,i) & q(g,W) ) | ( p(j,k,l) & q(j,W) ) ) ).
    % SZS output end InstantiatedFormulae for ANS001+1

A final line with existentially quantified variables indicates that there might be more answers than the preceding instantiated formulae, e.g., ...

    % SZS status Success for ANS001+1
    % SZS answers start InstantiatedFormulae for ANS001+1
    fof(xyz,answer, ! [W] : ( p(a,b,c) & q(a,W) ) ).
    fof(xyz,answer, ! [W] : ( p(d,e,f) & q(d,W) ) ).
    fof(xyz,answer, ? [X,Y,Z] : ! [W] : ( p(X,Y,Z) & q(X,W) ) ).
    % SZS answers end InstantiatedFormulae for ANS001+1


Additional Control

$unify

What we seem to need is $unify/2 that (tries to) unify two expressions. It would be quite simple to implement (but needs to take symmetry into account if equality is used in either argument).

Axioms Question Answer

p(a), p(b), a = b ? [X] : ( p(X) & X != a ) No answer

p(a), p(b), a = b ? [X] : ( p(X) & ~$unify(X,a) ) [bind(X,b)]

! [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(X) & ? [Y] : $unify(X,f(Y))) [bind(X,Z)]

p(f(a)) ? [X] : (p(X) & ? [Y] : $unify(X,f(Y))) [bind(X,f(a))]

! [Z] : p(Z) ? [X] : p(f(X)) [bind(X,Z1)]

p(f(a)) ? [X] : p(f(X)) [bind(X,a)]

Aunt Agatha
? [X] : 
  ( killed(X,agatha) 
  & ( $unify(X,agatha) 
    | $unify(X,butler) 
    | $unify(X,charles) ) )
[bind(X,agatha)]

p(a) & p(b) ? [X] : ( p(X) & ~$unify(X,a)) [bind(X,b)]

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))))]

$contains

Petra would also like $contains/2 that tests if a certain symbol occurs in an expression. It would be quite simple to implement.

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)]