Boolean operation Created 2026-09-24 Updated 2026-10-14
A Boolean operation is a Boolean function taking truth values encoded as bits: means false and means true. These operations supply the concrete two-valued interpretation of a Boolean algebra. A Boolean valuation fixes the inputs; a truth table lists every possible input. With two input bits there are four rows.
The basic logical connectives are logical conjunction (AND, , both true), logical disjunction (OR, , at least one true), exclusive or (XOR, , exactly one true), and logical negation (NOT, , the opposite value). OR is inclusive: it accepts the case where both inputs are true.[ref]
3.1 Propositional Logic. Discrete Mathematics: An Open Introduction (3rd edition) by Oscar Levin; Discrete Mathematics: An Open Introduction, 3rd edition by Oscar Levin, §3.1, Truth Tables: conjunction, disjunction and negation tables
Four input pairs distinguish logical conjunction, inclusive logical disjunction, exclusive or, and logical negation
. Details. For an original program-condition example, let mean “the backup is recent” and mean “the backup is verified”. A rule requiring a recent, verified backup uses logical conjunction; one accepting either qualification uses logical disjunction. A rule flagging a mismatch between the two qualifications uses exclusive or. A recent, verified backup gives : AND and OR accept it, while XOR does not flag it. The last row of the truth table makes this difference explicit.
The same small Boolean operations build larger tests and Boolean circuits. In a programming language, the value of a condition and the procedure for evaluating it both matter. For Boolean operands, Python's
and, or, and not implement these logical connectives. Evaluation proceeds from the left; and skips its right operand if the left is false, and or skips it if the left is true. More generally, and and or return an operand, whereas not returns a Boolean.[ref]Expressions, Python 3.14 language reference. Python 3.14 documentation; Python Language Reference, version 3.14, §6.11 Boolean operations: evaluation order and returned operands
For example, the Python condition
denominator != 0 and numerator / denominator > 2 avoids division by zero because the logical conjunction's second test is evaluated only when the first succeeds. Reversing the tests preserves the abstract truth table for defined operands but can raise a division-by-zero error handled through exception handling. A rewrite involving a side effect must also preserve the needed evaluation behavior. Boolean satisfiability problem Created 2026-09-24 Updated 2026-10-18
The Boolean satisfiability problem asks whether a Boolean formula has an assignment making it true. A complete assignment is a Boolean valuation: it gives every Boolean variable a truth value, consistently at all occurrences. A satisfying assignment, also called a model of a Boolean formula, makes the entire Boolean formula true. A solver's answer
SAT asserts that at least one satisfying assignment exists; UNSAT asserts that the input is an unsatisfiable Boolean formula. These are statements about existence, rather than the truth value under one particular Boolean valuation.For conjunctive normal form, or CNF, writeEach Boolean literal is a Boolean variable or its logical negation. Each Boolean clause uses inclusive logical disjunction: one true Boolean literal suffices. The outer logical conjunction requires every Boolean clause to succeed under the same Boolean valuation. Choosing a different Boolean valuation for each Boolean clause would answer a different question.
Consider the original three-Boolean variable exampleAt the Boolean valuation , the Boolean literals in have values , those in have values , and those in have values . Every Boolean clause therefore has truth value one, so has truth value one: this is a satisfying assignment.
An original satisfying assignment evaluated through Boolean literals, three Boolean clauses, and their logical conjunction
. Details. The complete truth table has Boolean valuations. Exactly two are satisfying assignments: and . In particular, satisfies the first two Boolean clauses but falsifies the third, so satisfying most Boolean clauses does not suffice for SAT. That different objective belongs to maximum satisfiability.
All eight Boolean valuations of the original CNF example, with its two satisfying assignments highlighted
. Details. A short proof of completeness avoids listing all eight rows. If , the Boolean clause forces , after which forces ; is already true. If , forces , after which forces ; is already true. These two cases exhaust the truth values of and produce precisely the two satisfying assignments above.
Verifying a satisfying assignment and finding a satisfying assignment are different tasks. Given a candidate, evaluate the Boolean formula once; finding a candidate requires choosing compatible truth values across all its Boolean clauses. The Cook-Levin theorem says that general SAT is NP-complete, even though a proposed satisfying assignment is efficiently checkable. Its proof encodes a bounded nondeterministic computation as a Boolean formula whose satisfying assignments describe accepting computations. Stephen A. Cook's 1971 paper established this connection between computational complexity theory and propositional logic.[ref]
The Complexity of Theorem-Proving Procedures by Stephen A. Cook. The Complexity of Theorem-Proving Procedures by Stephen A. Cook, 1971, §1, Theorem 1 and proof, pp. 2–3 of the revision-3 transcription: CNF encodes accepting computations
A concrete use is checking finite configuration rules. Let mean that an optional feature is enabled, that a fallback is selected, and that the feature's required component is installed. Require a feature or fallback, require the component whenever the feature is enabled, and forbid using the fallback with that component. Logical implication rewrites the second rule as ; De Morgan's laws rewrite the third rule as . Their logical conjunction is exactly , so its two satisfying assignments give the two allowed configurations. The usefulness of SAT lies in expressing local rules uniformly while demanding one globally consistent Boolean valuation. The conclusion concerns exactly these encoded rules.
Boolean valuation Created 2026-09-29 Updated 2026-10-14
A Boolean valuation assigns each primitive proposition a value in , equivalently , and extends recursively to every propositional formula using the classical logical connectives. The same primitive proposition always receives the same value within one Boolean valuation. For compound propositional formulas and ,Every other case receives the opposite value. Thus gives . A truth table varies the assignment; recursive evaluation computes one row. The truth-functional restriction means that changing what the primitive propositions describe, while retaining their values, cannot change the value of the compound propositional formula. See forall x: Calgary, chapter 9 and section 10.1.
Complement of a set Created 2026-10-05 Updated 2026-10-14
The complement of a subset within a specified universal set contains exactly the set elements of excluded from :Here depends on the chosen universal set. Within , taking a complement performs logical negation (NOT) on membership. Writing keeps the ambient set visible when there could be ambiguity.
For , , and :If the universal set grows to , the same sets have different complements: and . In a database illustration, “records that fail this condition” therefore requires deciding which records are eligible to begin with; those eligible records form .
For subsets , De Morgan's laws exchange union and intersection when taking complements:For the same example, failing both conditions leaves . Failing at least one condition leaves . This is useful for rewriting exclusion rules into separate membership tests. The symmetry is also pleasing: exchanging union with intersection turns one rule into its partner.
De Morgan's laws: excluding a union means failing both tests, while excluding an intersection means failing at least one
. Details. A brief membership proof works in classical propositional logic. For any , let mean and mean . The truth table below checks all four possibilities, with meaning true and false:Each paired column agrees. Translating logical disjunction (OR), logical conjunction (AND), and logical negation (NOT) back into membership proves the two set equalities. For the general method of reducing set equalities to equivalences in propositional logic, see Lehman, Leighton and Meyer, Mathematics for Computer Science (2015), §4.1.5 and Problem 4.5.
A historical perspective appears in Augustus De Morgan's [ref]
https://en.wikisource.org/wiki/Page:Formal_Logic_(1847,_De_Morgan).djvu/8. Formal Logic (1847), preface
: he describes treating each name together with its contradictory name. In the membership viewpoint here, a set and its complement likewise pair a condition with its logical negation. Decidability theorem for propositional logic Created 2026-09-29 Updated 2026-10-14
There is an algorithm deciding whether any finite propositional formula is a theorem. A formula contains only finitely many atoms, so a finite truth table decides whether it is valid; the completeness theorem for propositional logic identifies validity with provability.
De Morgan's laws Created 2026-09-28 Updated 2026-10-14
De Morgan's laws exchange logical conjunction and logical disjunction when a logical negation moves across them:Here denotes logical equivalence: the two propositional formulas agree under every Boolean valuation.[ref]
3.1 Propositional Logic. Discrete Mathematics: An Open Introduction (3rd edition) by Oscar Levin; Discrete Mathematics: An Open Introduction, 3rd edition by Oscar Levin, §3.1, Logical Equivalence: definition, Example 3.1.3 and De Morgan's Laws box
A complete verification uses the four rows of a truth table. In input order , both sides of the first logical equivalence have output sequence ; both sides of the second have . A proof in words is equally short: failure of “both” means at least one failure, whereas failure of “at least one” means both fail. The differing middle rows explain why simply pushing logical negation inward without changing AND to OR is wrong.
For the events in Boolean operations on events, the corresponding set identities areOne can prove these identities by checking an arbitrary set element : its two membership truth values obey De Morgan's laws. The same reasoning works for any two subsets of a common universal set.
De Morgan's laws shade the same set whether a compound event is complemented first or its component events are complemented first
. Details. For a nested program test, let mean “backup recent”, mean “backup verified”, and mean “manual override authorized”. Rejecting when neither an acceptable backup nor an override is present givesThe transformed condition reads “backup stale or unverified, and no override”. Apply the second of De Morgan's laws at the outside, then the first at the inner logical conjunction. For it rejects; changing only to one makes it accept. With Boolean operands in Python,
not ((recent and verified) or override) and ((not recent) or (not verified)) and (not override) have the same result and inspect the operands in the same order, with the same skipped operands. Exclusive or Created 2026-09-28 Updated 2026-10-20
Exclusive or returns one exactly when its two input bits differ. Its truth table gives , , , and . The identitiesexpress exclusive or using logical conjunction, logical disjunction, and logical negation. The first expression accepts at least one input and then excludes both; the second explicitly lists the two accepted input pairs.
For numerical bits, exclusive or is addition in modular arithmetic modulo two:The binary operation is commutative and associative, because addition modulo two has those properties. It satisfies , , and . These identities explain why a bit can be toggled and restored with the same operation.
On binary strings of equal length, bitwise exclusive or applies the one-bit rule separately at each position. For example,A bit mask of toggles exactly the middle two bits. Applying the mask twice restores the original binary string: each selected bit changes twice, and each unselected bit stays fixed. This positional operation is distinct from taking the exclusive or of the overall truth values of two integers.
Logical connective Created 2026-09-28 Updated 2026-10-14
A logical connective forms a compound proposition from component propositions; logical truth and logical falsity are the zero-input cases. Logical negation has one input, while logical conjunction, logical disjunction, and logical implication each have two. In classical propositional logic, these logical connectives are truth-functional: their output value is determined by their input values, as listed in a truth table. This does not characterize every kind of logical connective in every logic. See forall x: Calgary, section 10.1.
Logical equivalence 2026-10-14
Two propositional formulas are logically equivalent in classical propositional logic when they have the same truth value under every Boolean valuation. Identical output columns in a truth table prove logical equivalence; one differing row refutes it. De Morgan's laws give useful examples.
Logical implication Created 2026-09-28 Updated 2026-10-14
Logical implication forms the proposition , read “if , then ”. In classical propositional logic, it is false exactly when is true and is false. Equivalently, it has the same truth table as , using logical negation and logical disjunction. A false hypothesis makes the logical implication true regardless of its conclusion; thus it asserts neither the hypothesis nor a causal connection.
For example, for every natural number , divisibility by four implies that is an even number: . At , both statements are true. At , the hypothesis is false and the conclusion true; at , both are false. The only forbidden case is a multiple of four that is not an even number.
In Intuitionistic propositional logic, a proof of consists of a construction transforming any proof of into a proof of . The implication introduction rule proves under a temporary assumption ; the modus ponens rule applies the result when is available. The classical identification with is not generally intuitionistically valid.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 4 16F Solution Created 2026-09-24 Updated 2026-10-14
The propositional completeness theorem states that if and only if . Soundness follows by checking the axioms against truth valuations and noting that modus ponens rule preserves truth. For completeness, use the deduction theorem for propositional logic: if , then . In the usual negation rules this also says that a contradiction from proves .
First construct a maximal consistent set extending any consistent set . Enumerate all formulas, possible because the primitive propositions are countable. Starting with , add formula at step if consistency is preserved; otherwise add . This latter addition is consistent: if both extensions gave contradictions, the deduction theorem for propositional logic would prove both and from , a contradiction already in . The union is consistent because a finite proof uses only finitely many newly added premises. It decides every formula: exactly one of belongs to . It is deductively closed, since an omitted derivable formula would have its negation in , contradicting consistency.
Assign a valuation exactly when the primitive proposition lies in . Structural induction proves the maximal consistent set truth lemma if and only if . Negation follows from the decision property. For implication, if and , modus ponens rule gives . Conversely, if , the elementary implication axioms give . If , then , and the usual contradiction rule proves . These two alternatives match the truth table. The other connectives, if primitive, are handled by their corresponding rules or defined from negation and implication. Thus every consistent set has a valuation satisfying it.
Now suppose . If were inconsistent, the deduction theorem for propositional logic would give . Here the third axiom is essential: it would give , a contradiction. Hence that extension is consistent and has a satisfying valuation. This valuation satisfies and falsifies , proving the contrapositive of completeness. In this organization of the proof, the explicit classical double-negation elimination occurs in this last consistency step; the construction and truth lemma use the ordinary negation and contradiction rules, not an unmentioned identification of with .
The propositional compactness theorem says that a set of formulas is satisfiable exactly when each finite subset is satisfiable. If it were not satisfiable, completeness would make it inconsistent. Its finite contradiction proof uses only a finite subset of premises; soundness makes that subset unsatisfiable. This contradicts the assumed finite satisfiability and proves compactness.
Past exam of the mathematics course of the University of Cambridge 2006 iii Paper 59 1 Solution Created 2026-10-03 Updated 2026-10-14
Use for exclusive or and regard all bits as elements of . For every public label , Alice computes the indicator functionwhile Bob computes from the known truth table. Exactly one of the is one, so the separated Boolean decomposition is
For each , they invoke an independent PR box with respective input bits and receive outputs . These satisfy . Alice forms , and Bob forms . Taking the exclusive or of all box constraints provesAlice sends the single bit . Bob combines it with his locally known , obtainingThis is one-bit computation using Popescu–Rohrlich boxes. It uses boxes; decomposing by Bob's input instead gives , so the smaller truth-table factorization uses at most . No efficiency bound on local calculation or box use is needed for the stated unlimited resource.
Each PR box has uniform local output distributions regardless of the other party's input. Independent invocations therefore give Bob a uniform output string before the message, carrying no information about . The useful correlation becomes accessible through Alice's final bit; the construction respects the no-signalling property of the boxes.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 1 16I Solution Created 2026-09-24 Updated 2026-09-29
The completeness theorem for propositional logic states that for every set of formulae and formula ,With the soundness theorem for propositional logic, this is an equivalence. It is also equivalent to saying that every consistent set of formulae has a model.
The usual countable proof lists all formulae and extends a consistent theory one formula at a time. For an uncountable set of primitive propositions, use the uncountable-language proof of propositional completeness: order the consistent extensions of by inclusion. The union of every chain is consistent, since a proof of a contradiction would use only finitely many assumptions and hence would already lie in one member of the chain. Zorn lemma gives a maximal consistent set in propositional logic . Define a Boolean valuation by exactly when . The usual structural induction on formulae proves the truth lemmaso is a model of .
The propositional compactness theorem says that a set is satisfiable if and only if every finite subset of is satisfiable. Only the forward implication is immediate. For the converse, if had no model, then , so completeness would give . Every formal proof uses finitely many assumptions, so some finite would prove and, by soundness, would have no model, a contradiction.
The decidability theorem for propositional logic says that there is an algorithm deciding whether a propositional formula is a theorem. A formula contains only finitely many primitive propositions, even when the full language is uncountable. Its finite truth table decides whether it is valid, and completeness says that validity is equivalent to theoremhood.
Now let be the given partially ordered set. For every distinct , introduce propositions and . Form a propositional theory containing the following clauses:
- and for distinct ;
- and for pairwise distinct ;
- and whenever in the original order;
- and whenever and are incomparable in the original order.
The first two families say that and encode strict total orders. The third makes both orders extend , while the fourth makes them disagree on every incomparable pair.
Every finite subset mentions only a finite subset . By hypothesis, the induced order on is a two-dimensional poset, so choose two total orders realizing it and assign the finitely many and variables accordingly. This satisfies . Thus every finite subset of is satisfiable, and propositional compactness gives a model of all of .
Define when is true and when is true. The clauses make and total orders on . They both contain the original order, and their intersection contains no incomparable pair. Hencewhich proves the finite-local characterization of two-dimensional partially ordered sets.
Propositional logic Created 2026-09-24 Updated 2026-10-14
Propositional logic studies reasoning with whole propositions represented by letters such as and , and propositional formulas built from them using logical connectives. The classical two-valued, truth-functional presentation below assigns each primitive proposition either true or false: each compound value depends only on its component values. This is classical propositional logic; other systems, including Intuitionistic propositional logic, have different semantics and rules.
Starting with and , one can build by logical negation, by logical conjunction, by logical disjunction, and by logical implication, then combine these into larger propositional formulas. Parentheses specify the construction: has logical conjunction as its outermost logical connective. Primitive propositions have no internal structure in this language; a first-order formula can additionally describe objects and quantify over them. The formation rules are given in forall x: Calgary, chapter 6.
The following truth table shows the four basic logical connectives. Logical disjunction is inclusive: is true when either or both inputs are true. Classical logical implication has exactly the same values as ; its only false row has true and false. These truth conditions are specified in forall x: Calgary, chapter 9.
Evaluate from the inside out: first the logical implication, then the outer logical conjunction. The final column also tests the logical implication expressing the modus ponens rule:At , the logical implication is false, so the logical conjunction is false. The abstract syntax tree below separates the construction of the propositional formula from the values propagated through it. Both occurrences of receive the same value from the Boolean valuation. With the opposite assignment , the logical implication is true but the logical conjunction is still false because its second input is false. Recursive evaluation and exhaustive truth tables are explained in forall x: Calgary, chapter 11.
The last column is always true: is a tautology. This expresses the logical validity of the modus ponens rule: whenever both premises and are true, is true. It does not say the premises are true under every Boolean valuation; their logical conjunction is true only on the first row. For a short natural deduction proof outline, assume , extract both conjuncts, apply the implication elimination rule to obtain , then discharge the assumption by the implication introduction rule. See forall x: Calgary, sections 17.3–17.5.
Three tests answer different questions: Boolean satisfiability requires at least one true row, a tautology requires every row true, and a contradiction has every row false. Thus is a tautology, is a contradiction, and is satisfiable but not a tautology: it is true only at . See forall x: Calgary, sections 12.1–12.4.
Propositional logic is useful because an inference pattern can be checked once and reused for many choices of propositions. Its beauty is that a finite truth table completely settles classical truth-functional questions about a fixed propositional formula. But logical validity does not verify real atomic claims. If means “the switch is closed” and means “the lamp is lit”, a valid use of the modus ponens rule still requires establishing its premises about the apparatus; the truth table supplies neither an observation nor a causal explanation. See forall x: Calgary, chapter 2 and chapter 10.
Truth table Created 2026-09-29 Updated 2026-10-14
A truth table lists a propositional formula's value for every Boolean valuation of its distinct primitive propositions. With primitive propositions, there are rows: each independently receives T or F. Evaluate compound columns from their subexpressions using the classical rules for logical connectives. This is exhaustive checking, so a formula true on every row is valid in classical propositional logic.
For a computed example over the natural numbers, let mean that is an even number and mean . The choices realize respectively : all four possible inputs.
The logical implication and its contrapositive agree on every row; the converse implication differs on two rows. A truth table therefore checks equivalence or supplies a counterexample. Classical truth conditions are given in forall x: Calgary, section 31.2. These two-valued truth tables do not characterize validity in Intuitionistic propositional logic.
Unsatisfiable Boolean formula 2026-10-18
An unsatisfiable Boolean formula has no satisfying assignment. Forthe Boolean valuation falsifies the first Boolean clause, and falsifies the second. Both possible truth values fail, proving
UNSAT. Each Boolean clause alone has a satisfying assignment, but their logical conjunction does not: compatibility is the central issue. By contrast, finding just one failed Boolean valuation for a general Boolean formula only rejects that candidate. Finding one successful Boolean valuation proves SAT; proving UNSAT requires excluding every candidate, possibly with a compact argument rather than a full truth table.






