tableaux implemented a tableaux prover –representation of tableaux –translate tableaux rules to...

21
Tableaux Implemented A Tableaux Prover Representation of tableaux Translate tableaux rules to Prolog Bring together this week‘s results in a combined demo system to see whether our efforts have been worthwhile

Upload: jeffry-lloyd

Post on 18-Dec-2015

236 views

Category:

Documents


0 download

TRANSCRIPT

Tableaux Implemented

• A Tableaux Prover– Representation of tableaux– Translate tableaux rules to Prolog

• Bring together this week‘s results in a combined demo system to see whether our efforts have been worthwhile

Representing Signed Formulae in Prolog

true(walk(john) v talk(john))

false(walk(john)v talk(john))

Preprocessing

• Use logical equivalences:1. A B (A B) 2. A B (A B)

• true(walk(john) v talk(john)) => true(~(~walk(john)&~talk(john)))

• A simple prolog predicate does this for us (naonly/2).

How is the tableaux represented?

The Driver Predicate

theorem(Formula) :-

naonly(Formula,ConvFormula),

\+ tabl(false(ConvFormula),[],_).

There is no way of falsifying the converted input Formula.

If tabl/3 succeeds: Formula not valid.

If tabl/3 fails: Formula valid.

Representation of Tableaux

We collect literals.

One list per branch:

[L1,L2,L3]

[L1,L2,L4,L5]

[L1,L2,L4,L6]

…no more representation of the whole tableau.

L1

L2

L4L3

L5 L6

Scheme: tabl(InFormula,InBranch,OutBranch) :- …

For each connective and sign:tabl(false(~A),InBranch,OutBranch) :-…tabl(true(A&B),InBranch,OutBranch) :-…

The tabl/3 rules are straightforward translations of the tableaux rules. But some details are tricky.

Tableaux Rules in Prolog

Input 1: The formula to be analyzed

Input 2: A list of literals (branch above) Output: Literals from above

plus literals from analyses of InFormula

Conjunctive Expansion: Negation

tabl(true(~A),InBranch,OutBranch) :- !,tabl(false(A),InBranch,OutBranch).

tabl(false(~A),InBranch,OutBranch) :- !,tabl(true(A),InBranch,OutBranch).

Negation of input Formula is eliminated by a recursive tabl/3 call with reversed sign.

Conjunctive Expansion: Conjunction

tabl(true(A&B),InBranch,OutBranch) :-

!,tabl(true(A),InBranch,K),

tabl(true(B),K,OutBranch).

true(sleep(john)&~snort(john)) A=sleep(john)

InBranch = [true(sleep(mary))] B=~snort(john)

K = [true(sleep(mary)),true(sleep(john))]

OutBranch = [true(sleep(mary)),true(sleep(john)),

false(snort(john))]

Two recursive calls of tabl/3. One for each conjunct.Intermediate branch is „handed over“ in variable K.

Disjunctive Expansion I

• General Idea: Test branches one after another.

• Advantage: Two alternatives. If we come to the right branch, we can forget about the left one.

F2

F4F3

F5…

… …

Disjunctive Expansion II

tabl(false(A & _),InBranch,OutBranch) :- tabl(false(A),InBranch, OutBranch).

tabl(false(_ & B),InBranch,OutBranch) :- !,tabl(false(B),InBranch, OutBranch).

• If we succeed on the left branch to „prove“ false(A) without a clash, we stop (a model for the negation of our suspected theorem has been found).

• Else, we have to try the right branch.

• Use Prolog‘s backtracking mechanism to test one branch and then the other.

• Two clauses for tabl(false(A&B),…)

Base Case: Atomic Formula

tabl(AF,InBranch,OutBranch) :- OutBranch = [AF|InBranch],\+ clash(OutBranch).

clash(Branch) :- member(true(A),Branch),member(false(A),Branch).

1. If we reach a literal on some branch and there is no clash, we stop: a counter model has been found.

2. Else, we fail. This triggers backtracking for further „waiting“ disjunctive expansions.

Main Ideas of Our Implementation

• No explicit representation of the whole tableaux: We always work on one branch at a time.

• Branches are represented as lists of literals (nothing else matters).

• Use a sequence of Prolog calls to do tableaux construction:– Conjunctive expansion: one clause per conjunctive/sign

with recursive call(s).– Disjunctive expansion: two clauses with a recursive

call, backtracking if fail in first clause (i.e. no model found on left branch).

tabl(true(~A),InBranch,OutBranch) :- !,tabl(false(A),InBranch,OutBranch).

tabl(false(~A),InBranch,OutBranch) :- !,tabl(true(A),InBranch,OutBranch).

tabl(true(A & B),InBranch,OutBranch) :-!,tabl(true(A),InBranch,K), tabl(true(B),K,OutBranch).

tabl(false(A & _),InBranch,OutBranch) :-

tabl(false(A),InBranch,OutBranch).

tabl(false(_ & B),InBranch, OutBranch) :- !,tabl(false(B),InBranch,OutBranch).

tabl(AF,InBranch,OutBranch) :- OutBranch = [AF|InBranch],\+ clash(OutBranch).

Online Tableaux Interface

• See example: Interface.htm• Course Page

– Link to tableaux interfaced– All Prolog code for download– The reader– This week‘s slides – Corrected page of reader

• Do not hesitate to email us

Try it out!

The Proof of the Pudding is in the Eating

Towards the end of this course… … we show a system that combines semantics construction with our tableaux prover.

Given a model, we check whether a sentence is– Informative (is the information not already contained in

the model)– Contradictory– Consistent

Conversational Maxims

• Speaker and hearer obey some rules• H.P. Grice:

– Maxim of Quality: Tell the truth!– Maxim of Manner: Be relevant!– …

• Maximes (and violation hereof) is used in conversations (studied by Pragmatics)A:„Did you tell her you love her?“ B:„Oh, nice weather today“

Our System

• Example model M:– John is a man.– John does not smoke.– Every man is human.– Every human works.

• As large conjunctive Formula: man(john)&forall(x,human(x)>work(x))&forall(y,man(y)>human(y))&~smoke(john)

check :-lambda(F),M = man(john)&forall(x,human(x)>work(x))&forall(y,mancheckFormula(F,M).

checkFormula(F,M) :- theorem(M>F),nl, write('I know, I know...').

checkFormula(F,M) :-theorem(~(M&F)),nl, write('Impossible!').

checkFormula(_,_) :-nl, write('If you say so...').

Checking Consistency

theorem(~(M&F))Why does this ckeck whether F is inconsistent with

M?1. M contains no contradictions. 2. If (M F) is a theorem, then M F is a

contradiction. This must be due to F because of (1).

System Demo

Extending our System

• Argumentation, Syllogisms • Model extension

– Extend model with NL input

• Question answering– Question semantics, extend DCG…

• Check it out!• Other Systems using NLP and inference

– Curt (Blackburn/Bos)– Doris (Bos)

Thanks for your Interest... …enjoy Computational

Semantics!