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, Lambda, v, w
from proveit.linear_algebra import InnerProd, InnerProdSpaces, Norm
from proveit.logic import Forall, InClass
from proveit.numbers import Complex, Exp, LessEq, Mult, two
In [2]:
# build up the expression from sub-expressions
expr = Lambda(H, Conditional(Forall(instance_param_or_params = [v, w], instance_expr = LessEq(Exp(Norm(InnerProd(v, w)), two), Mult(InnerProd(v, v), InnerProd(w, w))), domain = H), InClass(H, InnerProdSpaces(Complex))))
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_{v, w \in H}~\left(\left \|\left \langle v, w\right \rangle\right \|^{2} \leq \left(\left \langle v, v\right \rangle \cdot \left \langle w, w\right \rangle\right)\right) \textrm{ if } H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(\mathbb{C}\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: 2
1ExprTuple36
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple36, 10
9Lambdaparameters: 43
body: 11
10Operationoperator: 12
operand: 16
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 25
operands: 26
22Operationoperator: 27
operands: 28
23Operationoperator: 30
operands: 29
24Operationoperator: 30
operands: 31
25Literal
26ExprTuple32, 33
27Literal
28ExprTuple34, 35
29ExprTuple44, 36
30Literal
31ExprTuple45, 36
32Operationoperator: 37
operand: 41
33Literal
34Operationoperator: 42
operands: 39
35Operationoperator: 42
operands: 40
36Variable
37Literal
38ExprTuple41
39ExprTuple44, 44
40ExprTuple45, 45
41Operationoperator: 42
operands: 43
42Literal
43ExprTuple44, 45
44Variable
45Variable