Since we need a formal language anyway might as well dispense with everything superfluous and replace “The student is taking Probability and Statistics or Algebra and Geometry” with just “Probability and Statistics or Algebra and Geometry”. There’s no point in starting every single rule with “The student is taking”. Our language will then consist of module names joined by the Boolean operators “and”, “or” and “not” according to fixed rules.
We’ll avoid the ambiguity of whether “Probability and Statistics” is one module or two by using symbols unlikely to occur in a module name to stand in for “and”, “or” and “not”. Specifically we’ll use ∧ for “and”, ∨ for “or” and ¬ for “not”. So “Probability and Statistics” is a single module and “Probability ∧ Statistics” is the two modules “Probability” and “Statistics” joined by the logical operator ∧, with we interpret as “and”.
For a real online module enrollment system I would probably make another choice, for example using module codes in place of module names, but the choice above does have a few advantages. Module names are easier for humans to read and write than module codes. Also, we’re less likely to confuse the ambiguous English words with the precise meanings I’ll soon give to the Boolean operators. The main reason I’ve chosen to use ∧, ∨ and ¬ though is that these are the stand symbols in mathematical logic, which will be one of the main topics of this module.
What would have appeared in the course handbook as “You must take Probability and Statistics or Algebra and Geometry” is now “Probability ∧ Statistics ∨ Algebra ∧ Geometry”. We still need to resolve the ambiguity about how to split this up, which we’ll do by declaring that ¬ takes precedence over ∧, which in turn takes precedence over ∨. By precedence we mean that it binds more tightly, so given the choice between binding the names “Probability” and “Statistics” with an ∧ or “Statistics” and “Algebra” with an ∨ we prefer to bind “Probability” and “Statistics” together first. Only after “Probability” and “Statistics” have been bound together with ∧ and “Algebra” and “Geometry” with ∧ do we bind the two larger phrases “Probability ∧ Statistics” and “Algebra ∧ Geometry” together with ∨.
While not strictly necessary, it is convenient to allow the use of parentheses to override these precedence rules. The alternative interpretation described earlier could then be written as “Probability ∧ (Statistics ∨ Algebra) ∧ Geometry”. This could also expressed without parentheses as “Probability ∧ Statistics ∧ Geometry ∨ Probability ∧ Algebra ∧ Geometry”, but this is longer and harder to read than the version with parentheses.
Note that this use of the word precedence may not match your intuitions. If you parse statements in a top down manner, which is the way humans generally do, then you start with the operators of lowest precedence and work your way up to those of higher precedence. The terminology above, which is standard, assumes a bottom up parsing, starting from the smallest units and gradually combining them until we have the full statement. Most, but not all, parsing algorithms used by computers work this way.