Skip to content

Lesson 15: Sets and logic (intermediate, 14 min)

A rule is the set of cases where it is TRUE, so the algebra of sets is a second way to write it. This lesson reads AND as intersection, OR as union and NOT as the complement, states a fact about two rules as one set inside another, and draws a rule as a Venn diagram. Five steps, intermediate level, about fourteen minutes.

Level: intermediate14 min20 claims in this lesson were confirmed by the exact checker at build time

Read a rule as the set of cases where it is TRUE: intersection is AND, union is OR, the complement is NOT, and one set inside another is an implication.

The first step writes one eligibility rule twice: (resident ∩ adult) ∖ banned and (resident AND adult) AND NOT banned. The engine shows that the two are one rule in two spellings, TRUE on one row of eight, and textbooks on sets call that truth table a membership table. The second step checks that the laws keep their shape: (A ∪ B)′ and A′ ∩ B′ are the same set, which is De Morgan’s law. One thing does not carry over: the difference is not associative. A ∖ (B ∖ C) and (A ∖ B) ∖ C differ on the case that is in A and in C and not in B, which the left side keeps and the right side removes.

The third step relates two rules with a statement. lounge ⊆ allow_entry says that every case in lounge is also in allow_entry: the implication lounge -> allow_entry, required in every admissible case. On its own it fails, because a premium person who is neither a member nor invited may use the lounge and may not enter. The model states premium ⊆ member as an assumption, and under it the statement holds. A statement can also be checked as a test of its own: its result shows the case that breaks it, and warns when it holds only because its smaller side has no case. The fourth step keeps two kinds of set apart. A list of values is a set of values, not of cases: Permitted_with_licence holds the one value that is in both Permitted and Needs_licence, while the intersection of two rules asks for a permitted activity and an activity that needs a licence, which need not be the same one. A firm with Lending and Trading passes the second rule and fails the first.

The last step draws eligible as a Venn diagram: one curve for each input, one region for each combination, and the rule’s value in each region. One region of the eight is shaded, inside resident and adult and outside banned, and it is the one TRUE row of the membership table; the regions are the cells of the rule’s Karnaugh map, drawn another way. The four exercises ask whether a banned adult resident is in eligible, for staff ∖ (visitor ∪ contractor) written with AND and NOT only, for a case that separates the two groupings of a difference, and for the class of (A ∩ B)′ <-> (A′ ∪ B′). On this site the truth table generator and the equivalence checker read the same set symbols, so each claim of the lesson can be repeated there.

Do this lesson interactively in the app

Steps

1. A rule is a set of cases

A rule splits all cases in two: those where it is TRUE, and the rest. So a rule is also a set of cases, and the algebra of sets is a second way to write it.

resident ∩ adult holds the cases that are in both sets: it is resident AND adult. In the same way ∪ is OR, the complement A′ is NOT A, and the difference A ∖ B is A AND NOT B. So eligible and in_logic are one rule in two spellings.

Textbooks on sets call a truth table a membership table: each row says whether a case is a member of the set.

eligible := (resident ∩ adult) ∖ banned · outputin_logic := (resident AND adult) AND NOT banned · output

resident: the person lives in the town; adult: the person is an adult; banned: the person is banned; eligible: the person is eligible;

A rule is a set of cases
#residentadultbannedeligiblein_logic
0FALSEFALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSEFALSE
2FALSETRUEFALSEFALSEFALSE
3FALSETRUETRUEFALSEFALSE
4TRUEFALSEFALSEFALSEFALSE
5TRUEFALSETRUEFALSEFALSE
6TRUETRUEFALSETRUETRUE
7TRUETRUETRUEFALSEFALSE

Open the truth table: eligible and in_logic have the same column, with one TRUE row of eight.

equivalent eligible / in_logic · holdscontingent eligible · holds

2. The laws keep their shape

The laws you know look the same in set notation. De Morgan: the complement of a union, (A ∪ B)′, is the intersection of the complements, A′ ∩ B′. Here not_either and neither are the same set.

One thing does not carry over: the difference is not associative. A ∖ (B ∖ C) and (A ∖ B) ∖ C are different sets. A case that is in A and in C, and not in B, is in left and not in right: B ∖ C does not hold it, so nothing takes it out of A on the left, while on the right it is removed for being in C.

not_either := (A ∪ B)′ · outputneither := A′ ∩ B′ · outputleft := A ∖ (B ∖ C) · outputright := (A ∖ B) ∖ C · output
The laws keep their shape
#ABCnot_eitherneitherleftright
0FALSEFALSEFALSETRUETRUEFALSEFALSE
1FALSEFALSETRUETRUETRUEFALSEFALSE
2FALSETRUEFALSEFALSEFALSEFALSEFALSE
3FALSETRUETRUEFALSEFALSEFALSEFALSE
4TRUEFALSEFALSEFALSEFALSETRUETRUE
5TRUEFALSETRUEFALSEFALSETRUEFALSE
6TRUETRUEFALSEFALSEFALSEFALSEFALSE
7TRUETRUETRUEFALSEFALSETRUEFALSE

Set A and C to TRUE and B to FALSE, and compare left with right.

equivalent not_either / neither · holdsnot-equivalent left / right · holds

3. One set inside another

A set statement relates two rules. lounge ⊆ allow_entry says that every case in lounge is also in allow_entry: it is the implication lounge -> allow_entry, required in every admissible case.

On its own it fails: a premium person who is neither a member nor invited may use the lounge and may not enter. This model states another statement as an assumption, premium ⊆ member. Under it the statement holds, and then lounge and lounge_and_entry are the same set.

A statement can also be checked as a test of its own. Its result shows the case that breaks it, and warns when it holds only because its smaller side is empty.

allow_entry := (member ∪ invited) ∖ banned · outputlounge := premium ∖ banned · outputlounge_and_entry := lounge ∩ allow_entry · output

member: the person is a member; invited: the person has an invitation; banned: the person is banned; premium: the person has a premium card; lounge: the person may use the lounge;

One set inside another
#memberinvitedbannedpremiumallow_entryloungelounge_and_entryk1Scope
0FALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEin scope
1FALSEFALSEFALSETRUEFALSETRUEFALSEFALSEexcluded
2FALSEFALSETRUEFALSEFALSEFALSEFALSETRUEin scope
3FALSEFALSETRUETRUEFALSEFALSEFALSEFALSEexcluded
4FALSETRUEFALSEFALSETRUEFALSEFALSETRUEin scope
5FALSETRUEFALSETRUETRUETRUETRUEFALSEexcluded
6FALSETRUETRUEFALSEFALSEFALSEFALSETRUEin scope
7FALSETRUETRUETRUEFALSEFALSEFALSEFALSEexcluded
8TRUEFALSEFALSEFALSETRUEFALSEFALSETRUEin scope
9TRUEFALSEFALSETRUETRUETRUETRUETRUEin scope
10TRUEFALSETRUEFALSEFALSEFALSEFALSETRUEin scope
11TRUEFALSETRUETRUEFALSEFALSEFALSETRUEin scope
12TRUETRUEFALSEFALSETRUEFALSEFALSETRUEin scope
13TRUETRUEFALSETRUETRUETRUETRUETRUEin scope
14TRUETRUETRUEFALSEFALSEFALSEFALSETRUEin scope
15TRUETRUETRUETRUEFALSEFALSEFALSETRUEin scope

In the Tests tab, add a property test, choose the set statement, and type lounge ⊆ allow_entry. Run it, then switch the assumption off and run it again.

equivalent lounge / lounge_and_entry · holdsnot-equivalent lounge / allow_entry · holds

4. Sets of cases and lists of values

A list of values is a set too, but a set of values, not of cases. A firm’s activities is a set of values, and HAS ANY asks whether it shares a value with a list.

The list Permitted_with_licence holds the values that are in both Permitted and Needs_licence: Custody alone. Rule r1 tests that list. Rule r2 intersects two rules instead: a permitted activity, and an activity that needs a licence, which need not be the same activity.

A firm with Lending and Trading passes r2 and fails r1. So r1 ⊆ r2 holds and r2 ⊆ r1 does not. Intersecting the lists and intersecting the rules are different things, which is why a set operator in a formula never takes a list.

r1 := activities HAS ANY Permitted_with_licence · outputr2 := activities HAS ANY Permitted ∩ activities HAS ANY Needs_licence · output
Sets of cases and lists of values
#activities_has_any_Permitted_with_licenceactivities_has_any_Permittedactivities_has_any_Needs_licencer1r2activities_values_1activities_values_2Scope
0FALSEFALSEFALSEFALSEFALSETRUETRUEin scope
1FALSEFALSETRUEFALSEFALSETRUETRUEin scope
2FALSETRUEFALSEFALSEFALSETRUETRUEin scope
3FALSETRUETRUEFALSETRUETRUETRUEin scope
4TRUEFALSEFALSETRUEFALSEFALSEFALSEexcluded
5TRUEFALSETRUETRUEFALSEFALSETRUEexcluded
6TRUETRUEFALSETRUEFALSETRUEFALSEexcluded
7TRUETRUETRUETRUETRUETRUETRUEin scope

In the simulation, give activities the values Lending and Trading, and compare r1 with r2.

not-equivalent r1 / r2 · holds

5. The picture of a rule

A Venn diagram draws a rule over its inputs: one curve for each input, one region for each combination, and the rule’s value in each region. The regions are the cells of the rule’s Karnaugh map, drawn another way.

eligible has the curves resident, adult, and banned, and eight regions. One of them is shaded: inside resident and adult, and outside banned. That region is the one TRUE row of the membership table.

The two sides of a checked statement are drawn the same way, side by side, and the regions that break the statement are marked on both.

eligible := (resident ∩ adult) ∖ banned · output

resident: the person lives in the town; adult: the person is an adult; banned: the person is banned; eligible: the person is eligible;

The picture of a rule
#residentadultbannedeligible
0FALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSE
2FALSETRUEFALSEFALSE
3FALSETRUETRUEFALSE
4TRUEFALSEFALSEFALSE
5TRUEFALSETRUEFALSE
6TRUETRUEFALSETRUE
7TRUETRUETRUEFALSE

Open the Karnaugh map of eligible and switch its view to the Venn diagram. Then fix banned at TRUE: no region is shaded.

contingent eligible · holds

Exercises

  1. An adult resident who is banned: is this case in eligible? (predict-output)
  2. Write staff ∖ (visitor ∪ contractor) using only AND and NOT. (write-equivalent)
  3. Find a case that is in left and not in right. (find-assignment)
  4. Classify (A ∩ B)′ <-> (A′ ∪ B′). (classify)

Do this lesson interactively in the app

Questions

Is set notation a different logic?

No. ∩, ∪, △, a trailing ′ and ∅ are spellings of AND, OR, XOR, NOT and FALSE, and A ∖ B is A AND NOT B. A rule typed with them is the same rule, with the same truth table, diagram and checks. Only the difference needs care: beside ∩, △ or ∪ it must be put in parentheses, because textbooks disagree on its precedence.

What is the difference between A ⊆ B and A -> B?

A -> B is a formula: on each row it is TRUE or FALSE, and it is FALSE on the rows where A holds and B does not. A ⊆ B is a statement: it says that no admissible case is such a row. The statement holds exactly when the formula is TRUE in every admissible case, which is why a stated premium ⊆ member is stored as the assumption premium -> member.

Related

Tools

See also

Lessons

Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.