Full teaching narration is free with Private Starter.Create free account
Back to curriculum
Computer ScienceGrade 9· U.S. National — Common Core & NGSS
Aligned to:U.S. educational frameworks

Modeling Decisions with Boolean Logic

Students use AND, OR, and NOT operators and truth tables to model and test a rule-based decision such as access to a school computer lab.

Modeling Decisions with Boolean Logic

Illustrations are auto-generated and may be placeholders. They can be refreshed to match the narration.

Full teaching narration is included free with a Private Starter account.Create free account

Identify Inputs and Outputs

A Boolean decision model represents each relevant condition with one of two values: true or false. Begin by separating inputs from the output. Inputs are facts the system checks, while the output is the decision it produces. For a school computer lab, one input might be T, meaning “the student completed safety training.” Another might be S, meaning “a supervisor is present.” A third could be D, meaning “the student has a current access restriction.” Each input is true when the condition applies and false when it does not. The output A represents whether access is allowed. Defining each variable precisely prevents confusion. For example, “trained” should mean that the student completed a specific required course, not simply that the student believes they know how to use a computer.

A decision box receives three true-or-false inputs labeled T, S, and D and produces output A.
A decision box receives three true-or-false inputs labeled T, S, and D and produces output A.Source: Illustrated for this lesson

Introduce AND, OR, and NOT

Boolean operators describe how conditions are combined. AND produces true only when every connected condition is true. For example, “training completed AND supervisor present” is true only when both requirements are met. OR produces true when at least one connected condition is true. “Supervisor present OR teacher permission granted” is true when either condition, or both conditions, are true. NOT reverses a Boolean value. If D means “an access restriction is active,” then NOT D means “no access restriction is active.” Parentheses show which parts should be evaluated together. In the expression T AND (S OR P) AND NOT D, the system checks that training is complete, either supervision or permission exists, and no restriction is active. Operators turn written requirements into rules that a computer can evaluate consistently.

A Boolean operator diagram compares how AND, OR, and NOT process true-or-false conditions.
A Boolean operator diagram compares how AND, OR, and NOT process true-or-false conditions.Source: Illustrated for this lesson

Build a Truth Table

A truth table lists every possible combination of input values and shows the resulting output. Consider the simple rule A = T AND S, where T means training is complete and S means a supervisor is present. Because there are two inputs, there are four possible combinations. When T is false and S is false, access is false. When T is false and S is true, access is still false. When T is true and S is false, access is also false. Only the row where T and S are both true produces true access. Listing all combinations makes the reasoning visible and testable. In general, a rule with n Boolean inputs has 2ⁿ possible input combinations. A three-input truth table therefore has eight rows.

A four-row truth table shows every combination for A equals T AND S.
A four-row truth table shows every combination for A equals T AND S.Source: Illustrated for this lesson

Translate a Policy into Boolean Logic

To translate a policy, underline each condition, assign it a variable, and identify words that signal operators. Suppose the policy says, “A student may use the lab if training is complete, either a supervisor is present or independent-use permission has been granted, and no access restriction is active.” Let T represent training, S represent supervision, P represent permission, and D represent a restriction. The rule is A = T AND (S OR P) AND NOT D. The parentheses keep S OR P together as one manageable part of the problem. Test an example: T is true, S is false, P is true, and D is false. The parentheses evaluate to true, and NOT D is true, so access is allowed. Translation also exposes vague terms such as “permission,” which the policy must define before automation.

A written lab policy maps training, supervision, permission, and restriction conditions into one Boolean access rule.
A written lab policy maps training, supervision, permission, and restriction conditions into one Boolean access rule.Source: Illustrated for this lesson

Test Boundary Cases

Boundary cases are combinations near the point where a decision changes from allowed to denied. They help reveal missing conditions and incorrect operators. For the rule A = T AND (S OR P) AND NOT D, first test a typical allowed case: T, S, and P are true, while D is false. Then change one input at a time. If training changes to false, access must become false. If supervision is false but permission remains true, access stays true. If both supervision and permission are false, access becomes false. If a restriction changes from false to true, NOT D becomes false and access is denied. Also test unusual cases, such as both supervision and permission being true. A complete truth table or a carefully chosen test set lets designers compare the computed result with the intended policy.

A row of test cards changes T, S, P, and D one at a time to compare allowed and denied outcomes.
A row of test cards changes T, S, P, and D one at a time to compare allowed and denied outcomes.Source: Illustrated for this lesson

Revise the Decision Rule

Testing may show that a rule is logically correct but incomplete, unfair, or difficult to apply. Imagine that students with independent-use permission are still required to find a supervisor because the policy was accidentally written as T AND S AND P AND NOT D. Revising S AND P to S OR P restores the intended alternative. Designers should also ask who defines restrictions, how students are notified, whether they can appeal, and whether accommodations are available. Personal perspectives matter: administrators may emphasize security, while students may emphasize equal access and due process. A responsible rule should use relevant inputs, protect rights, and include human review for disputed or unusual cases. After revision, rebuild the truth table and rerun boundary tests. Documenting the change helps others understand both the technical logic and the civic values behind the decision.

A side-by-side comparison changes an incorrect AND requirement into a revised OR rule with human review and due process.
A side-by-side comparison changes an incorrect AND requirement into a revised OR rule with human review and due process.Source: Illustrated for this lesson