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 Conditional, ExprTuple, H, K, Lambda, alpha, x
from proveit.linear_algebra import InnerProdSpaces, Norm, ScalarMult
from proveit.logic import Equals, Forall, InClass
from proveit.numbers import Abs, Mult
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(H, Conditional(Forall(instance_param_or_params = [alpha, x], instance_expr = Equals(Norm(ScalarMult(alpha, x)), Mult(Abs(alpha), Norm(x))), domains = [K, H]), InClass(H, 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(H \mapsto \left\{\forall_{\alpha \in K, x \in H}~\left(\left \|\alpha \cdot x\right \| = \left(\left|\alpha\right| \cdot \left \|x\right \|\right)\right) \textrm{ if } H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\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: 35
body: 3
2ExprTuple35
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple35, 11
10Lambdaparameters: 37
body: 12
11Operationoperator: 13
operand: 34
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple34
15Operationoperator: 17
operands: 18
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 40
operand: 31
22Operationoperator: 26
operands: 27
23Operationoperator: 29
operands: 28
24Operationoperator: 29
operands: 30
25ExprTuple31
26Literal
27ExprTuple32, 33
28ExprTuple42, 34
29Literal
30ExprTuple43, 35
31Operationoperator: 36
operands: 37
32Operationoperator: 38
operand: 42
33Operationoperator: 40
operand: 43
34Variable
35Variable
36Literal
37ExprTuple42, 43
38Literal
39ExprTuple42
40Literal
41ExprTuple43
42Variable
43Variable