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 Conditional, 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(i, Conditional(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)), InSet(i, 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())
i \mapsto \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] \textrm{ if } i \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 44
body: 2
1ExprTuple44
2Conditionalvalue: 3
condition: 4
3Operationoperator: 12
operand: 7
4Operationoperator: 45
operands: 6
5ExprTuple7
6ExprTuple44, 8
7Lambdaparameters: 33
body: 9
8Literal
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 15
11Operationoperator: 23
operands: 14
12Literal
13ExprTuple15
14ExprTuple16
15Lambdaparameters: 31
body: 17
16ExprRangelambda_map: 18
start_index: 43
end_index: 44
17Conditionalvalue: 19
condition: 20
18Lambdaparameter: 52
body: 21
19Operationoperator: 45
operands: 22
20Operationoperator: 23
operands: 24
21Operationoperator: 25
operands: 26
22ExprTuple27, 28
23Literal
24ExprTuple29
25Literal
26ExprTuple48, 30
27Operationoperator: 32
operands: 31
28Operationoperator: 32
operands: 33
29ExprRangelambda_map: 34
start_index: 43
end_index: 44
30Operationoperator: 35
operand: 40
31ExprTuple37
32Literal
33ExprTuple38
34Lambdaparameter: 52
body: 39
35Literal
36ExprTuple40
37ExprRangelambda_map: 41
start_index: 43
end_index: 44
38ExprRangelambda_map: 42
start_index: 43
end_index: 44
39Operationoperator: 45
operands: 46
40Variable
41Lambdaparameter: 52
body: 47
42Lambdaparameter: 52
body: 48
43Literal
44Variable
45Literal
46ExprTuple47, 48
47IndexedVarvariable: 49
index: 52
48IndexedVarvariable: 50
index: 52
49Variable
50Variable
51ExprTuple52
52Variable