Preface ix
Chapter 1. The Concept of Logic 1
1.1. Syllogisms 1
1.2. Elementary operations of propositional calculus 5
1.2.1. Negation 5
1.2.2. Conjunction 6
1.2.3. Disjunction 7
1.2.4. Conditional 8
1.2.5. Biconditional 10
1.2.6. Tautologies 10
1.3. Tools of deductive reasoning 14
1.4. Quantification 17
1.5. Prenex forms and pure forms 20
Chapter 2. Sets and Relationships 25
2.1. Generalities 25
2.2. Algebra of sets 29
2.3. Parts and partitions 30
2.4. Cartesian product 31
2.5. Binary relationships 32
2.6. Properties of relationships 35
2.7. Applications 42
Chapter 3. Counting and Combinatorial Analysis 47
3.1. Set cardinals 47
3.2. Permutations, arrangements, combinations 48
3.3. Properties of binomial coefficients 51
3.4. Stirling's formula 54
Chapter 4. Boolean Algebra and Boolean Functions 61
4.1. Special elements of an ordered set 61
4.2. Lattice 66
4.3. Boolean algebra 68
4.4. Boolean functions 72
Chapter 5. Logic Circuits 75
5.1. Canonical forms of a Boolean function 75
5.2. Reduction of a Boolean function 80
5.3. Karnaugh tables 84
5.4. Elementary logic circuits 87
5.5. A little on electronics 93
5.6. Construction of logical functions 97
5.7. A basic circuit: the binary adder 100
Chapter 6. Arithmetic 103
6.1. Reminder about integers 103
6.2. Euclidean division 104
6.3. Divisibility and prime numbers 106
6.4. GCD and LCM 112
6.5. Congruencies 116
6.6. Elliptic curves 121
6.7. Identity, theorem and Bézout algorithm 127
Chapter 7. Error Protection 131
7.1. General context 131
7.2. Linear codes 136
7.3. Polynomial codes 140
7.4. Convolutional codes 142
Chapter 8. Encryption Systems 145
8.1. Substitution and transposition 145
8.2. Substitution methods 147
8.2.1. Replacement of a symbol by a symbol 147
8.2.2. The code: replacement of a word by a word 157
8.3. Transposition methods 158
8.4. Asymmetric systems 159
8.5. DES -- secret key system 160
8.6. RSA -- public key system 165
8.7. Cryptography with elliptic curves 167
8.8. Quantum cryptography 169
8.9. Appendix: the Crow and the Fox 176
Chapter 9. Probabilities 177
9.1. Chance 177
9.2. Counting and probabilities 178
9.3. Events and probabilities 183
9.4. Statistics and probabilities 189
9.5. Compound probabilities 191
9.6. Graphs, states, transitions 195
9.7. Markov chains 199
9.7.1. Definition 199
9.7.2. Transition matrix 201
9.7.3. Evolution rules 205
9.7.4. Ergodicity 206
Chapter 10. Descriptive Statistics 213
10.1. Statistical description 213
10.1.1. A little vocabulary 213
10.1.2. Tabular presentation and frequency 215
10.1.3. Two-dimensional series 219
10.2. Graphical representations 220
10.2.1. Bar charts 220
10.2.2. Histograms 222
10.2.3. Cumulative diagrams 223
10.2.4. Polar diagrams 226
10.2.5. Pie charts 227
10.2.6. Figurative diagrams 227
10.2.7. Point clouds 228
10.3. Position parameters 229
10.3.1. Mode 229
10.3.2. Median 230
10.3.3. Averages 235
10.3.4. Comparison of position parameters 237
10.4. Dispersion parameters 238
10.4.1. Range, interquartile range, mean range 238
10.4.2. Variance and standard deviation 240
10.4.3. Coefficient of variation and concentration index 242
10.5. Linear adjustment 243
10.5.1. Principle of adjustment 243
10.5.2. Linear adjustment 248
10.6. Chronological series 254
10.6.1. Introduction 254
10.6.2. Study of the general trend 257
10.6.3. Study of seasonal variations 260
10.7. Covariance and correlation 265
10.7.1. Regression lines 265
10.7.2. Linear correlation 268
Chapter 11. Probability Laws and Simulation 273
11.1. Random variables 273
11.2. Mathematical expectation, variance and standard deviation 283
11.3. Distribution function 287
11.4. Usual probability laws 289
11.4.1. Uniform law 289
11.4.2. Binomial or Bernoulli's law 290
11.4.3. Poisson's law 293
11.4.4. Exponential law 294
11.4.5. Normal law 298
11.5. General information on simulation 305
11.5.1. Weak law of large numbers 305
11.5.2. Some simulations 308
11.5.3. Generation of random numbers 313
11.6. Generating programs 316
11.6.1. Usual laws 317
11.6.2. Any probability law 318
11.7. M/M/1 waiting system 320
11.7.1. Theoretical study 322
11.7.2. Simulation 326
11.8. Appendices 333
11.8.1. Appendix 1: Table for Poisson's law 333
11.8.2. Appendix 2: Table for normal law 334
11.8.3. Appendix 3: Buffon's needle 335
11.8.4. Appendix 4: Results for M/M/1 337
References 339
List of Authors 341
Index 343
1
The Concept of Logic
CONCEPTS COVERED IN THIS CHAPTER.-
Logic is essential, not only for computer operations, but also for artificial intelligence. The concepts of logic outlined in this chapter are therefore of fundamental importance.
Beginning with syllogistic reasoning, the exploration examines propositional calculus and its fundamental operations: negation, conjunction, disjunction, conditional, biconditional, as well as their combinations.
The last section focuses on the tools of deductive reasoning.
References: [EXE 59, MEN 64, QUI 84, WOO 80, LIP 83].
1.1. Syllogisms
Syllogisms are a type of logical reasoning that dates back to the time of Aristotle in Ancient Greece. They are constructed from logical propositions, known as premises, which are linked by a conclusion. The conclusions are derived from the logical of these propositions, allowing the deduction of a conclusion from the given premises. In what follows, the example of a classic syllogism will be considered:
- all men are mortal,
- all Greeks are men,
- therefore, all Greeks are mortal.
The representation of such a logic is termed "Barbara's syllogism", named after a figure in medieval logic who popularized it. In the above example, there are two premises and a conclusion. The first premise is represented by (i), the second by (ii) and the conclusion by (iii).
The described syllogism is considered valid because it respects the rules of formal logic. The conclusion follows necessarily from the two premises and cannot be false if the premises are true. Indeed, each premise of a syllogism must be evaluated according to its truth value to determine whether the conclusion that follows from it is also true or false. In the example, TRUE or FALSE (a truth value) can be assigned to each premise; then it is said that a proposition is a statement which takes one and only one truth value.
EXAMPLE 1.1.-
Some illustrations:
- "The sky is blue,"
- "Money cannot buy happiness,"
- "The house is burning and the firefighters are not there,"
- "Computer scientists are all crazy,"
are "propositions".
- "Eat your soup!,"
- "Good heavens!"
- "Where are they all running?"
do not correspond to propositions.
A syllogism, such as the one considered above, can be represented by the following notation:
- all Xs are Ys (major premise),
- all Zs are Xs (minor premise),
- so, all Zs are Ys (conclusion).
And especially,
The structure is also known as the "canonical form" of a syllogism. The terms X, Y and Z represent categories or classes of things (identified objects), and the syllogism explores the logical relationship between these categories. The canonical form of a syllogism facilitates highlighting the logical structure of reasoning and verifying its validity using the rules of formal logic. Note that a proposition can be placed in one of the following four categories, as shown in Table 1.1.
Table 1.1. Categories of propositions
A Universal and affirmative e.g. "all men are mortals" E Universal and negative e.g. "no man is mortal" I Particular and affirmative e.g. "some men are mortal" O Particular and negative e.g. "some men are not mortal"
Note that a syllogism is composed of three propositions, each belonging to one of the four classes of propositions (A, E, I and O). The middle term connects the two premises of the syllogism, and there are four possible figures depending on the position of this term. The number of possible categories for a syllogism is 43 = 64 possible combinations (four categories for each of the three propositions). Furthermore, depending on the position of X, Y, Z in the premises, there are four classes of syllogisms (see Figure 1.1). The number of categories of syllogisms then becomes 43x4 = 256. For each possible combination of premises, there are two possible formulations (A implies B or B implies A), effectively doubling the number of categories of syllogisms: 512.
Figure 1.1. Syllogism classes
In summary, there are 512 possible categories of syllogisms, but the number of admissible syllogisms is smaller due to the presence of "rules of reasoning".
EXAMPLE 1.2.-
Some illustrations:
- A syllogism with two negative premises is not valid. In a valid syllogism, if one of the two premises is negative, the conclusion must be negative.
- In a valid syllogism, if both premises are affirmative, then the conclusion must be affirmative.
- A syllogism is not valid if it contains two particular premises.
These rules, some of which are presented above, actually reduce the number of valid forms of syllogisms to 19.
As previously discussed, syllogisms follow a general form:
(premise 1, premise 2) implies (conclusion).
We can generalize and acknowledge that syllogisms can involve more than two premises, as demonstrated in Lewis Caroll's "kangaroo argument".
EXAMPLE 1.3.-
The premises:
- The only animals in this house are cats.
- Any animal can become a favorite animal that loves to watch the moon.
- When I hate an animal, I avoid it.
- No animal is carnivorous unless it prowls at night.
- No cat fails to kill mice.
- No animal pleases me, except those in this house.
- Kangaroos cannot become pets.
- Only carnivores kill mice.
- I hate animals that I do not like.
- Animals that roam at night always like to look at the moon.
Conclusion: I always avoid kangaroos.
The objective of the chapter is to provide an overview of the mechanisms for reasoning based on the manipulation of mathematical concepts.
According to N. Bourbaki (Elements of the History of Mathematics):
We consider that the intervention of metamathematics in the presentation of logic and mathematics can and must be reduced to the very elementary part which deals with the handling of operator symbols and deductive criteria.
1.2. Elementary operations of propositional calculus
1.2.1. Negation
Consider the following propositions P and Q:
P: Amiens is in France.
Q: it is false that Amiens is in France.
The proposition Q is derived from the proposition P by prefixing the phrase "it is false that" to it. Q is regarded as the negation of P, denoted as ¬P. The symbol "¬" represents negation and can thus be interpreted as "it is false that". The truth table illustrating negation is simple (see Figure 1.2).
Figure 1.2. Negation truth table
Expressing negation in a literary manner often poses difficulties. While the previous example, where ¬P translates to "Amiens is not in France" is straightforward, more complex cases exist. To illustrate such complexity, consideration will be given to a few examples.
Beginning with the first:
EXAMPLE 1.4.-
P: all integers are real numbers.
Q1: some integers are not real numbers.
Q2: no integer is a real number.
Which of Q1 and Q2 represents the negation of P?
After reflection, it becomes evident that P and Q2 can be false simultaneously. Thus, Q2 is not the negation of P. Conversely, Q1 represents ¬P.
Here is a second example:
EXAMPLE 1.5.-
P: all angles can be trisected (i.e. divided into three equal parts) using only the ruler and the compass (notoriously wrong!).
Q1: no angle can be trisected using only the ruler and compass.
Q2: there is at least one angle that cannot be trisected using only the ruler and compass.
What is the negation of P, Q1 or Q2? P is false because it is impossible to trisect an angle of 37° with only a ruler and compass.
Q1 is false because we can trisect an angle of 180° with a ruler and compass (see Figure 1.3).
Figure 1.3. Trisection of an angle of 180°
It is therefore Q2 which is the negation of P.
It should be noted that difficulties often arise when propositions contain words such as "All," "Some" or similar expressions. However, as will be discussed later in this chapter, these difficulties can be resolved by using quantifiers and the rules associated with them.
1.2.2. Conjunction
A conjunction is a logical connector that combines two propositions to form a third one, using the word "and" to link clauses. The conjunction of two propositions P and Q is denoted by P ?...