# Logical rules

We decompose a real-world situation and look for logical rules which may govern a situation. The main idea here is to break the situation into smaller parts and then look for logical rules which we can model with a computer. This topic is very closely related to abstraction and you very much need to understand boolean operators

## Logical rule[edit]

In the context of a high school introduction to computer science course, a **logical rule** is a rule which has at least one of the following:

- IF
- AND
- OR
- NOT
- NAND
- NOR
- XOR

When deducing logical rules, you should simplify and reduce the situation into small parts.

## Example[edit]

Dagmara is making some tea. She has many types of teas (over 25 boxes), but we might categorize her tea into a few simple categories. The categories are: caffeinated, non-caffeinated, herbal, simple, uncommon, and medicinal. One tea could belong to many categories.

Dagmara has some guests and asks if they want some tea. The guests reply "yes, we would like some tea". Dagmara considers the time of day, and prepares the tea for her guests. Considering one of her guests has hurt her leg, deduce the logical rules Dagmara uses to select tea for her guests.

## Logical Reasoning[edit]

**Logical reasoning** determines if algorithms will work by predicting what happens when the algorithm’s steps - and the rules they consist of - are followed^{[2]}. You would want to use logical reasoning to ensure your solution is correct.

## Standards[edit]

These standards are used from the IB Computer Science Subject Guide^{[3]}

- Deduce logical rules for real-world situations.

## References[edit]

- ↑ http://www.flaticon.com/
- ↑ http://www.bbc.co.uk/education/guides/z8jfyrd/revision
- ↑ IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.