Documente Academic
Documente Profesional
Documente Cultură
2015-2016
Programare Logica
1 / 34
Scop
Fie (S, ) o signatura multisortata.
2 / 34
Scop
Fie (S, ) o signatura multisortata.
2 / 34
Cuprins
1 Deductie ecuational
a
Cazul neconditionat
Cazul conditionat
2 Logica ecuational
a
Corectitudinea
Completitudinea
3 / 34
Deductie ecuationala
4 / 34
Doua variante
Vom ncerca s
a ntelegem ce nseamn
a E ` (X )t =s t 0 .
Cazul conditionat:
multime de ecuatii conditionate.
Vom ncerca s
a ntelegem ce nseamn
a ` (X )t =s t 0 .
5 / 34
Cazul neconditionat
6 / 34
7 / 34
(X )t =s t
7 / 34
(X )t =s t
(X )t1 =s t2
(X )t2 =s t1
7 / 34
(X )t =s t
(X )t2 =s t1
(X )t1 =s t2
(X )t1 =s t2 , (X )t2 =s t3
(X )t1 =s t3
7 / 34
(X )t =s t
(X )t2 =s t1
(X )t1 =s t2
(X )t1 =s t2 , (X )t2 =s t3
(X )t1 =s t3
, unde : s1 . . . sn s
7 / 34
(X )t =s t
(X )t2 =s t1
(X )t1 =s t2
(X )t1 =s t2 , (X )t2 =s t3
(X )t1 =s t3
SubE
, unde : s1 . . . sn s
, unde (Y )t =s t 0 E si : Y T (X )
7 / 34
Observatii
R - reflexivitate
S - simetrie
T - tranzitivitate
C - compatibilitate cu operatii
SubE - substitutie
Daca : Y T (X ), exista un unic morfism : T (Y ) T (X )
a.. s (y ) = s (y ), or. y Ys
Conventie: Pentru usurinta, vom identifica substitutia
: Y T (X ) cu morfismul : T (X ) T (Y )!
SubE
0
=
(X )(t)
s (t )
vs.
SubE
(X )(t) =s (t 0 )
8 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
9 / 34
Deductia ecuationala
Fie E o multime de ecuatii numite axiome sau ipoteze.
In acest caz
scriem E ` (X )t =s t 0 , E ` ,
spunem ca este deductibila, demonstrabila, derivabila din E ,
secventa 1 , . . . , n = este o E -demonstratie pt. .
9 / 34
Exemplu
Exemplu
NAT = (S, ), unde S = {s} si = {0 : s, succ : s s}
Deoarece avem un singur sort, putem renunta la cuantificare!
E = {x + 0 = x, x + succ(y ) = succ(x + y )}
10 / 34
Exemplu
Exemplu
NAT = (S, ), unde S = {s} si = {0 : s, succ : s s}
Deoarece avem un singur sort, putem renunta la cuantificare!
E = {x + 0 = x, x + succ(y ) = succ(x + y )}
2
3
4
0 + succ(0) = succ(0 + 0)
0+0= 0
succ(0 + 0) = succ(0)
(2, C )
0 + succ(0) = succ(0)
(1, 3, T)
10 / 34
Cazul conditionat
11 / 34
(X )(t) =s (t 0 )
, unde (Y )t =s t 0 E si : Y T (X )
Sub
(X )(t) =s (t 0 )
, unde
(X )(t) =s (t 0 )
12 / 34
(X )t =s t
(X )t2 =s t1
(X )t1 =s t2
(X )t1 =s t2 , (X )t2 =s t3
(X )t1 =s t3
, unde : s1 . . . sn s
Sub
(X )(t) =s (t 0 )
, unde
Deductia ecuationala
Fie o multime de ecuatii conditionate numite axiome sau ipoteze.
In acest caz
scriem ` (X )t =s t 0 , ` ,
spunem ca este deductibila, demonstrabila, derivabila din ,
secventa 1 , . . . , n = este o -demonstratie pt. .
14 / 34
Exemplu
Exemplu
NATBOOL = (S, ), unde S = {n, b} si = {T , F , 0, s, ?, >}
= {, 1 , 2 }
15 / 34
Exemplu
Exemplu
NATBOOL = (S, ), unde S = {n, b} si = {T , F , 0, s, ?, >}
= {, 1 , 2 }
1
2
a =n c
(1, 2, Sub pt. si {x a, y c, z s(s(s(0)))})
15 / 34
Logica ecuationala
16 / 34
Logica ecuationala
(S, ) signatura multisortata
o multime de ecuatii conditionate
17 / 34
Logica ecuationala
(S, ) signatura multisortata
o multime de ecuatii conditionate
Sintaxa: ` (X )t =s t 0
exist
a o -demonstratie 1 , . . . , n = (X )t =s t 0
(vezi sectiunea anterioar
a)
17 / 34
Logica ecuationala
(S, ) signatura multisortata
o multime de ecuatii conditionate
Sintaxa: ` (X )t =s t 0
exist
a o -demonstratie 1 , . . . , n = (X )t =s t 0
(vezi sectiunea anterioar
a)
Semantica: |= (X )t =s t 0
17 / 34
Corectitudinea
18 / 34
Scop
Semantica
|= (X )t =s t 0
` (X )t =s t 0
19 / 34
1 , . . . , n
|= 1 , . . . , |= n |= .
20 / 34
1 , . . . , n
|= 1 , . . . , |= n |= .
Propozitie
Regulile de deductie R, S, T, C, Sub sunt corecte.
Demonstratie
1
20 / 34
Demonstratie (cont.)
4
C este corecta:
=s (t10 , . . . , tn0 )
, unde : s1 . . . sn s
21 / 34
Demonstratie (cont.)
4
C este corecta:
=s (t10 , . . . , tn0 )
, unde : s1 . . . sn s
Fie : s1 . . . sn s si presupunem
21 / 34
Demonstratie (cont.)
4
C este corecta:
=s (t10 , . . . , tn0 )
, unde : s1 . . . sn s
Fie : s1 . . . sn s si presupunem
Trebuie s
a ar
at
am c
a |= (X )(t1 , . . . , tn ) =s (t10 , . . . , tn0 ):
21 / 34
Demonstratie (cont.)
4
C este corecta:
, unde : s1 . . . sn s
=s (t10 , . . . , tn0 )
Fie : s1 . . . sn s si presupunem
Trebuie s
a ar
at
am c
a |= (X )(t1 , . . . , tn ) =s (t10 , . . . , tn0 ):
fie A |= si f : T (X ) A un morfism.
din ip., fs1 (t1 ) = fs1 (t10 ), . . . , fsn (tn ) = fsn (tn0 )
avem
fs ((t1 , . . . , tn )) = A (fs1 (t1 ), . . . , fsn (tn )) =
A (fs1 (t10 ), . . . , fsn (tn0 )) = fs ((t10 , . . . , tn0 ))
21 / 34
Demonstratie (cont.)
5
Sub
(X )(t) =s
, unde
(t 0 )
22 / 34
Demonstratie (cont.)
5
Sub
(X )(t) =s
, unde
(t 0 )
22 / 34
Demonstratie (cont.)
5
Sub
(X )(t) =s
, unde
(t 0 )
Trebuie s
a ar
at
am c
a |= (X )(t) =s (t 0 ):
22 / 34
Demonstratie (cont.)
5
Sub
(X )(t) =s
, unde
(t 0 )
Trebuie s
a ar
at
am c
a |= (X )(t) =s (t 0 ):
fie A |= si f : T (X ) A un morfism.
f : T (Y ) A
atunci ;
f )s (ui ) = (;
f )s (vi ), or. 1 i n.
din ip., avem (;
i
i
deoarece A |= (Y )t =s t 0 if H , obtinem
f )s (t) = (;
f )s (t 0 ), i.e. fs ((t))
0 )).
(;
= fs ((t
0
0
=
deci A |= (X )(t)
s (t ), echivalent cu A |= (X )(t) =s (t ).
22 / 34
` (X )t =s t 0 |= (X )t =s t 0 .
23 / 34
` (X )t =s t 0 |= (X )t =s t 0 .
Demonstratie
Fie 1 , . . . , n = (X )t =s t 0 o -demonstratie.
Demonstram ca |= i prin inductie dupa i = 1, . . . , n:
23 / 34
` (X )t =s t 0 |= (X )t =s t 0 .
Demonstratie
Fie 1 , . . . , n = (X )t =s t 0 o -demonstratie.
Demonstram ca |= i prin inductie dupa i = 1, . . . , n:
Pt. i = 1 avem trei cazuri:
1 1 ,
: Y T (X ).
23 / 34
` (X )t =s t 0 |= (X )t =s t 0 .
Demonstratie
Fie 1 , . . . , n = (X )t =s t 0 o -demonstratie.
Demonstram ca |= i prin inductie dupa i = 1, . . . , n:
Pt. i = 1 avem trei cazuri:
1 1 ,
: Y T (X ).
23 / 34
` (X )t =s t 0 |= (X )t =s t 0 .
Demonstratie
Fie 1 , . . . , n = (X )t =s t 0 o -demonstratie.
Demonstram ca |= i prin inductie dupa i = 1, . . . , n:
Pt. i = 1 avem trei cazuri:
1 1 ,
: Y T (X ).
Pres. |= 1 , . . . , |= i1 .
stim c
a i se obtine din 1 , . . . , i1 aplic
and una din R, S, T, C,
Sub .
cum R, S, T, C, Sub sunt corecte, rezult
a |= i .
23 / 34
Completitudinea
24 / 34
Scop
|= (X )t =s t 0
Sintaxa
` (X )t =s t 0
25 / 34
Reg
(X )t =s t 0
26 / 34
este congruenta pe T (X ),
este nchisa la R, S, T, C.
27 / 34
este congruenta pe T (X ),
este nchisa la R, S, T, C.
Demonstratie
Pres. ca este congruenta pe T (X ).
27 / 34
este congruenta pe T (X ),
este nchisa la R, S, T, C.
Demonstratie
Pres. ca este congruenta pe T (X ).
Inchisa la R, S, T: Exercitiu!
27 / 34
este congruenta pe T (X ),
este nchisa la R, S, T, C.
Demonstratie
Pres. ca este congruenta pe T (X ).
Inchisa la R, S, T: Exercitiu!
Inchisa la C:
fie : s1 . . . sn s si t1 s1 t10 , . . . , tn sn tn0 .
deoarece este congruent
a pe T (X ), obtinem
(t1 , . . . , tn ) s (t10 , . . . , tn0 ).
27 / 34
Demonstratie (cont.)
Pres. ca este nchisa la R, S, T, C.
Deoarece este nchisa la R, S, T, obtinem ca este echivalenta
pe T (X ). (Exercitiu!)
Aratam ca este compatibila cu operatiile:
fie : s1 . . . sn s si t1 s1 t10 , . . . , tn sn tn0 .
deoarece este nchis
a la C., obtinem
(t1 , . . . , tn ) s (t10 , . . . , tn0 ).
28 / 34
or. (Y )t =s t 0 if H , or. h : Y T (X )
or. (Y )t =s t 0 if H , or. h : Y T (X )
Inchiderea la substitutii
Propozitia
Sunt echivalente:
1
30 / 34
Inchiderea la substitutii
Propozitia
Sunt echivalente:
1
Demonstratie
verifica CS(, T (X )) (i.e. nchisa la substitutie),
0
or. (Y )t =s t if H , H = {u1 =s1 v1 , . . . , un =sn vn } si. or.
h : Y T (X ) a.. hs1 (u1 ) s1 hs1 (v1 ), . . . , hsn (u1 ) sn hsn (vn ) implica
hs (t) s hs (t 0 )
Echivalenta sintactica
Echivalenta sintactica pe T (X ) determinata de este
t s t 0 ` (X )t =s t 0 , or. s S.
31 / 34
Echivalenta sintactica
Echivalenta sintactica pe T (X ) determinata de este
t s t 0 ` (X )t =s t 0 , or. s S.
Propozitia
este o congruenta pe T (X ) nchisa la substitutie.
31 / 34
Echivalenta sintactica
Echivalenta sintactica pe T (X ) determinata de este
t s t 0 ` (X )t =s t 0 , or. s S.
Propozitia
este o congruenta pe T (X ) nchisa la substitutie.
Demonstratie
Din def. deductiei sintactice `, este nchisa la R, S, T, C, Sub .
Rezulta este congruenta pe T (X ).
Rezulta este nchisa la substitutie.
31 / 34
|= (X )t =s t 0 ` (X )t =s t 0 .
Demonstratie
echivalenta sintactica: t s t 0 ` (X )t =s t 0 .
echivalenta semantica: t s t 0 |= (X )t =s t 0 .
congruenta pe T (X ) nchisa la substitutie .
este cea mai mica congruenta pe T (X ) nchisa la substitutie.
Deci , i.e. |= (X )t =s t 0 ` (X )t =s t 0 .
32 / 34
Teorema de completitudine
(S, ) signatura multisortata, X multime de variabile, t, t 0 T (X )s
Echivalenta sintactica: t s t 0 ` (X )t =s t 0 .
Echivalenta semantica: t s t 0 |= (X )t =s t 0 .
Corectitudinea deductiei: .
Completitudinea deductiei: .
|= (X )t =s t 0 ` (X )t =s t 0
( = )
33 / 34
Pe saptamana viitoare!
34 / 34