logo

Expression of type Lambda

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 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 = 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())
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]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 36
body: 1
1Operationoperator: 8
operand: 3
2ExprTuple3
3Lambdaparameter: 37
body: 5
4ExprTuple37
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 12
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12
10Literal
11ExprTuple37, 13
12Lambdaparameters: 39
body: 14
13Operationoperator: 15
operand: 36
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple36
17Operationoperator: 19
operands: 20
18Operationoperator: 21
operands: 22
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26
23Operationoperator: 42
operand: 33
24Operationoperator: 28
operands: 29
25Operationoperator: 31
operands: 30
26Operationoperator: 31
operands: 32
27ExprTuple33
28Literal
29ExprTuple34, 35
30ExprTuple44, 36
31Literal
32ExprTuple45, 37
33Operationoperator: 38
operands: 39
34Operationoperator: 40
operand: 44
35Operationoperator: 42
operand: 45
36Variable
37Variable
38Literal
39ExprTuple44, 45
40Literal
41ExprTuple44
42Literal
43ExprTuple45
44Variable
45Variable