In [1]:

```
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import A, B, S, k
from proveit.logic import Equals, Forall
from proveit.numbers import NaturalPos
from proveit.physics.quantum.circuits import MultiQubitElem, Output
```

In [2]:

```
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [k], instance_expr = Forall(instance_param_or_params = [A, B, S], instance_expr = Equals(Equals(MultiQubitElem(element = Output(state = A, part = k), targets = S), MultiQubitElem(element = Output(state = B, part = k), targets = S)), Equals(A, B))), domain = NaturalPos)
```

In [3]:

```
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
```

In [4]:

```
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
```

In [5]:

```
stored_expr.style_options()
```

In [6]:

```
# display the expression information
stored_expr.expr_info()
```

These web pages were generated on 2022-11-05 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.