Discrete Mathematics
Discrete mathematics is the formal foundation underneath everything programmed so far in this series, taking ideas like true/false conditions, collections of files, and the filesystem tree and giving them precise mathematical definitions. Logic starts with the exact boolean values the previous topic already introduced: a proposition is a statement that is either true or false, and logical connectives like AND, OR, and NOT combine propositions the same way the previous topic's logical operators combined boolean values — the difference is that discrete mathematics studies these rules in full generality, proving which combinations are always true, always false, or depend on the inputs, rather than just evaluating one specific condition in one specific program. A set is simply a collection of distinct items with no duplicates and no inherent order, which is exactly the shape of a directory's contents from the second topic in this series — no two files in the same folder can share a name, so a directory listing is a real-world set, and set operations like union (everything in either set) and intersection (only what's in both) describe, for instance, exactly which files exist in two different folders combined, or exist in both at once. A relation connects elements of one set to elements of another — "this file belongs to this user," "this folder contains this file" — and a function is a special, more restricted kind of relation where every input is connected to exactly one output, never more than one, which is the precise mathematical version of the functions from the previous topic: `calculate_total_size(folder)` is a function in exactly this sense, because every folder passed in produces exactly one total size out. A proof is a chain of logical steps that establishes a claim is true with certainty, for every possible case, not just the cases that happened to be tested — a sharper standard than running a program and checking its output looks right, since a proof has to hold for every input, including ones nobody thought to try. Counting, formally called combinatorics, answers how many ways something can happen — how many possible orderings, how many possible selections — which matters directly for understanding how large a space of possibilities actually is before trying to search or process all of it. A graph is a set of nodes connected by edges, and the filesystem tree from the second topic in this series is already a graph in exactly this sense: every file and folder is a node, and every "this folder contains this item" relationship is an edge, with the special property that a tree has no cycles and exactly one path from the root to any given node — the directory structure wasn't just an analogy for a graph, it already was one.