Presentation is loading. Please wait.

Presentation is loading. Please wait.

A-level Computer Science

Similar presentations


Presentation on theme: "A-level Computer Science"— Presentation transcript:

1 A-level Computer Science
1.4.3 – Boolean Algebra A-level Computer Science

2 Specification Overview
Specification Points 1.4.3 Boolean Algebra (a) Define problems using Boolean logic. See appendix 5e. (b) Manipulate Boolean expressions, including the use of Karnaugh maps to simplify Boolean expressions. (c) Use logic gate diagrams and truth tables.

3 Introduction to Boolean Algebra
Computers are binary devices, choosing to use 1 and 0 to represent all data. Boolean algebra is about looking at statements that, when evaluated, will result in true or false. Propositional logic, which is where a statement or proposition is defined in terms of true and false, follows mathematical rules that allow manipulation of the propositions. This, in turn, allows logical statements to be simplified or derived. In 1.4.3, you will learn about propositional logic and some of the tools that can define real-world problems as propositional statements. You will also learn some of the key tools that can be used to derive and simplify these logical statements.

4 Propositional Logic Let P be ‘it is snowing’
Let Q be ‘I have a warm coat’ Let T be ‘I will get cold’ Logical propositions such as ‘it is snowing’ can have either a true or a false value. Statements such as ‘what is the weather?’, which can produce multiple answers, cannot be considered to be logical propositions. A proposition is an atomic value or place holder and is represented algebraically by assigning letters to each proposition. In the statements above, we use P to represent the proposition that it is snowing. We have also used Q and T to represent two different propositions. 

5 Propositional Logic Most of the rules used to simplify logic do not rely on the meaning of the propositions, but rather focus on how a logical statement is structured. It is useful, when defining problems, to give meaning to our propositions to give them more context. It is also possible to allow our propositions to have more of a programming focus by assigning them conditional expressions. For example, we could write ‘Let P be N < 5’ or ‘Let Q be N ≥ J’. These would be acceptable logical propositions as each one can evaluate to true or false only.

6 Propositional Logic Symbol Alternatives Formal term Informal term Conjunction AND + Disjunction OR ~A Ā Negation NOT Implication IF Biconditional equivalence Equality Exclusive or XOR Propositional logic makes use of a number of symbols to represent logical connectives. A summary of these connectives can be seen in the table below. A propositional statement will therefore be a combination of propositions connected by logical connectives. To aid understanding, colloquial terms have been given to each symbol as well as their formal names. It is important that you use formal names when discussing propositional logic; their colloquial versions are only included to help your learning.

7 Propositional Logic ∧ Conjunction AND ∨ + Disjunction OR → Implication
IF Biconditional equivalence Equality

8 Conjunction Consider the conjoined proposition: ‘it is raining outside and I have an umbrella’. The keyword in this statement is the word ‘and’. For this statement to be true, both of the propositions represented by P and Q must be true. If one is false, the whole statement becomes false. Conjunction can be represented in the simple truth table below: P Q P AND Q T F

9 Conjunction When we join two propositions together using conjunction, it is represented by the symbol ∧. If P represents ‘it is raining’ and Q represents ‘I have an umbrella’, we can represent the conjunction of these two propositions as the statement P ∧ Q. Below shows a diagrammatic representation of an AND gate:

10 Disjunction Sometimes we want to see if one thing or another is true or not. The truth table of two propositions connected using disjunction is shown below: P Q P OR Q T F

11 Disjunction Disjunction is represented by the ∨ symbol. To represent the disjunction of two propositions, we would simply write P ∨ Q. Below shows a diagrammatic representation of an OR gate:

12 Negation When the negation of a proposition is needed, for example ‘it is not snow’, we can make use of the negation ¬ operator, colloquially known as NOT. Negation is a unary operator (an operator with a single operand) and will apply to the proposition immediately following it. So if P represents ‘it is snowing’, we can represent the negative by ¬ P (i.e. ‘it is not snowing’). Graphically represented using a NOT gate. P NOT P T F

13 Exclusive Disjunction
Exclusive or (XOR) ensures that if both inputs are 1 then the output will be 0. This is different to normal OR which would output a 1. X Y X⊕Y 1

14 Task – Exam Q Explain, using the correct symbols and diagrams, what the following terms mean. (a) Conjunction [2] (b) Disjunction [2] (c) Implication [2] (d) Negation [2]

15 Video

16 Task – Exam Q

17 Task – Exam Q

18 Task – Exam Q Carrot Stick Fruit AND Salad Toy Grilled Burger OR Salad
Salad AND Equivalence

19 Task – Exam Q

20 Task – Exam Q g and (s or c) and f t = true

21 Task The missile will be activated (M) when the key is turned (K) and the button is pressed (B) I will go to the party (P) if Sam is going (S), but not Alex (A) as I don’t get on with him anymore When the new iPhone comes out it will have a secret key combination to take selfies (S). You have to press the main button (M), the on button (O) and the volume button (V) I will only go outside (O) if it is sunny (S), I have an umbrella (U) or I have to put out the trash (T)

22 Task

23 Task The burglar alarm will only be activated (B) when the door sensor (D) or the window sensor (W) is activated, but ONLY if the alarm system is turned on (A) When applying to college (C) you have to choose Physics (P) and Geography (G) or History (H) When feeding the dog (D) you must not feed it with chocolate (C) or sharp objects (S) The heating system will activate (H) when the thermostat setting has not been reached (T)

24 Task

25 Karnaugh Maps When you need to determine a simplified Boolean equation or logic system from a given set of variables you can use a method called Karnaugh mapping to make the process easier. This method can be employed to either an existing Boolean equation or a descriptive outline of a required system. Karnaugh Maps are a modified from of truth table optimised to enable pattern recognition to be used when identifying minimal logical expression. Karnaugh Maps illustrate a table of possible input and mapped against the required output

26 Karnaugh Maps Golden Rules No zeros are allowed
No diagonal joining of blocks Groups should be as large as possible Every one must be within a block – no loners Groups must be formed in 2n (1,2,4,8,etc) Overlapping is allowed Wrap arounds are allowed

27 Video Intro 7-o9dJTWMkLmFco1PA&index=3

28 Example 1 A B

29 Example 1 A B Answer: A

30 Questions Q – Using a Karnaugh Map, simplify the following expressions: A∧B∧C∨A∧¬B∧C∨A∧B∧¬C ¬A∧¬B∧¬C∨¬A∧B∨A∧B∧¬C∨A ∧C ¬A∧B∧C∧D∨¬A∧B∧C∧¬D∨A∧B ∧C∧D∨A∧B∧C∧¬D

31 Answers 1. A∧B∧C∨A∧¬B∧C∨A∧B∧¬C (A∧B) ∨ (A∧C) 00 01 11 10 1 A B C

32 00 01 11 10 1 (A∧C)v(¬A ∧ ¬C) v B Answers A B C
1 A B 2. ¬A∧¬B∧¬C∨¬A∧B∨A∧B∧¬C∨A ∧C (A∧C)v(¬A ∧ ¬C) v B C

33 Answers 00 01 11 10 1 A B C D 3. ¬A∧B∧C∧D∨¬A∧B∧C∧¬D∨A∧B ∧C∧D∨A∧B∧C∧¬D B ∧ C

34 Exam Tip! It does not matter which two values you join together when writing out the Karnaugh map. However, it is important to remember that if you have two or more bits in a single row or column, you should only change adjacent columns/rows by a single bit.


Download ppt "A-level Computer Science"

Similar presentations


Ads by Google