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