# Negate Boolean expressions

### Description

This function negates an boolean expression written in Disjunctive Normal Form.

### Usage

1 | ```
deMorgan(expression, prod.split = "", use.tilde = FALSE, complete = TRUE)
``` |

### Arguments

`expression` |
A string representing an expression written in DNF,
or an object of class |

`prod.split` |
The intersection (product) operator (if any). |

`use.tilde` |
Logical, use tilde for negation with bivalent variables. |

`complete` |
Logical, present the result broken down to individual pieces. |

### Details

In Boolean algebra, there are two transformation rules named after the British mathematician Augustus De Morgan. These rules state that:

1. The complement of the union of two sets is the intersection of their complements.

2. The complement of the intersection of two sets is the union of their complements.

In "normal" language, these would be written as:

1. `"not (A and B)" = "(not A) or (not B)"`

2. `"not (A or B)" = "(not A) and (not B)"`

Based on these two laws, any Boolean expression written in disjunctive normal form can be transformed into its negation.

It is also possible to negate all models and solutions from the result of a
Boolean minimization from function ** eqmcc()**. The resulting object, of
class

`"qca"`

, is automatically recognised by this function (provided the
minimization is Boolean).
### Value

A list with the following two components:

initial | The initial expression. |

negated | The negation of the initial expression. |

If ** x** is an object of type

`"qca"`

, the result is a list of solutions.
### Author(s)

Adrian Dusa

### References

Ragin, Charles C. 1987. *The Comparative Method: Moving beyond Qualitative
and Quantitative Strategies*. Berkeley: University of California Press.

### See Also

`eqmcc`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
if (require("QCA")) {
# example from Ragin (1987, p.99)
deMorgan("AC + B~C")
# with different intersection operators
deMorgan("AB*EF + ~CD*EF")
# using an object of class "qca" produced with eqmcc()
data(LC)
cLC <- eqmcc(LC, "SURV", include = "?")
deMorgan(cLC)
# parsimonious solution
pLC <- eqmcc(LC, "SURV", include = "?")
deMorgan(pLC)
}
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.