logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.algebra

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, j, k, n
from proveit.logic import Forall, InSet, NotEquals
from proveit.numbers import NaturalPos
from proveit.physics.quantum import NumKet
from proveit.physics.quantum.algebra import n_bit_interval
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [j, k], instance_expr = NotEquals(NumKet(j, n), NumKet(k, n)), domain = n_bit_interval, condition = NotEquals(j, k)), InSet(n, NaturalPos))))
expr:
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")
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())
\left(n \mapsto \left\{\forall_{j, k \in \{0~\ldotp \ldotp~2^{n} - 1\}~|~j \neq k}~\left(\lvert j \rangle_{n} \neq \lvert k \rangle_{n}\right) \textrm{ if } n \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 46
body: 3
2ExprTuple46
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 26
operands: 8
6Literal
7ExprTuple9
8ExprTuple46, 10
9Lambdaparameters: 29
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 28
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20, 21
17Operationoperator: 23
operands: 22
18Operationoperator: 23
operands: 24
19Operationoperator: 26
operands: 25
20Operationoperator: 26
operands: 27
21Operationoperator: 28
operands: 29
22ExprTuple31, 46
23Literal
24ExprTuple32, 46
25ExprTuple31, 30
26Literal
27ExprTuple32, 30
28Literal
29ExprTuple31, 32
30Operationoperator: 33
operands: 34
31Variable
32Variable
33Literal
34ExprTuple35, 36
35Literal
36Operationoperator: 37
operands: 38
37Literal
38ExprTuple39, 40
39Operationoperator: 41
operands: 42
40Operationoperator: 43
operand: 47
41Literal
42ExprTuple45, 46
43Literal
44ExprTuple47
45Literal
46Variable
47Literal