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 prepend_num_ket_with_zero_ket
In [2]:
# check that the built expression is the same as the stored expression
assert prepend_num_ket_with_zero_ket.expr == stored_expr
assert prepend_num_ket_with_zero_ket.expr._style_id == stored_expr._style_id
print("Passed sanity check: prepend_num_ket_with_zero_ket matches stored_expr")
Passed sanity check: prepend_num_ket_with_zero_ket 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 + 1} = \left(\lvert 0 \rangle {\otimes} \lvert k \rangle_{n}\right)\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: 48
body: 4
3ExprTuple48
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 18
operands: 9
7Literal
8ExprTuple10
9ExprTuple48, 11
10Lambdaparameter: 40
body: 13
11Literal
12ExprTuple40
13Conditionalvalue: 14
condition: 15
14Operationoperator: 16
operands: 17
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple40, 22
20Operationoperator: 35
operands: 23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23ExprTuple40, 28
24Literal
25ExprTuple29, 30
26Literal
27ExprTuple39, 31
28Operationoperator: 37
operands: 32
29Operationoperator: 33
operand: 39
30Operationoperator: 35
operands: 36
31Operationoperator: 37
operands: 38
32ExprTuple48, 49
33Literal
34ExprTuple39
35Literal
36ExprTuple40, 48
37Literal
38ExprTuple41, 42
39Literal
40Variable
41Operationoperator: 43
operands: 44
42Operationoperator: 45
operand: 49
43Literal
44ExprTuple47, 48
45Literal
46ExprTuple49
47Literal
48Variable
49Literal