The definition for a consequence given above requires checking a very large number of possibilities. To verify that “Probability and Statistics or Algebra and Geometry” is a consequence of “Probability and Statistics” we would have to check all possible module selections and confirm that all the ones which satisfy the second statement also satisfy the first one. That’s tedious and unnecessary. If A and B are grammatically correct statements then “A or B” is always a grammatically correct statement and is a consequence of A and also a consequence of B. Transformations like this which take statements and give you consequences are called “rules of inference”. The soundness, or validity, of a rule of inference, the property that the statements they produce are actually consequences, depends on the interpretation. The rule for “or” given above is a sound rule of inference for our system with its intended interpretation.
Writing down sound rules of inference can be tricky. It might seem obvious that if A and B are each grammatically correct statements then “A and B” is a grammatically correct statement and that A and B are both consequences of it. This unfortunately isn’t true. “Probability and Statistics or Algebra and Geometry” is grammatically correct statement, as are “Probability” and “Statistics or Algebra and Geometry”. The second of these is indeed a consequence of “Probability and Statistics or Algebra and Geometry” but the first is not. There are module selections for which the statement “Probability and Statistics or Algebra and Geometry” is satisfied but the statement “Probability” is not. The student could, for example, select Algebra and Geometry and possibly various other modules but not Probability. The problem here is that this “and” is an unnatural place to break the expression “Probability and Statistics or Algebra and Geometry”. It’s possible to express this in terms of the abstract syntax tree. Breaking a statement into two pieces using an “and” at the root of its abstract syntax tree is safe. Breaking it at an “and” elsewhere in the tree is dangerous.
Changes to the language can help. For the prefix version of the grammar it is true that if A and B are grammatically correct then “and A B” is grammatically correct and they are consequences of it. The same is true for the postfix version, except now the consequence is “A B and”. For the fully parenthesised infix language it’s true that if A and B are grammatically correct then so is “( A and B )” and they are consequences of it. In none of these cases does the rule of inference need to refer to the abstract syntax tree. Our choice of language, with infix notation and with parentheses used only where needed to override precedence rules, turns out to be a particularly unfortunate one.