# 15.6. Finding a Boolean propositional formula from a truth table


```python
from sympy import *
init_printing()
```


```python
var('x y z')
```


```python
P = x & (y | ~z)
P
```


```python
P.subs({x: True, y: False, z: True})
```


```python
minterms = [[1, 0, 1], [1, 0, 0], [0, 0, 0]]
dontcare = [[1, 1, 1], [1, 1, 0]]
```


```python
Q = SOPform(['x', 'y', 'z'], minterms, dontcare)
Q
```


```python
Q.subs({x: True, y: False, z: False}), Q.subs(
    {x: False, y: True, z: True})
```

3c54f98e34c9b985cb66eeb145e6642125ad184e
ipynb
Jupyter Notebook
001-Jupyter/001-Tutorials/002-IPython-Cookbook/chapter15_symbolic/06_logic.ipynb
jhgoebbert/jupyter-jsc-notebooks
bcd08ced04db00e7a66473b146f8f31f2e657539
BSD-3-Clause
001-Jupyter/001-Tutorials/002-IPython-Cookbook/chapter15_symbolic/06_logic.ipynb
jhgoebbert/jupyter-jsc-notebooks
bcd08ced04db00e7a66473b146f8f31f2e657539
BSD-3-Clause
001-Jupyter/001-Tutorials/002-IPython-Cookbook/chapter15_symbolic/06_logic.ipynb
jhgoebbert/jupyter-jsc-notebooks
bcd08ced04db00e7a66473b146f8f31f2e657539
BSD-3-Clause
2022-01-13T18:49:12.000Z
2022-01-13T18:49:12.000Z
Qwen/Qwen-72B
1. YES
2. YES