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 Conditional, ExprTuple, Lambda, U, n
from proveit.logic import CartExp, InSet
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult, var_ket_psi
```

In [2]:

```
# build up the expression from sub-expressions
sub_expr1 = CartExp(Complex, n)
expr = ExprTuple(Lambda(var_ket_psi, Conditional(InSet(Qmult(U, var_ket_psi), sub_expr1), InSet(var_ket_psi, sub_expr1))))
```

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 2023-08-24 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.