◇ OpenCyber Academy
Bachelor's · Chapter 6 · English

Chapter 6 — Discrete structures

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Chapter 6 — Discrete structures

Lesson map

Lesson 06 published. Map, example, EX016.

flowchart TD
  N0["Learning outcomes"]
  N1["6.1 Sets for inventory"]
  N2["6.2 Logic"]
  N3["6.3 Graphs"]
  N4["6.4 Counting"]
  N5["6.5 Proof habits"]
  N6["Practising with Bramley's data"]
  N7["Edge cases"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> N7
  N7 --> EX["Worked example"]
  EX --> Q["Exercise EX016"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["6.1 Sets for inventory"]
  N2["6.2 Logic"]
  N3["6.3 Graphs"]
  N4["6.4 Counting"]
  N5["6.5 Proof habits"]
  N6["Practising with Bramley's data"]
  N7["Edge cases"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> N7 --> Q["EX016"]
[Learning outcomes]
    |
    v
[6.1 Sets for inventory]
    |
    v
[6.2 Logic]
    |
    v
[6.3 Graphs]
    |
    v
[6.4 Counting]
    |
    v
[6.5 Proof habits]
    |
    v
[Practising with Bramley's data]
    |
    v
[Edge cases]
    |
    v
[Worked example] --> [Exercise EX016]

Learning outcomes

You will (1) use sets to compare inventories; (2) use graphs to describe dependencies; (3) apply logic to policy rules.

6.1 Sets for inventory

The asset register is set R; devices reporting to the management agent form set M. R minus M are devices nobody is managing; M minus R are devices nobody registered. Both differences matter.

With the synthetic exports, R holds 49 entries, 45 laptops and four servers, and M holds 47 devices that report. Aisha points out that the difference in totals, two, hides more detail than it reveals. Four registered devices are missing from M, and two devices in M are not registered at all, so the two differences must be computed separately before anything can be fixed.

6.2 Logic

Rules such as "if a laptop holds tenant data then it must be encrypted" are implications. Writing them precisely helps check which devices the rule covers.

Aisha writes the rule as "holds tenant data implies encrypted" and notes the one case it forbids: a laptop with tenant data that is not encrypted. A laptop without tenant data satisfies the rule whatever its encryption state, which is exactly the gap the worked example exposes. Writing the rule in this form makes its coverage visible before any device is checked.

6.3 Graphs

A dependency graph shows that laptops depend on the domain server for logons and the file server for documents; if the domain server fails, many laptops are affected.

Aisha's graph has nodes for the 45 laptops and four servers, with an edge wherever a laptop needs a server to work. The domain server has 45 incoming edges, because every laptop needs it to sign in, more than any other node. The old application server has only a few edges, which helps when the course later weighs isolating it against its business value.

6.4 Counting

With five yes-or-no baseline settings, there are 32 combinations; only one is fully compliant.

Aisha uses this count to explain why partial compliance needs a careful definition. A laptop failing only the screen-lock setting and one failing all five settings are both "not compliant", yet they represent very different risks. She decides to report each setting's failures separately rather than one pass-or-fail figure, which is the approach the baseline lab takes in chapter 23. Of the 32 combinations, 31 fail at least one setting, so a single pass-or-fail label would put a laptop missing only the screen lock beside one missing everything.

6.5 Proof habits

Discrete structures train careful reasoning: clear definitions, edge cases and no generalising from a few examples.

Aisha applies these habits to her own inventory claims before showing them to Gareth. She defines "managed" as a device that has reported to the management agent in the last 30 days, not just a device with the agent installed. She tests the definition on edge cases, such as a laptop on long leave, before applying it to all 49 registered devices. When a definition fails on an edge case, Aisha rewrites the definition before counting again, rather than quietly excluding the awkward device from the results.

Practising with Bramley's data

Aisha builds the two sets from synthetic exports and computes both differences with Python's set operations, a preview of the inventory lab in chapter 22. She tests with small examples where she knows the answer, such as one device missing from each set.

She also draws the dependency graph and counts how many laptops depend on each server, showing that the domain server is the most critical node: all 45 laptops need it for logons.

Edge cases

She considers devices renamed during the month, which could appear in both differences under different names.

Practical consequence

For Bramley, this means the laptop firmware and boot settings matter as much as the operating system. Aisha adds firmware update status to the inventory fields so that it can be checked alongside software updates.

Worked example

Aisha writes the encryption rule as a logical implication and realises it does not cover laptops that might later hold tenant data. Gareth decides all laptops must be encrypted, simplifying the rule.

Synthetic case. Synthetic.

Errors and limits

Rules with conditions create gaps when conditions change.

Exercises

Synthesis

Sets, logic and graphs make inventories and rules precise.

Continue studying — chapter 06 of 40

← Chapter 05 (draft) · Course chapter index · Chapter 07 (draft) →