# logical_expand function

Distribute and over or in a logical expression.

## How to write it

### logical_expand(p)

**p**

A condition. Takes a condition, true or false.

## Examples

- $\displaystyle (p \lor q) \land r = p \land r \lor q \land r$

  `logical_expand((p or q) and r)`

  In the solver, `logical_expand((p or q) and r)` gives `p and r or q and r`.

  [Open in the solver](https://hilberon.com/?q=logical_expand%28%28p%20or%20q%29%20and%20r%29)

## Related functions

- [logical_not](https://hilberon.com/library/logical_not)

  The opposite of a condition: the function form of not.
- [logical_and](https://hilberon.com/library/logical_and)

  True when every condition is true: the function form of and.
- [logical_or](https://hilberon.com/library/logical_or)

  True when some condition is true: the function form of or.
- [less_equal](https://hilberon.com/library/less_equal)

  True when the first value is at most the second: the function form of \<=.
- [nand](https://hilberon.com/library/nand)

  False when every condition is true.
- [less](https://hilberon.com/library/less)

  True when the first value is less than the second: the function form of \<.

---
Source: https://hilberon.com/library/logical_expand
