DeMorgan: Negate Boolean Expressions using De Morgan's Laws

Description Usage Arguments Details Value Contributors Author(s) References See Also Examples

Description

This function negates simple or complex Boolean expressions using the two De Morgan Laws.

Usage

1
2
3
DeMorgan(expression, and.split = "")

is.DeMorgan(x)

Arguments

expression

A string representing a Boolean expression or a solution object of class 'qca'.

and.split

The AND-operator (if any).

x

An object of class 'DeMorgan'.

Details

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).

Value

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.

Contributors

Dusa, Adrian: development, programming, testing
Thiem, Alrik: development, documentation, testing

Author(s)

Alrik Thiem (Personal Website; ResearchGate Website)

References

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.

See Also

eQMC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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)

AlrikThiem/QCApro documentation built on May 5, 2019, 4:55 a.m.