1 / 31

a little excursion to logic and traffic control

a little excursion to logic and traffic control. 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.

nnix
Download Presentation

a little excursion to logic and traffic control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. a little excursionto logicand traffic control

  2. A logical puzzle Given situation: Three women standbehind 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 doesso, if she is able to.) Schwarz? Weiss? Schwarz? Weiss? Black? White?

  3. 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?

  4. Idea: logical formulasfor security at crossroads! B A Requirement: no collisions at crossroads! What must hold such that no collisions are possible? How can this be specified? Collision possible!...

  5. 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

  6. Logic as the foundationof rationality This means: We all have to accept certain basic rules of logical reasoning. Otherwise there is no „reasonable“ Thinking (and Acting). Logic is ultimately the foundation of all sciences and every kind of rational argumentation.

  7. The principle of bivalence • 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 A proposition cannot simultaneously with its opposite be true.

  8. 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.

  9. What are propositions? unclear! • 2+4=6 1 • Zurich is the capital of Switzerland. 0 • Peter (23) is older than Paul (17). 1 Propositions are sentences, which are either true (1) or false (0). No propositions • Where is the station? • Be quiet! • Berne is a beautiful city. • This water (20° C) is cold.

  10. 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. 1

  11. 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“ 1 Propositional logic formulas are compound formulas: • Truth value (true/false or 0/1) • A AND B0 • A OR B1 • (NOT A) AND B1

  12. George Boole Founder of propositional logic • 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

  13. 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).

  14. NOT (Negation) Shorthand notation: ¬ • Truth table:

  15. AND (Conjunction) • Shorthand notation:  • Truth table:

  16. OR (Disjunction) • Shorthand notation:  • Truth table:

  17. Propositional logic(short reference) • Formulas in propositional logic, e.g.: • (¬AB)(A¬B) • A(¬B¬C)(DB)

  18. Now propositions in practice:traffic control & logic B A 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.

  19. Now propositions in practice:traffic control & logic B A 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. Solution: A  (¬B)

  20. Solution: A  (¬B) B B A A B B A A

  21. Solution: A  (¬B) B B A A B B A A

  22. Solution: A  (¬B) B B A A B B A A

  23. Solution: A  (¬B) B B A A B B A A

  24. Truth table B A Exercise: How do you interpret this row? Gives for all combinations of values of the variables the truth value of a formula in propositional logic.

  25. Idea: a formula for securityat a crossroad! B A 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? collision possible!...

  26. Program „LogicTraffic“ Idea: Find a formula in propositional logic which makes the given traffic situation secure • Different strategies!

  27. LogicTraffic truth table trafficsituation Formula to thetruth table Formula editor

  28. Status indication not secure (collisions possible) secure (no collisions, but moregreen phases possible) optimal (no collisions and no moregreen phases possible)

  29. LogicTraffic: mouseclickable areas

  30. LogicTraffic - Demo!

  31. Your turn… • Read the instructions • Work on the exercises in the computer lab

More Related