Download x - TWiki

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Formal Methods in software development
a.a.2015/2016
Prof. Anna Labella
5/23/2017
1
The predicate calculus [H-R ch.2]
The need for a richer language
 Terms and formulas


quantifiers
5/23/2017
2
Examples

Every student preparing his homework must be left
alone
x (((x)  ψ(x))  χ(x))
 For every natural number there is number greater
than it
x (N(x)  y (N(y) G(y,x))
x y G(y,x)

There are people who do not like their dog
x (x, d(x))
5/23/2017
3
Syntax
Inductive term definition
 BNF


t::= x | c | f(t1,t2,…,tn)
5/23/2017
4
Syntax

Inductive definition of wff

BNF
::= p(t1,t2,…,tn) | t1=t2 | () | () |
() | () | x | x
5/23/2017
5
Peano’s arithmetics
Predicates: - = -, - ≤  Functions : - + -, - . -, s(-),…
 Constants: 0

5/23/2017
6
Exercises
5/23/2017
7
Syntax
Free and bounded variables
5/23/2017
8
Syntax
Open and closed formulas
5/23/2017
9
Syntax
Be careful with substitution!
5/23/2017
10
Syntax
Free and bounded variables
5/23/2017
11
Natural deduction 3
Proof rules for equality
5/23/2017
12
Natural deduction 3
5/23/2017
13
Natural deduction 3
5/23/2017
14
Exercises
5/23/2017
15
Natural deduction 1
Proof rules for universal quantification
where t is free for x in φ
5/23/2017
where x0 is a fresh variable
16
Natural deduction 2
Proof rules for existential quantification
where t is free for x in φ
5/23/2017
where x0 is a fresh variable
17
Examples of proofs
5/23/2017
where x0 is a fresh variable
18
Examples of proofs
5/23/2017
19
Semantics
syntactical data
 F functional symbols- constants
 P predicate symbols
An interpretation M
 a non empty set (domain) A
 F  a set of functions fM on A (An)
 P  a set of relations PM on A (An)
5/23/2017
20
Semantics
A subset is the interpretation of a 1-ary
predicate
A n-ary relation is the interpretation of a
n-ary predicate
5/23/2017
21
An example: arithmetics
syntactical data
F: f1(-,-), f2(-,-), f0(-), c
P: - = -, P1(-,-)
An interpretation M
 Natural numbers (domain)
 Functions : - + -, - . -, s(-), 0
 Predicates: - = -, - ≤ 5/23/2017
22
Semantics
environments
Assigning values
 l: var  elements of A
5/23/2017
23
An example: arithmetics 2
 f1(c,x)=x always true in the interpretation
 f2(c,x)=x sometimes true sometimes false in the
interpretation depending on the assignment
x(f1(c,x)=x) true in the interpretation
 x(f2(c,x)=x) true in the interpretation
 x(f2(c,x)=x) false in the interpretation
 x(f1(c,x)=f1(c,x)) valid

5/23/2017
24
Semantics
An interpretation M
is a model of 
5/23/2017
M
|=l  :
25
Semantics: satisfiability
5/23/2017
26
Exercises
5/23/2017
27
Semantics: validity
 is valid if for every intepretation and
for every environment
M |= 
5/23/2017
28
Properties
Soundness  |-   M |= 
 Completeness M |=    |- 
 Indecidability
 Compactness


Expressivity
5/23/2017
29
Second order logic
Existential
second order logic

Universal
second order logic
Peano’s arithmetics
5/23/2017
30
Related documents