logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.algebra import num_ket_in_register_space
In [2]:
# check that the built expression is the same as the stored expression
assert num_ket_in_register_space.expr == stored_expr
assert num_ket_in_register_space.expr._style_id == stored_expr._style_id
print("Passed sanity check: num_ket_in_register_space matches stored_expr")
Passed sanity check: num_ket_in_register_space matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{n \in \mathbb{N}^+}~\left[\forall_{k \in \{0~\ldotp \ldotp~2^{n} - 1\}}~\left(\lvert k \rangle_{n} \in \mathbb{C}^{2^{n}}\right)\right]
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 41
body: 4
3ExprTuple41
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 17
operands: 9
7Literal
8ExprTuple10
9ExprTuple41, 11
10Lambdaparameter: 28
body: 13
11Literal
12ExprTuple28
13Conditionalvalue: 14
condition: 15
14Operationoperator: 17
operands: 16
15Operationoperator: 17
operands: 18
16ExprTuple19, 20
17Literal
18ExprTuple28, 21
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operands: 27
22Literal
23ExprTuple28, 41
24Literal
25ExprTuple29, 34
26Literal
27ExprTuple30, 31
28Variable
29Literal
30Literal
31Operationoperator: 32
operands: 33
32Literal
33ExprTuple34, 35
34Operationoperator: 36
operands: 37
35Operationoperator: 38
operand: 42
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple42
40Literal
41Variable
42Literal