Learn R Programming

QCA (version 1.0-4)

factorize: Factorize a Boolean Sum of Products

Description

This function finds all combinations of factorizing or factorized literals in a Boolean sum of products.

Usage

factorize(bool.sum, prod.split = "", sort.factorizing = FALSE, sort.factorized = FALSE)

Arguments

bool.sum
An object containting either the list of solutions, or a single character solution
prod.split
The separator of the literals within a Boolean product
sort.factorizing
Logical, sort results beginning with largest number of factorizing literals
sort.factorized
Logical, sort results beginning with largest number of factorized literals

Details

In Boolean algebra, the multiplication (intersection) operator $*$ is distributive over the addition (union) operator $+$ such that for any three Boolean terms $a$, $b$ and $c$, the following law holds: $(a*b) + (a*c) = a*(b + c)$ (Hohn, 1966: 12; South, 1974: 12). The factorize() function finds all possible terms $a$ for any Boolean sum of products. Solutions can be sorted in decreasing order by the number of factorizing literals or in decreasing order by the number of factorized literals.

References

F. E. Hohn. Applied Boolean Algebra: An Elementary Introduction. 2nd ed., Macmillan, New York, 1966.

G. F. South. Boolean Algebra and Its Uses. Van Nostrand Reinhold, New York, 1974.

See Also

eqmcc

Examples

Run this code
# factorize any Boolean sum of products;
# if single letters are used, prod.split is not needed
factorize("AB + AC")

factorize("one*TWO*four + one*THREE + THREE*four", prod.split = "*")
factorize("~ONE*TWO*~FOUR + ~ONE*THREE + THREE*~FOUR", prod.split = "*")
factorize("one&TWO&four + one&THREE + THREE&four", prod.split = "&")

# factorize a QCA solution object directly
data(HarKem)
sol <- eqmcc(HarKem, outcome = "PB", conditions = c("C", "F", "T", "V"), 
  include = c("?", "C"))
factorize(sol)

data(Emme)
sol <- eqmcc(Emme, outcome = "JSR", incl.cut1 = 0.9)
factorize(sol)

# sort by largest number of factoring literals
factorize(sol, sort.factorizing = TRUE)

# sort by largest number of factorized literals
factorize(sol, sort.factorized = TRUE)

Run the code above in your browser using DataLab