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 normalization_preservation
In [2]:
# check that the built expression is the same as the stored expression
assert normalization_preservation.expr == stored_expr
assert normalization_preservation.expr._style_id == stored_expr._style_id
print("Passed sanity check: normalization_preservation matches stored_expr")
Passed sanity check: normalization_preservation 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_{U \in \textrm{U}\left(n\right)}~\left[\forall_{\alpha \in \mathbb{R}^{\ge 0}}~\left[\forall_{\lvert \psi \rangle \in \mathbb{C}^{n}~|~\left \|\lvert \psi \rangle\right \| = \alpha}~\left(\left \|U \thinspace \lvert \psi \rangle\right \| = \alpha\right)\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: 24
operand: 2
1ExprTuple2
2Lambdaparameter: 55
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 24
operand: 8
5Operationoperator: 39
operands: 7
6ExprTuple8
7ExprTuple55, 9
8Lambdaparameter: 53
body: 11
9Literal
10ExprTuple53
11Conditionalvalue: 12
condition: 13
12Operationoperator: 24
operand: 16
13Operationoperator: 39
operands: 15
14ExprTuple16
15ExprTuple53, 17
16Lambdaparameter: 46
body: 19
17Operationoperator: 20
operand: 55
18ExprTuple46
19Conditionalvalue: 22
condition: 23
20Literal
21ExprTuple55
22Operationoperator: 24
operand: 27
23Operationoperator: 39
operands: 26
24Literal
25ExprTuple27
26ExprTuple46, 28
27Lambdaparameter: 56
body: 29
28Literal
29Conditionalvalue: 30
condition: 31
30Operationoperator: 41
operands: 32
31Operationoperator: 33
operands: 34
32ExprTuple35, 46
33Literal
34ExprTuple36, 37
35Operationoperator: 51
operand: 43
36Operationoperator: 39
operands: 40
37Operationoperator: 41
operands: 42
38ExprTuple43
39Literal
40ExprTuple56, 44
41Literal
42ExprTuple45, 46
43Operationoperator: 47
operands: 48
44Operationoperator: 49
operands: 50
45Operationoperator: 51
operand: 56
46Variable
47Literal
48ExprTuple53, 56
49Literal
50ExprTuple54, 55
51Literal
52ExprTuple56
53Variable
54Literal
55Variable
56Variable