20.07.2013 Views

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Stabler - Lx 185/209 2003<br />

1.2 Propositi<strong>on</strong>al prolog<br />

The programming language prolog is based <strong>on</strong> a theorem prover for a subset <strong>of</strong> first order logic. A pure prolog<br />

“program” is a theory, that is, a finite set <strong>of</strong> sentences. An executi<strong>on</strong> <strong>of</strong> the program is an attempt to prove some<br />

theorem from the theory. (Sometimes we introduce “impurities” to do things like produce outputs.) I prefer to<br />

introduce prolog from this pure perspective, and introduce the respects in which it acts like a programming<br />

language later.<br />

(Notati<strong>on</strong>) Let {a − z} ={a, b, c, . . . , z}<br />

Let {a − zA − Z0 − 9_} ={a,b,c,...,z,A,B,...,Z,0, 1,...,9, _}<br />

For any set S, letS∗be the set <strong>of</strong> all strings <strong>of</strong> elements <strong>of</strong> S.<br />

For any set S, letS + be the set <strong>of</strong> all n<strong>on</strong>-empty strings <strong>of</strong> elements <strong>of</strong> S.<br />

For any sets S,T,letST be the set <strong>of</strong> all strings st for s ∈ S,t ∈ T .<br />

language:<br />

atomic formulas p ={a − z}{a − zA − Z0 − 9_} ∗ | ′ {a − zA − Z0 − 9_ @#$% ∗ ()} ∗′<br />

c<strong>on</strong>juncti<strong>on</strong>s C ::= ɛ. | p, C<br />

goals G ::= ?-C<br />

definite clauses D ::= p:-C<br />

(Notati<strong>on</strong>) Definite clauses p:-q1,...,qn,ɛ.are written p:-q1,...,qn.<br />

And definite clauses p:-ɛ. are written p.<br />

The c<strong>on</strong>sequent p <strong>of</strong> a definite clause is the head, the antecedent is the body.<br />

(Notati<strong>on</strong>) The goal ?-ɛ. is written . This is the c<strong>on</strong>tradicti<strong>on</strong>.<br />

(Notati<strong>on</strong>) Parentheses can be added: ((p:-q)). isjustthesameasp:-q.<br />

inference: G, Γ ⊢ G [axiom] for any set <strong>of</strong> definite clauses Γ and any goal G<br />

G, Γ ⊢ (?-p, C)<br />

G, Γ ⊢ (?-q1,...,qn,C)<br />

if (p:-q1,...,qn) ∈ Γ<br />

semantics: amodelM=〈2,[[·]]〉 where 2 ={0, 1} and [[·]] is a valuati<strong>on</strong> <strong>of</strong> atomic formulas that extends<br />

compositi<strong>on</strong>ally to the whole language:<br />

[[p]] ∈ 2, for atomic formulas p<br />

[[A, B]] = min{[[A]], [[B]]}<br />

<br />

1 if [[A]] ≤ [[B]]<br />

[[B:-A]] =<br />

0 otherwise<br />

[[?-A]] = 1 − [[A]]<br />

[[ɛ ]] = 1<br />

metatheory: For any goals G, A and any definite clause theory Γ ,<br />

Soundness: G, Γ ⊢ A <strong>on</strong>ly if G, Γ ⊨ A,<br />

Completeness: G, Γ ⊢ A if G, Γ ⊨ A<br />

So we can establish whether C follows from Γ with a “reductio” argument by deciding: (?-C,Γ ⊢ ?-ɛ.)<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!