Negate Boolean Expressions using De Morgan's Laws
This function negates simple or complex Boolean expressions using the two De Morgan Laws.
DeMorgan(expression, and.split = "", use.tilde = FALSE) is.DeMorgan(x)
expression |
A string representing a Boolean expression or a solution object of class 'qca'. |
and.split |
The AND-operator (if any). |
use.tilde |
Logical, use '~' for negation with bivalent variables. |
x |
An object of class 'DeMorgan'. |
The two De Morgan laws posit that the negation of a disjunction is the conjunction of its separate negations, and the negation of a conjunction is the disjunction of its separate negations (Hohn 1966, p.80).
The argument expression
can be any complex string representing a
Boolean expression of disjunctions and conjunctions, or a solution object of
class 'qca' (objects returned by the 'eQMC
' function).
A list of solutions with their negations as components if expression
is an object of class 'qca', or simply a list with the following components
if expression
is a string:
initial |
The initial expression. |
negated |
The negation of the initial expression. |
Dusa, Adrian | : development, programming, testing |
Thiem, Alrik | : development, documentation, testing |
Alrik Thiem (Personal Website; ResearchGate Website)
Hohn, Franz E. 1966. Applied Boolean Algebra: An Elementary Introduction. 2nd ed. New York: Macmillan.
Ragin, Charles C. 1987. The Comparative Method: Moving beyond Qualitative and Quantitative Strategies. Berkeley: University of California Press.
# example from Ragin (1987, p.99) DeMorgan("AC + B~C") # with different AND-operators DeMorgan("A*C + B*~C", and.split = "*") DeMorgan("A&C + B&~C", and.split = "&") # use solution object of class 'qca' returned by 'eQMC' function, # even with multiple models data(d.represent) KRO.ps <- eQMC(d.represent, outcome = "WNP") DeMorgan(KRO.ps)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.