In [1]:

```
import proveit
# Prepare this notebook for defining the theorems of a theory:
%theorems_notebook # Keep this at the top following 'import proveit'.
from proveit.logic import Forall, Iff, InSet, NotInSet, Set, Difference, And, Or, Equals, NotEquals
from proveit import x, y, S, A, B
%begin theorems
```

In [2]:

```
membership_unfolding = Forall((x, A, B), And(InSet(x, A), NotInSet(x, B)),
conditions=[InSet(x, Difference(A, B))])
```

In [3]:

```
membership_folding = Forall((x, A, B), InSet(x, Difference(A, B)),
conditions=[InSet(x, A), NotInSet(x, B)])
```

In [4]:

```
nonmembership_equiv = Forall((x, A, B), Equals(NotInSet(x, Difference(A, B)),
Or(NotInSet(x, A), InSet(x, B))))
```

In [5]:

```
nonmembership_folding = Forall((x, A, B), NotInSet(x, Difference(A, B)),
conditions=[Or(NotInSet(x, A), InSet(x, B))])
```

In [6]:

```
nonmembership_unfolding = Forall((x, A, B), Or(NotInSet(x, A), InSet(x, B)),
condition=NotInSet(x, Difference(A, B)))
```

In [7]:

```
all_but_one_membership_unfolding = Forall((S, y), Forall(x, And(InSet(x, S), NotEquals(x, y)),
domain=Difference(S, Set(y))))
```

In [8]:

```
all_but_one_membership_folding = Forall((S, y), Forall(x, InSet(x, Difference(S, Set(y))),
domain=S, condition=NotEquals(x, y)))
```

In [9]:

```
all_but_one_nonmembership_unfolding = Forall((S, y), Forall(x, Or(NotInSet(x, S), Equals(x, y)),
condition=NotInSet(x, Difference(S, Set(y)))))
```

In [10]:

```
all_but_one_nonmembership_folding = Forall((S, y), Forall(x, NotInSet(x, Difference(S, Set(y))),
conditions=Or(NotInSet(x, S), Equals(x, y))))
```

In [11]:

```
%end theorems
```

These web pages were generated on 2023-08-23 by Prove-It Beta Version 0.3, licensed under the GNU Public License by Sandia Corporation.

Presented proofs are not absolutely guaranteed. For assurance, it is important to check the structure of the statement being proven, independently verify the derivation steps, track dependencies, and ensure that employed axioms are valid and properly structured. Inconsistencies may exist, unknowingly, in this system.

This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, under the Quantum Computing Application Teams program. Sandia National Labs is managed and operated by National Technology and Engineering Solutions of Sandia, LLC, a subsidiary of Honeywell International, Inc., for the U.S. Dept. of Energy's NNSA under contract DE-NA0003525. The views expressed above do not necessarily represent the views of the DOE or the U.S. Government.

Please send questions/comments to: wwitzel@sandia.gov.