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 K, Lambda, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Forall, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [V_1_to_i]
expr = Lambda(K, Forall(instance_param_or_params = [i], instance_expr = Forall(instance_param_or_params = sub_expr1, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = InSet(TensorProd(a_1_to_i), TensorProd(V_1_to_i)), domains = sub_expr1), domain = VecSpaces(K)), 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[\forall_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\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) \in \left(V_{1} {\otimes}  V_{2} {\otimes}  \ldots {\otimes}  V_{i}\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: 43
body: 1
1Operationoperator: 15
operand: 3
2ExprTuple3
3Lambdaparameter: 47
body: 5
4ExprTuple47
5Conditionalvalue: 6
condition: 7
6Operationoperator: 15
operand: 10
7Operationoperator: 48
operands: 9
8ExprTuple10
9ExprTuple47, 11
10Lambdaparameters: 36
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 18
14Operationoperator: 26
operands: 17
15Literal
16ExprTuple18
17ExprTuple19
18Lambdaparameters: 34
body: 20
19ExprRangelambda_map: 21
start_index: 46
end_index: 47
20Conditionalvalue: 22
condition: 23
21Lambdaparameter: 55
body: 24
22Operationoperator: 48
operands: 25
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operands: 29
25ExprTuple30, 31
26Literal
27ExprTuple32
28Literal
29ExprTuple51, 33
30Operationoperator: 35
operands: 34
31Operationoperator: 35
operands: 36
32ExprRangelambda_map: 37
start_index: 46
end_index: 47
33Operationoperator: 38
operand: 43
34ExprTuple40
35Literal
36ExprTuple41
37Lambdaparameter: 55
body: 42
38Literal
39ExprTuple43
40ExprRangelambda_map: 44
start_index: 46
end_index: 47
41ExprRangelambda_map: 45
start_index: 46
end_index: 47
42Operationoperator: 48
operands: 49
43Variable
44Lambdaparameter: 55
body: 50
45Lambdaparameter: 55
body: 51
46Literal
47Variable
48Literal
49ExprTuple50, 51
50IndexedVarvariable: 52
index: 55
51IndexedVarvariable: 53
index: 55
52Variable
53Variable
54ExprTuple55
55Variable