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]
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]
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.
Events turn Boolean operations into operations on sets. For a die with sample space , let be the event “even outcome” and the event “outcome at least four”. At outcome , use the indicator functions and . Then
Thus logical conjunction becomes set intersection, logical disjunction becomes set union, exclusive or becomes symmetric difference, and logical negation becomes the complement of a set within . Outcome four satisfies both events, so inclusive logical disjunction includes it and exclusive or excludes it. If the die is fair, these four events have probabilities , , , and , respectively. No assumption of independent events is needed for the set identities; indeed and here are not independent, since .
Coherent logic Created 2026-10-06 Updated 2026-10-07
Coherent logic uses atomic formulas and equality, finite logical conjunctions and logical disjunctions, truth, falsity and existential quantification. Sequents are universally interpreted in a finite variable context. Its categorical semantics is provided by coherent categories, where conjunction is intersection, disjunction is finite union and existential quantification is image.
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.
Figure 1.
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]: 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.
For increasing events under a finite Bernoulli distribution product measure, first assume all parameters are at most . Write and for last-coordinate sections. The zero-section of their disjoint occurrence of increasing events is ; its one-section is . The intersection in this union contains . If , and the last parameter is , mathematical induction bounds disjoint occurrence by . The product of the two marginal probabilities exceeds this bound by . For a larger parameter , replace that coordinate by the logical disjunction of independent bits with parameter . Disjoint original witnesses lift to disjoint bit witnesses. Apply the small-parameter inequality and then pass to degenerate parameters by continuity.
The logic extends first-order logic by countable logical conjunctions and logical disjunctions. Each formula has finitely many free variables, and quantifier strings are finite. In a countable first-order language, every countable structure has a Scott sentence in this logic that characterizes its isomorphism class among countable structures.
For a Boolean function of input bits, define its De Morgan dual by complementing every input, applying , and complementing the output:
De Morgan's laws say that the De Morgan dual of logical conjunction is logical disjunction, and conversely. The constant zero Boolean function becomes constant one. This is different from merely negating the output: for AND, output logical negation gives one at , whereas the De Morgan dual gives zero there.
Taking the De Morgan dual twice restores the original Boolean function:
Here each input is complemented twice as well. For a Boolean formula built from AND, OR, NOT and constants, its De Morgan dual can therefore be obtained by exchanging AND with OR and zero with one throughout, leaving input names and NOT in place. A structural induction proves the rule: it holds for an input and each constant, De Morgan's laws handle the two binary logical connectives, and double logical negation handles NOT. This symmetry lets one translate a complex test systematically instead of guessing where its failures occur.
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]
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 are
One 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.
Figure 1.
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 gives
The 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-14
Exclusive or returns one exactly when its two input bits differ. Its truth table gives , , , and . The identities
express 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.
For an atomic formula (including logical equality), put , and put . Preserve logical conjunction, logical implication and universal quantification recursively, while setting
Logical negation is logical implication to logical falsity, so . The displayed logical disjunction and existence clauses are intuitionistically equivalent to the usual negative forms and . Every translated first-order formula is stable by stability of a formula under double negation. In classical logic the translation is equivalent to the original first-order formula by mathematical induction and double-negation elimination.
Henkin semantics Created 2026-10-06 Updated 2026-10-14
In Henkin semantics, a domain is accompanied by designated ranges for second-order relation variables of each arity . A formula searches only , and checks only . These ranges can be proper subcollections of the external power set. Keeping and its input relations fixed therefore need not fix the truth of a second-order logic sentence.
As a toy illustration of restricted quantification, take and unary range . The sentence
is true under full semantics for second-order logic, but false with this selected range, because neither singleton is available. Likewise, on the complete graph , the unary range admits no witness for the second-order encoding of three-colorability, even though a usual proper vertex coloring exists. This toy range illustrates the truth definition only: it fails second-order comprehension for the formula , and is not a model of a system requiring that comprehension instance.
Admissible Henkin semantics for a specified deductive system must satisfy its axioms, including its chosen second-order comprehension requirements or analogous closure conditions for predicate abstraction. Closure is relative to the permitted formulas and parameters, rather than a blanket property of every selected family. In particular, on a finite domain, allowing logical equality, individual parameters, all finite logical disjunctions, and comprehension for those formulas forces every finite-arity relation to be available: enumerate its tuples and disjoin the formulas naming them. Thus a proper restricted finite range cannot satisfy that entire scheme.
Treating each as an additional sort, with an application relation between its members and individuals, translates this relational presentation into first-order logic with several sorts. Include axioms saying that predicates with the same members are equal, together with whatever second-order comprehension the system requires. This makes Henkin semantics useful for bringing first-order logic methods to reasoning about predicates; it does not license conclusions about all external relations.
Leon Henkin's Completeness in the Theory of Types, Journal of Symbolic Logic 15 (1950), pp. 81–91 develops general models and proves completeness for his typed deductive system. Its opening footnote 5 explicitly discusses closure under operations associated with formula formation. Henkin later described the discovery process in his [ref]; that later account is a historical recollection, distinct from the original publication.
Intuitionistic first-order logic has the usual introduction and elimination rules for logical connectives, quantifiers and logical equality, but no unrestricted double-negation elimination or law of excluded middle. Its proofs retain the witness and logical disjunction information that can be lost in classical first-order logic.
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 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.
The Gödel-Gentzen negative translation transforms into . Induct on a natural deduction derivation. The translated logical conjunction, logical implication and universal rules are ordinary intuitionistic rules. Logical disjunction and existential introduction add double logical negation; their elimination rules first derive the double logical negation of the stable translated conclusion, then use its stability. Classical double-negation elimination translates precisely to stability. If logical equality atoms are double-negated, transport a stable translated conclusion through a logical equality by contradiction and then remove the resulting double logical negation. Original nonlogical axioms must also be translated; the result does not say arbitrary untranslated classical first-order theories are intuitionistically valid.
We prove both inequalities, including the BK inequality, for the inhomogeneous product measure in the question. Identify a configuration with its set of coordinates equal to one. An up-set is then an increasing event. For an increasing event , a set of open coordinates is a witness if the configuration with precisely open belongs to : upward closure ensures that those coordinates alone force , whatever the remaining coordinates do. The event means that there are disjoint open witnesses for respectively.
First prove the Harris' inequality by induction on the number of coordinates. For the last coordinate, of parameter , write and for the two sections in the remaining coordinates, and put , . Induction applied to each section gives
Subtract the product of the marginal probabilities from the right-hand side:
The base case of zero coordinates is immediate. Thus
For disjoint occurrence, first assume every coordinate parameter is at most , and again use induction. Put on the remaining coordinates. The zero-section of is exactly . The one-section is exactly
Indeed, the last open coordinate can belong to at most one of two disjoint witnesses. Assigning it to the witness leaves a witness for and a witness for ; assigning it to the witness gives the other event. If neither witness uses it, both descriptions still hold. Conversely, witnesses for either displayed event lift to disjoint witnesses by adding the last coordinate only to the appropriate one.
The intersection of the two displayed events contains , because the sections are increasing. Therefore
The coefficient is nonnegative. Applying the induction hypothesis to each term gives
The product of the marginal probabilities is exactly this last expression plus
This proves the desired inequality whenever every parameter is at most .
To remove that restriction, suppose first for every coordinate. Replace coordinate by the logical disjunction of independent Bernoulli bits, each with parameter
Choose large enough that . Different blocks are independent, and their OR values have exactly the original distribution. Let be the inverse images of under this block-OR map; they are increasing events. If the OR configuration has disjoint witnesses , choose one open bit from each block indexed by or . The bits chosen for force , those for force , and the two bit sets are disjoint. Thus the inverse image of is contained in . The small-parameter result proves
Parameters equal to one follow by a limit: probabilities of any fixed event on a finite cube are polynomials in the coordinate parameters, hence continuous. Zero parameters already cause no difficulty. We have obtained
For the graph application, take coordinates to be the edges of the complete graph. Let be the increasing event that is connected by a graph path to , and the corresponding event for . Their probabilities are . A simple graph path from to through splits at into two graph paths with disjoint edge sets. Those sets witness and , so this graph path event is contained in . The BK inequality gives
On the other hand, if both and occur, concatenate an -to- graph path and an -to- graph path to obtain a walk from to . Removing loops yields a simple graph path, although it need not pass through . Thus is contained in the unrestricted connection event, and the Harris' inequality gives
The distinction between a simple graph path through and an unrestricted connection is essential: a walk may revisit an edge, so a through- walk would not in general provide disjoint witnesses.
A proposed assignment for 2UN-SAT can be checked in polynomial time, including checking the syntactic restriction, so the language belongs to NP.
For an explicit reduction, parse any Boolean formula into a Boolean circuit over binary AND (logical conjunction), binary OR (logical disjunction) and unary NOT (negation), and apply the gate equivalences in part (a), asserting its output. Every gate clause has at most two positive literals: the AND clauses have respectively one, one and one; the OR clauses have one, one and two; and the NOT clauses have two and zero. The unit output/constant clauses also obey the restriction. Hence the resulting formula is an instance of 2UN-SAT.
The Tseitin transformation is linear in the gate description, and its auxiliary variables enforce the gate values rather than relaxing their relation to the inputs. Therefore the original formula is satisfiable if and only if the transformed restricted formula is satisfiable. This is a polynomial-time many-one reduction from SAT, whose hardness follows from the Cook-Levin theorem. Consequently
The condition limits positive literals, without limiting total clause length.