|- Up -||Next >>|
Representation of DRSs in Prolog.
We will represent DRSs in Prolog as terms of the form
D is a list of terms representing the discourse referents, and
C is a list of other terms representing the DRS conditions. To represent complex conditions we use the same operator definitions as for first-order logic (but note that we are not going to use the operator for conjunction, since we don't need it in DRT).
Let's consider an example, the DRS for:
``Every man walks''
And in Prolog we represent this DRS as:
drs(,[drs([X],[man(X)]) > drs(,[walk(X)])]).
The translation function discussed in the previous section can now be implemented in Prolog as follows. We will use two predicates for this task:
drs2fol/2, translating DRSs to first-order formulas, and
cond2fol/2, translating DRS-conditions to first-order logic syntax.
drs2fol(drs(,[Cond1,Cond2|Conds]),Formula1 & Formula2):-
The way these three clauses recursively interact in the translation is by first working on the discourse referents, followed by translating the DRS-conditions. The third clause translates the discourse referents into existentially bound variables, the first clause translates exactly one DRS-condition, the second clause translates DRSs with at least two DRS-conditions.
cond2fol(~ Drs, ~ Formula):-
cond2fol(Drs1 v Drs2, Formula1 v Formula2):-
cond2fol(drs(,Conds) > Drs2, Formula1 > Formula2):-
cond2fol(drs([X|Referents],Conds) > Drs2, forall(X,Formula)):-
cond2fol(drs(Referents,Conds) > Drs2,Formula).
\+ Condition = (~_),
\+ Condition = (_ v _),
\+ Condition = (_ > _),
Translating the DRS-condition is done by using the five clauses above for
cond2fol/2. Straightforward are the first two clauses dealing with negation and disjunction. The third and fourth clause cover implicational conditions, and introduce universal quantifiers for discourse referents declared in the antecedent DRS of implications. The fifth clause, finally, deals with basic conditions.
|- Up -||Next >>|