A bank's loan screen approves an applicant only when two things are true: the person is employed, and has no overdue instalment. Two weeks after launch the manager notices that risky applicants are slipping through. The programmer had written the rejection check as "not employed and overdue". The code ran perfectly; it did exactly what it said. The logic was wrong. Of the four kinds of applicant the screen can meet, only one should be approved, so three must be rejected, and the programmer's check caught just one of them, the unemployed applicant with an overdue instalment. The employed applicant with an overdue instalment walked through, and so did the unemployed applicant with a clean record. The right rule is "not employed or overdue". One small word, and the bank was lending money to the wrong people.
That slip is exactly the skill behind a question many papers ask: what is the negation of "4 is odd or −9 is positive"? It looks like a trick, but it is a rule, and once the rule is yours you own a good part of programming too, because every if, every while and every WHERE clause is logic. Logic is also the grammar of proofs, the language AI systems use to hold knowledge, and the tool that lets us prove a formula true for every number at once with just two small steps.
By the end of this chapter you will be able to build truth tables, tell tautologies from contradictions and contingencies, write the converse, inverse and contrapositive, and prove two statements equivalent. You will negate sentences correctly, including those with "if", "all" and "some", judge arguments and name their fallacies, translate English with several conditions and nested quantifiers into logic, and explain how an AI system draws new facts from stored facts and rules. And you will write clean proofs: direct, by contrapositive, by contradiction, by cases, by counterexample and, above all, by mathematical induction.