completeness and expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר...

26
Completeness and Expressiveness

Upload: chloe-ball

Post on 28-Mar-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Completeness and Expressiveness

Page 2: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

תזכורת למערכת ההוכחה של אקסיומות לוגיקה מסדר ראשון:

1. ))((2. )))(())()(((3. )))F(F((4. )v)()v((

v אינו חופשי ב- כאשר

5. v(v)(t). אשר מופיע קשור ב--tכאשר אין משתנה ב

Page 3: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

אקסיומות נוספות עבור שוויון. נחזק אותן עבור הוכחה יותר

קלה...

6 t t=t7 (t1=t2) ((t1) (t2))

מתקבלות מנוסחא משותפת(t1)ו- (t2)כאשר (v)על ידי החלפת )חלק מ(המקומות החופשיים

, בהתאמהt2 או t1ב v של לא נקשר לכמת t2 או t1כאשר אף משתנה ב

. ב-

Page 4: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

כללי הוכחה MP (Modus Ponens)

GEN (Generalization)(v)x (x)

אינו מופיע חופשי באף אחת מההנחות vכאשר

Page 5: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Goal: we want to prove Our first order logic proof system is sound

and complete. That is: |-- if and only if |==

Soundness: |-- implies |== Check that the axioms are tautologies.Check that the proof rules preserves truth.Then, by induction on length of proof any model and assignment that satisfy , satisfies any line in a proof, in particult the last one .

Page 6: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Consistency: a syntactic definition, related to the proof system.

A set of formulas is consistent if there is no formula such that |-- and |--(F).

Equivalent definition: |-/-F. Equivalently: is inconsistent if for

each , |--.

Page 7: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Lemma |-- iff {(F)} is inconsistent. Proof: if {(F)} is inconsistent

then {(F)} |--. Also, {} |-- .(why?) Therefore, by “proof by cases”, |--.Conversely, if |-- then from {(F)} we can prove F (using MP), thus {(F)} is inconsistent.

Consequence: |-/- iff {(F)} consistent.

Page 8: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

More connections

If is consistent then either {(F)} or {} is consistent.Proof: if both are inconsistent, then we can prove from {(F)} and from {}. Hence, we can prove using “proof by cases” from . Contradiction.

is consistent iff every subset of it is consistent.

Page 9: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

More connections

|== iff {(F)} is unsatisfiable(why?)

If is satifiable then either {(F)} or {} is satisfiable.

Page 10: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

is consistent is satisfiable.

Easy direction: If is inconsistent, given the soundness of the proof system, its is unsatisfiable. (why?)

Converseley: From consistent we fom maximal consisten as follows (hard proof).

Page 11: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

is consistent is satisfiable

.נראה את המקרה של מספר נוסחאות בר מניה נסדר את כל הנוסחאות לפי סדר מסויים )אלפבתי, כמו

בספר טלפונים( 0, 1, 2.… ,

נבנה סדרה הולכת וגדלה של קבוצות נוסחאות=0 12.…:כדלקמן

i = i+1{ iקונסיסטנטית אזי }}i i אם } .i = i+1אחרת

נגדיר*=0 12.… * היא קונסיסטנטית. כי אם אפשר להוכיח ממנה כל

, ולכן אפשר להוכיח את זה גם Fדבר, אפשר להוכיח גם מתת קבוצה סופית שלה, בסתירה לבניה.

Page 12: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

*תכונות של

עבור נוסחא כלשהי לא יתכן שגם , וגם ( F ) .* שניהם ב-נמצאיםאחרת, באיזה שלב, שתי הנוסחאות היו הוכחה:

נמצאות, והיינו מקבלים קבוצה לא קונסיסטנטית... עבור נוסחא כלשהי או ,או ( F )ב-נמצאים .*

. * נמצאים ב אינם i (F=)ו- =k הוכחה: נניח כי ומכאן לפי }F --|{ k וגם }F --|{(F) i אזי

|--F max(i,k)"הוכחה לפי מקרים" ומונוטוניות נובע כי בסתירה לבניה.

-כלומר, כל נוסחא או השלילה שלה נמצאים ב* אבל .* נמצא ב אז --| לא שניהם. לכן גם: אם

Page 13: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

*תכונות נוספות של

Fאינה נמצאת ב * () -נמצא ב * אם ורק אם ( או (F

.*נמצאים ב-n נניח כי()* -נמצא ב אם .( וגם (F אינם

אבל אז .* נמצאים ב- וגם F) אזי )* נמצאים ב-מתקיים

{, (), (F)--|} F ..סתירהnאם נמצאת ב * אזי גם () נמצאת ב *.

.MP( ו-1A ()) הוכחה:שימוש ב-nאם (F) נמצאת ב * אזי גם () נמצאת ב *.

* |-- ()הוכחה: נראה ש כהנחה נוספת, יחד עם שימוש בדדוקציה מעביר את

(F).ניתן להוכיח כל דבר

Page 14: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Problem If we have in * a formula x (x ), we want to have

(t )* for some term t. In fact x (x ) cannot appear in *.

Instead we will have (x ((x ) F)F)

Then * is closed under withnesses. This may not hold. So we’ll add for each such formula a new variable y

and add (y). [This may extend the set of variables!]We obtain 1 and now perform the * closure on it again to obtain 1

* We obtain like that now 2

* 3* ...

We take #= i*

What we proved before holds also for #

Page 15: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Show that is # consistent.

Suppose, by contradiction that when we add (y) to the current set P we obtain an inconsistent set. Thus, P{(y)} |-- F.

From deduction we obtain P |--(y )F From GEN we obtain P |-- y (y)F,

which is in contradiction to (x ((x ) F)F), which is already in the set of formulas.

Page 16: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

We now have “closed under withnesses”

x (x ) =(x ((x ) F)F) is in # iff there is some t such that (t ).

Left to right direction, from construction, by adding the new varaible.

Right to left direction:Suppose that we have (t )#. Assume for the contradiction that the negation, x ((x ) F) is # . Then using A5 we havex ((x ) F) ((t) F) and using MP we have ((t) F), which cannot be consistent with (t )#.

Page 17: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

מכאן...

קבוצת הנוסחאות# מתנהגת כסמנטיקה של הנוסחאות תחת הצבת אמת.

הערך שקבועc מקבל הוא הסימן c.הערך שמשתנהv מקבל הוא הסימן v. באינדוקציה, הערך שביטויt מקבל הוא t. יחסR(t1,t2,...)מתקיים אם הנוסחא

R(t1,t2,...) -נמצאת ב #. כל הנוסחאות של -נמצאות ב #

,כמו במקרה של לוגיקת פסוקים, הטענות הקודמות מראותבאינדוקציה על מבנה הנוסחא שהצבה זאת מתנהגת כהצבה

לוגית. לכן, אם קבוצת נוסחאות הינה קונסיסטנטית, יש לה מודל

)מבנה והצבה שמספקים אותה(.

Page 18: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Continuing... Suppose now we also have equivalence. What happens when we have t1=t2? We take as an interpretation of a

constant c all the equivalence class of all the terms t such that c=t holds. We denote this by [c] (or, [t]).

Using the axioms A6 and A7 it follows that this definition is consistent, i.e., that if t1=t2 then (t1) is in # iff (t2) is in #

Page 19: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Completeness follows

We want to prove that |== implies |--.Equivalently: |-/- implies |=/=.

|-/- implies that {(F)} is consistent.

Therefore, {(F)} is satisfiable.

Thus, |=/=.

Page 20: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Therefore:

Recall: |-- if and only if there is some finite 0 such that 0|-- (why?)

Thus: |== if and only if there is some finite 0 such that 0|== (why?)

This is called “Compactness theorem”.

Page 21: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

We can express some classes of structures (why not

sets?)

1. xR(x,x)2. xy(R(x,y)R(y,x))3. xyz ((R(x,y)/\R(y,z))R(x,z))We can write this using one formula!This defines the structures with R

being an equivalence relation!

Page 22: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Provability Suppose we have a class of structures C and we

want to prove something about this class. Suppose we can write a set of formulas such

that a structure S is in that class iff S satisfies all the formulas in (with having no free variables).

Then every property of the structures in C satisfies that |==.

Proof: every structure that satisfies all the formulas in is in C and therefore satisfies .

Since we have completeness, |--, thus having allows us to prove .

Page 23: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

A class of structures with infinite set of elements

Let i be a sentence that says that we have at least i elements:2 = xy(x=y), 3 = xyz (((x=y)/\(y=z))/\(x=z))…etc.

Call these collection of sentences .

Page 24: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Some inexpressiveness of first order logic We want to say that we have a finite number

of elements in our domain. Suppose (for the contradiction) that we

express exactly that using . Now, take and any finite subset of . It is

satisfiable (by a structure with at least as many element as the highest index in the subset.

Thus, every subset of is also satisfiable. By compactness, is also satisfiable – but it

has an infinite model!!! Contradiction.

Page 25: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

Having an algorithm for doing the proof?

If |== then by completeness |--. We can enumerate all the possible

proofs from . Say, each time to the i th step. Given enough memeory and time, if there is a proof, it would come out(recursive enumerable).

On the other hand, one can write a set of formulas describing the behavior of a model equivalent to Turing machines, and a formula describing termination. Therefore, proving |-- is not decidable.

Page 26: Completeness and Expressiveness. תזכורת למערכת ההוכחה של לוגיקה מסדר ראשון : אקסיומות 1. ) ) (( 2. )) ) (( )) ( ) ((( 3. ))) F( F( ( 4. )

The big picture For some classes of structures C we can find a set of

first order formulas that are satisfied exactly by structures in C.

For some other structures C, there cannot be such a set of formulas (even an infinite set). Inexpressiveness of FOL.

In case we can find the set of formulas and is a property of C, then we can use our (complete) proof system to prove |--. This will imply that is a property of C.

But while the proof exists, we do not have a decision procedure that will check whether |-- and there is no limit on the amount of time and space needed for reaching such a proof when it exists.