COMS E6998 Formal Verification of System Software
Fall 2018
Ronghui Gu
First Order Logic := Propositional Logic + :
Example: Not all birds can fly
Terms are strings:
Formulas are strings:
Two parameters to FOL: and
Definition
Q: find the free and bound variables:
Barendreght convention: To avoid confusion, every bound variable will be distinct from any other bound variable and all the free variables.
Substitution: replace free variables with actual terms.
Definition is defined to be the formula we get by replacing all free occurrences of in with . Q A:= , what is ?
All propositional logic rules are rules of FO
Only consider “=”
Q: prove the following rules:
Q: Assume and , prove
Q: Prove
Universal quantification elimination rule:
Universal quantification introduction rule:
Existential introduction rule:
Existential elimination rule:
Q: Assume and , and assume
express and prove in FOL over and :
“Any natural number is smaller than some number”
Q: Prove
Q:
Q:
Consider the formula
To prove this we need use rule and provide a term for which we can show
Classically this is a tautology:
using rule (also see truth table of implication).
However notice how we didn’t have to provide any concrete term in the second case to complete the proof of Let’s see this again:
If then there exists a term such that , which we can use to show
We can’t provide a if we don’t know and the parameters , , but there is always one.
Classical logic is OK with that!
Intuitionistic logic is not! It requires us to give a concrete , before we know what is.
Theorem
There are irrational and for which is rational.
Proof
We know that 2 is irrational (known theorem of arithmetic which we will not prove here).
Suppose is rational. Then pick and we’re done.
Otherwise is irrational. Pick
and .
which is rational.
Correct but we never identified two definitely irrational numbers a and b. In fact knowing whether is rational is a difficult problem!
Riemann hypothesis Michael Atiyah, Proof by Contradiction
Let be a list of formulas
Syntactic entailment is useful to show existence of proofs.
Semantic entailment is useful to show absence of proofs.
How can we show that ?
How can we show that ?
What should be the semantics of ?
It depends on the semantics of the parameters of FOL: the set of terms and predicates .
Definition A model of consists of the following:
Example Model Natural numbers:
A model may be:
Q: What is like if
We will give semantics to closed formulas (no free variables) using the semantics of open formulas.
The semantics of means that for all values is true. However it’s not a valid syntax to have formulas containing semantic values from . We need to use environments.
Definition
is an environment if it is a function that maps syntactic variables to semantic values. (lookup tables)
Definition Given a model for a pair and given an environment , we define the satisfaction relation for each logical formula over the pair and as follows.
holds if , where are the -value of under .
holds if holds and holds
holds if or holds
holds if does not hold
holds if holds whenever holds
holds if holds for all
holds if holds for some
Theorem (Soundness)
For a given , if then
which means for any model of and any environment , we have .
Theorem (Strong soundness)
For a given , if then which means for any model of and any environment , if then .
This involves properties that are true in all models. How can we talk about properties of certain models (e.g., numbers with some standard predicates over them)?
A: Encode the necessary properties of these models in . can contain the axioms we want to hold in these models.
Peano Axioms
Terms:
Axioms:
refl, sym, trans of equality
is a natural number
if is a natural number, is a natural number
If is a set such that
then contains every natural number
The Peano axioms can be augmented with other operations:
Theorem (Incompleteness) Any set of axioms which is consistent (no contradictions such as 0 = 1 are derivable) and contains “enough arithmetic” cannot be complete. That is, there are true facts φ about arithmetic for which .
Proof.
Göedel gave a way to encode first-order logic itself in any axiomatisation containing Peano (or any other encoding of) natural numbers.
Hence for any such system he was able to write an encoding of the formula:
If then obviously the logic is inconsistent ().
If then obviously the logic is incomplete ( is true but not provable).
Theorem (Completeness)
then .