Download presentation
Published byEvelyn Holmes Modified over 9 years ago
0
a little excursion to logic and traffic control
1
A logical puzzle Given situation: Three women stand behind each other. Each one carries a hat on her head and sees only the hats of the person(s) standing in front of her. The hats are either black or white. Not all hats have the same color. Question: Can one woman tell the color of her own hat? (We assume she does so, if she is able to.) Schwarz? Weiss? Schwarz? Weiss? Black? White?
2
Yes, it‘s possible! If the woman at the most back sees two hats of the same color in front of here, she decides for the other color. (Not all hats have the same color.) If the woman at the most back says nothing, the one in the middle knows, that her hat has another color than the hat of the woman at the top front. (Otherwise the woman at the most back would have seen two equal colors and would have told this.) …logical?
3
Idea: logical formulas for security at crossroads!
Requirement: no collisions at crossroads! What must hold such that no collisions are possible? How can this be specified? A B Collision possible!...
4
Program for today Interactive introduction to „logic“ (40‘)
Logic as foundation of rationality Introduction to propositional logic Propositions Operators Truth tables Exercises to LogicTraffic (45‘) Autonomous solving of exercises, with Computer Review of solutions
5
Logic as the foundation of rationality
Logic is ultimately the foundation of all sciences and every kind of rational argumentation. This means: We all have to accept certain basic rules of logical reasoning. Otherwise there is no „reasonable“ Thinking (and Acting).
6
The principle of bivalence
A proposition cannot simultaneously with its opposite be true. e.g.: „Zurich is a continent.“ und „Zurich is not a continent.“ cannot simultaneously be true. This is neither provable nor refutable. Aristotle, founder of logic * 384 B.C. in Stageira † 322 B.C. in Chalkis
7
Logical inference e.g.: proposition 1: „If it rains, the street becomes wet.“ proposition 2: „It is raining.“ inference: „The street becomes wet.“ From the two propositions “if A, then B“ and „A“, the proposition „B“ can be deduced. Like this we can argue und with common accepted „rules“ und true propositions deduce new true propositions.
8
Propositions are sentences, which are either true (1) or false (0).
What are propositions? Propositions are sentences, which are either true (1) or false (0). 2+4= Zurich is the capital of Switzerland. 0 Peter (23) is older than Paul (17). 1 No propositions Where is the station? Be quiet! Berne is a beautiful city. This water (20° C) is cold. unclear!
9
Compound propositions…
…are propositions too, i.e. are either true or false as well.. Peter (23) is older than Paul (17) and 4+4=9. 0 Peter (23) is older than Paul (17) and 2+4=6. 1 Zurich is the capital of Switzerland or Berne is the capital of Switzerland
10
Propositional logic Propositions…
…are represented by variables …have a truth value (true/false or 0/1) A = „Zurich is the capital of Switzerland.“ 0 B = „2+4=6“ Propositional logic formulas are compound formulas: Truth value (true/false or 0/1) A AND B 0 A OR B 1 (NOT A) AND B 1
11
George Boole Founder of propositional logic Boolean variables
English mathematician * 1815 in Lincoln † 1864 in Ballintemple (Ireland) Boolean variables Can only take one of two possible values true/false, 1/0 Boolean data type in many programming languages Used for conditional statements E.g. in Java, C, PHP, Pascal or VisualBasic
12
Logical operators Logical operators connect propositions to new (compound) propositions Which operators are there? NOT, AND, OR are the most common ones. There are more (e.g. if/then).
13
NOT (Negation) Shorthand notation: ¬ Truth table: A ¬A 1
14
AND (Conjunction) Shorthand notation: Truth table: A B A B 1
15
OR (Disjunction) Shorthand notation: Truth table: A B A B 1
16
Propositional logic (short reference)
Variables Negation “NOT“ Conjunction “AND“ Disjunction “OR“ A B ¬A AB AB 1 Formulas in propositional logic, e.g.: (¬AB)(A¬B) A(¬B¬C)(DB)
17
Now propositions in practice: traffic control & logic
Traffic situation: Propositions: A = „Lane A has green.“ B = „Lane B has green.“ Exercise: Describe the situation given above with an compound proposition! (i.e. with the help of logical operators and the two variables A and B.) Remark: Use the table you were given on a separate sheet of paper. A B
18
Now propositions in practice: traffic control & logic
Traffic situation: Propositions: A = „Lane A has green.“ B = „Lane B has green.“ Exercise: Describe the situation given above with an compound proposition! (i.e. with the help of logical operators and the two variables A and B.) Remark: Use the table you were given on a separate sheet of paper. A B Solution: A (¬B)
19
Solution: A (¬B) A B A (¬B) 1 A B A B B A A B
20
Solution: A (¬B) A B A (¬B) 1 A B A B B A A B
21
Solution: A (¬B) A B A (¬B) 1 A B A B B A A B
22
Solution: A (¬B) A B A (¬B) 1 A B A B B A A B
23
Exercise: How do you interpret this row?
Truth table Gives for all combinations of values of the variables the truth value of a formula in propositional logic. A B A (¬B) 1 A B Exercise: How do you interpret this row?
24
Idea: a formula for security at a crossroad!
Requirements: no collisions at crossroads! What “rules” need to hold such that no collisions are possible? What does the truth table look like? Is there a formula in propositional logic for that? A B collision possible!...
25
Program „LogicTraffic“
Idea: Find a formula in propositional logic which makes the given traffic situation secure Different strategies!
26
Formula to the truth table
LogicTraffic truth table traffic situation Formula to the truth table Formula editor
27
Status indication not secure secure optimal (collisions possible)
(no collisions, but more green phases possible) optimal (no collisions and no more green phases possible)
28
LogicTraffic: mouse clickable areas
29
LogicTraffic - Demo!
30
Your turn… Read the instructions
Work on the exercises in the computer lab
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.