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