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.linear_algebra.inner_products import inner_prod_linearity
In [2]:
# check that the built expression is the same as the stored expression
assert inner_prod_linearity.expr == stored_expr
assert inner_prod_linearity.expr._style_id == stored_expr._style_id
print("Passed sanity check: inner_prod_linearity matches stored_expr")
Passed sanity check: inner_prod_linearity matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{K}~\left[\forall_{H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\left[\forall_{a, b \in K}~\left[\forall_{x, y, z \in H}~\left(\left \langle \left(a \cdot x\right) + \left(b \cdot y\right), z\right \rangle = \left(\left(a \cdot \left \langle x, z\right \rangle\right) + \left(b \cdot \left \langle y, z\right \rangle\right)\right)\right)\right]\right]\right]
In [4]:
stored_expr.style_options()
Out[4]:
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()
Out[5]:
 core typesub-expressionsexpression
0Operationoperator: 21
operand: 2
1ExprTuple2
2Lambdaparameter: 33
body: 3
3Operationoperator: 21
operand: 5
4ExprTuple5
5Lambdaparameter: 52
body: 7
6ExprTuple52
7Conditionalvalue: 8
condition: 9
8Operationoperator: 21
operand: 13
9Operationoperator: 11
operands: 12
10ExprTuple13
11Literal
12ExprTuple52, 14
13Lambdaparameters: 15
body: 16
14Operationoperator: 17
operand: 33
15ExprTuple67, 68
16Conditionalvalue: 19
condition: 20
17Literal
18ExprTuple33
19Operationoperator: 21
operand: 24
20Operationoperator: 36
operands: 23
21Literal
22ExprTuple24
23ExprTuple25, 26
24Lambdaparameters: 27
body: 28
25Operationoperator: 47
operands: 29
26Operationoperator: 47
operands: 30
27ExprTuple69, 70, 71
28Conditionalvalue: 31
condition: 32
29ExprTuple67, 33
30ExprTuple68, 33
31Operationoperator: 34
operands: 35
32Operationoperator: 36
operands: 37
33Variable
34Literal
35ExprTuple38, 39
36Literal
37ExprTuple40, 41, 42
38Operationoperator: 65
operands: 43
39Operationoperator: 53
operands: 44
40Operationoperator: 47
operands: 45
41Operationoperator: 47
operands: 46
42Operationoperator: 47
operands: 48
43ExprTuple49, 71
44ExprTuple50, 51
45ExprTuple69, 52
46ExprTuple70, 52
47Literal
48ExprTuple71, 52
49Operationoperator: 53
operands: 54
50Operationoperator: 62
operands: 55
51Operationoperator: 62
operands: 56
52Variable
53Literal
54ExprTuple57, 58
55ExprTuple67, 59
56ExprTuple68, 60
57Operationoperator: 62
operands: 61
58Operationoperator: 62
operands: 63
59Operationoperator: 65
operands: 64
60Operationoperator: 65
operands: 66
61ExprTuple67, 69
62Literal
63ExprTuple68, 70
64ExprTuple69, 71
65Literal
66ExprTuple70, 71
67Variable
68Variable
69Variable
70Variable
71Variable