logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.inner_products

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, H, K, Lambda, alpha, x
from proveit.linear_algebra import InnerProdSpaces, Norm, ScalarMult
from proveit.logic import Equals, Forall
from proveit.numbers import Abs, Mult
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [H], instance_expr = Forall(instance_param_or_params = [alpha, x], instance_expr = Equals(Norm(ScalarMult(alpha, x)), Mult(Abs(alpha), Norm(x))), domains = [K, H]), domain = InnerProdSpaces(K))))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(K \mapsto \left[\forall_{H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\left[\forall_{\alpha \in K, x \in H}~\left(\left \|\alpha \cdot x\right \| = \left(\left|\alpha\right| \cdot \left \|x\right \|\right)\right)\right]\right]\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 37
body: 2
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 38
body: 6
5ExprTuple38
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 13
8Operationoperator: 11
operands: 12
9Literal
10ExprTuple13
11Literal
12ExprTuple38, 14
13Lambdaparameters: 40
body: 15
14Operationoperator: 16
operand: 37
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple37
18Operationoperator: 20
operands: 21
19Operationoperator: 22
operands: 23
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27
24Operationoperator: 43
operand: 34
25Operationoperator: 29
operands: 30
26Operationoperator: 32
operands: 31
27Operationoperator: 32
operands: 33
28ExprTuple34
29Literal
30ExprTuple35, 36
31ExprTuple45, 37
32Literal
33ExprTuple46, 38
34Operationoperator: 39
operands: 40
35Operationoperator: 41
operand: 45
36Operationoperator: 43
operand: 46
37Variable
38Variable
39Literal
40ExprTuple45, 46
41Literal
42ExprTuple45
43Literal
44ExprTuple46
45Variable
46Variable