In [1]:

```
import proveit
# Prepare this notebook for defining the common expressions of a theory:
%common_expressions_notebook # Keep this at the top following 'import proveit'.
from proveit import Variable, Literal, ExprRange
from proveit import i, n, m, v
from proveit.logic import Set
from proveit.core_expr_types import a_i, b_i, x_i, v_i, w_i
from proveit.numbers import zero, one, two, subtract, Interval, Exp
from proveit.physics.quantum import Bra, Ket
from proveit.physics.quantum.algebra.qmult import (
QmultCodomainLiteral)
```

In [2]:

```
%begin common
```

QmultCodomain is the proper class containing all possible Qmult evaluations if and only if the sequence of operands (bras, kets, and/or quantum operators) is valid:

In [3]:

```
QmultCodomain = QmultCodomainLiteral()
```

In [4]:

```
n_bit_interval = Interval(zero, subtract(Exp(two, n), one))
```

In [5]:

```
x_1_to_n_kets = Set(ExprRange(i, Ket(x_i), one, n))
```

In [6]:

```
a_1_to_m_kets = Set(ExprRange(i, Ket(a_i), one, m))
```

In [7]:

```
b_1_to_n_kets = Set(ExprRange(i, Ket(b_i), one, n))
```

In [8]:

```
v_1_to_m_kets = Set(ExprRange(i, Ket(v_i), one, m))
```

In [9]:

```
v_1_to_n_kets = Set(ExprRange(i, Ket(v_i), one, n))
```

In [10]:

```
w_1_to_n_kets = Set(ExprRange(i, Ket(w_i), one, n))
```

In [11]:

```
%end common
```