logo

Expression of type Lambda

from the theory of proveit.linear_algebra.tensors

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 ExprRange, IndexedVar, K, Lambda, Variable, a, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import InnerProdSpaces, Norm, TensorProd
from proveit.logic import Equals, Forall
from proveit.numbers import Mult, NaturalPos, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [V_1_to_i]
expr = Lambda(K, Forall(instance_param_or_params = [i], instance_expr = Forall(instance_param_or_params = sub_expr2, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = Equals(Norm(TensorProd(a_1_to_i)), Mult(ExprRange(sub_expr1, Norm(IndexedVar(a, sub_expr1)), one, i))), domains = sub_expr2).with_wrapping(), domain = InnerProdSpaces(K)).with_wrapping(), domain = NaturalPos))
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_{i \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\\
\left[\begin{array}{l}\forall_{\left(a_{1} \in V_{1}\right), \left(a_{2} \in V_{2}\right), \ldots, \left(a_{i} \in V_{i}\right)}~\\
\left(\left \|a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}\right \| = \left(\left \|a_{1}\right \| \cdot  \left \|a_{2}\right \| \cdot  \ldots \cdot  \left \|a_{i}\right \|\right)\right)\end{array}\right]\end{array}\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: 47
body: 1
1Operationoperator: 18
operand: 3
2ExprTuple3
3Lambdaparameter: 58
body: 5
4ExprTuple58
5Conditionalvalue: 6
condition: 7
6Operationoperator: 18
operand: 10
7Operationoperator: 51
operands: 9
8ExprTuple10
9ExprTuple58, 11
10Lambdaparameters: 12
body: 13
11Literal
12ExprTuple14
13Conditionalvalue: 15
condition: 16
14ExprRangelambda_map: 17
start_index: 57
end_index: 58
15Operationoperator: 18
operand: 21
16Operationoperator: 30
operands: 20
17Lambdaparameter: 65
body: 55
18Literal
19ExprTuple21
20ExprTuple22
21Lambdaparameters: 49
body: 23
22ExprRangelambda_map: 24
start_index: 57
end_index: 58
23Conditionalvalue: 25
condition: 26
24Lambdaparameter: 65
body: 27
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operands: 31
27Operationoperator: 32
operands: 33
28Literal
29ExprTuple34, 35
30Literal
31ExprTuple36
32Literal
33ExprTuple55, 37
34Operationoperator: 59
operand: 44
35Operationoperator: 39
operands: 40
36ExprRangelambda_map: 41
start_index: 57
end_index: 58
37Operationoperator: 42
operand: 47
38ExprTuple44
39Literal
40ExprTuple45
41Lambdaparameter: 65
body: 46
42Literal
43ExprTuple47
44Operationoperator: 48
operands: 49
45ExprRangelambda_map: 50
start_index: 57
end_index: 58
46Operationoperator: 51
operands: 52
47Variable
48Literal
49ExprTuple53
50Lambdaparameter: 65
body: 54
51Literal
52ExprTuple62, 55
53ExprRangelambda_map: 56
start_index: 57
end_index: 58
54Operationoperator: 59
operand: 62
55IndexedVarvariable: 61
index: 65
56Lambdaparameter: 65
body: 62
57Literal
58Variable
59Literal
60ExprTuple62
61Variable
62IndexedVarvariable: 63
index: 65
63Variable
64ExprTuple65
65Variable