2.1. Propositional Logic¶
Propositional logic is a branch of logic. It helps to formalize logical problems and to solve it. It also provides the prerequisites to understand the basics of how the integrated circuits used in our computers work. This lesson presents the logical approach and introduces the Boolean algebra.
2.1.1. Intuitive approach¶
A proposition (also named statement) can be true or false. Here are presented some examples of propositions:
1 + 1 = 2
1 + 1 = 3
the weather is sunny today
42 is the answer
Marseille is the capital of France
Caution
Following statements are not propositions:
1 + x = 2 (x being a variable, it is a predicate).
this sentence is false (this can not be true or false).
Propositions can be assembled to form new propositions thanks to “connections”.
It is cloudy AND it is cold
The cat is sleeping OR the mouse is happy
Question
Precise if the following sentences are propositions:
Monkey walk on the moon
A square has 5 sides
2.1.2. Propositional syntax¶
The syntax gives the rules on how to form new propositions using simple statements. This can be seen as the “grammar” of propositional logic.
2.1.2.1. Proposition constant¶
We call proposition constant (or logical constant) a variable belonging to the Boolean domain that contains exactly two values:
2.1.2.2. Compounds propositions¶
If a proposition constant can be either true (1) or false (0), they can be combined to form new propositions. These new propositions are obtained thanks to different operators: , , , , and .
As example, if , and are three proposition constants, we can build thanks to preceeding operators a new compound proposition F also named propositional formula:
(2.1)¶
2.1.2.3. Vocabulary and language¶
A propositional vocabulary is a set of proposition constants. The set of all compound propositions that can be formed using a vocabulary is named propositional language.
The propositional formula of Eq.2.1: is a compound propositions belonging to the language formed by the vocabulary .
Question
Do the following propositional formulas belong to the propositional language using the vocabulary ?
2.1.2.4. Tree representation¶
A propositional formula can also be represented by a tree structure. Here is presented the tree representation of Eq.2.1:
2.1.2.5. Operator precedence¶
To simplify writting of propositional formulae and limit usage of parenthesis, an operator precedence is defined:
operator |
precedence |
---|---|
5 |
|
4 |
|
3 |
|
2 |
|
, |
1 |
2.1.3. Propositional semantics¶
Once the syntax being define (rules of grammar), the “meanings” of the symbol used is then defined. This is named semantics.
2.1.3.1. Truth assignment¶
If we consider a propositional vocabulary of propositional constants, we call a truth assignment an application such that:
For example, we will write that is a possible truth assignment of vocabulary .
For , there are 2 possible truth assignments,
For , there are 4 possible truth assignments,
…
For , there are possible truth assignments,
The complexity is exponential. To be understand here as “explosive”.
Question
If we consider a vocabulary composed with 8 propositional constants, what is the total number of possible truth assignments?
2.1.3.2. Definition of logical operators¶
A semantic is given to each operators: , , , , and
2.1.3.2.1. Negation¶
This is the only unitary operator (working with a unique proposition) noted . The truth table for negation (NOT) is:
0 |
1 |
1 |
0 |
It is interesting to remark that
2.1.3.2.2. Conjunction ¶
Conjunction of two propositions and is noted . Evaluation of this propositional formula is true only if and are true. The corresponding truth table for conjunction (AND) is:
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
2.1.3.2.3. Disjunction ¶
Disjunction of two propositions and is noted . Evaluation of this propositional formula is false only if and are false. The corresponding truth table for disjunction (OR) is:
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
2.1.3.2.4. Exclusive disjunction ¶
The exclusive disjunction of two propositions and is noted . Evaluation of this propositional formula is true if only one of and is true. The corresponding truth table for exclusive disjunction (XOR) is:
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
2.1.3.2.5. Implication ¶
Implication between two propositions and is noted . Evaluation of this propositional formula is false only if is true and is false. The corresponding truth table for implication (IMPLY) is:
0 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
2.1.3.2.6. Biconditional ¶
Biconditional between two propositions and is noted . Evaluation of this propositional formula is false if only one of and is false. The corresponding truth table for Biconditional (XNOR) is:
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
2.1.3.3. Other notations for operators¶
Sometimes, other notations can be found for operators:
can also be written
can also be written
can also be written
2.1.3.4. Evaluation of a compound proposition¶
Evaluate a compound proposition consists in determining the truth value of the compound proposition given a truth assignment.
This is done in practice by replacing proposition constants by there values in formula. For example, the evaluation of compound proposition Eq.2.1 under the truth assignment is :
The evaluation of Eq.2.1 under the truth assignment is false.
2.1.3.5. Truth tables for compounds propositions¶
truth tables for compounds propositions allows to determine exhaustively the truth values of compounds propositions for each possible truth assignment. They are build by adding as many columns as necessary to evaluate sub-propositions. As example, let us consider the propositional formula of Eq.2.1. The corresponding truth table is:
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
Question
What is the evaluation of propositional formula F under the truth assignment (p=0, q=1, r=1) ?
2.1.3.6. Satisfaction¶
A truth assignment is said to satisfy a proposition if and only if the proposition is evaluated as true under that truth assignment.
A truth assignment is said to falsify a proposition if and only if the proposition is evaluated as false under that truth assignment.
A proposition is said valid if and only if it satisfies every truth assignment.
A proposition is said unsatisfiable if and only if it satisfies any truth assignment.
A proposition is said contingent if and only if some truth assignments satisfies it and some other falsifies it.
Here are some examples:
As example, the proposition defined in Eq.2.1 is contingent since 6 truth assignments satisfies the proposition and 2 falsifies it.
the formula is valid
the formula is unsatisfiable
2.1.3.7. Natural language and logic¶
Propositional logic can be used to formalize natural language by encoding sentences and thus helps to solve logical problems.
Consider the following sentence: If a student does not work hard in physics or in informatics, he will not become an engineer. This sentence is composed with 3 statements:
p: student works hard in physics
i: student works hard in informatics
e: student will become an engineer
This sentence can be easily traduced in propositional logic by the formula:
2.1.4. Propositional Analysis¶
2.1.4.1. Logical equivalence¶
The logical equivalence can be intuitively understand: Two propositions are equivalent if they says the same thing.
Two propositions F and G are thus said logically equivalent if and only if every truth assignment that satisfies F satisfies G and every truth assignment that satisfies G satisfies F. In that case we will write:
It is possible to check the equivalence between two propositions by determining their truth tables and compare results.
Caution
Logical equivalence is a semantic equivalence that should not be confused with biconditional that is a syntax operator for logical propositions.
2.1.4.2. Logical properties¶
It is possible to demonstrate an important number of logical properties. Thus, we have:
2.1.4.2.5. Absorptive elements¶
false is absorptive for conjunction and true is absorptive for disjunction:
2.1.4.2.6. Elimination of logical operators¶
Some operators can be eliminate to the profit of others. This is the case for implication, biconditional and exclusive disjunction:
2.1.4.2.7. Morgan’s laws¶
2.1.4.3. Full system of operators¶
A system of logical operators is said functionally complete on a propositional language if every logical formula of this language can be expressed in terms of this system’s operators.
If we consider a finite domain of propositional constants, ie. and representing the domain of propositional formulas that can be build on this vocabulary.
We can say that the system is functionally complete. This can be demonstrate easily from properties of section Elimination of logical operators.
and are also functionally complete systems.
2.1.4.3.1. The NAND and NOR operators¶
The NAND and NOR operators respectively for ‘not and’ and ‘not or’ are defined by the following truth table:
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
0 |
Systems {NAND} and {NOR} are functionally complete and are used for digital circuits.
2.1.4.4. Normal forms¶
A clause containing only the connector between propositional constants (or their negation) is called a disjunctive clause, also called maxterm.
A clause containing only the connector between propositional constants (or their negation) is called a conjunctive clause, also called minterm.
Let us consider a propositional formulae F composed with propositional constants of vocabulary .
We call disjunctive normal form (DNF) of propositional formulae F, the propositional formula semantically equivalent to F and that is a disjunction of conjunctive clauses relative to F.
We call conjunctive normal form (CNF) of propositional formulae F, the propositional formula semantically equivalent to F that is a disjunction of conjunctive clauses relative to F.
A propositional formulae F admit a unique CNF and a unique DNF.
Writing the CNF or DNF of a propositional formulae is a way to determine if it is valid or unsatisfiable. It can be easily done using properties of section Logical properties