logo

Expression of type Lambda

from the theory of proveit.linear_algebra.scalar_multiplication

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, V
from proveit.core_expr_types import a_1_to_n, x_1_to_n
from proveit.linear_algebra import VecSpaces, lin_comb_axn
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = InSet(lin_comb_axn, V), domain = V), domain = K), domain = VecSpaces(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())
K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in K}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\left(\left(\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right) \in V\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: 40
body: 1
1Operationoperator: 21
operand: 3
2ExprTuple3
3Lambdaparameter: 52
body: 5
4ExprTuple52
5Conditionalvalue: 6
condition: 7
6Operationoperator: 21
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple52, 12
11Lambdaparameters: 13
body: 14
12Operationoperator: 15
operand: 40
13ExprTuple17
14Conditionalvalue: 18
condition: 19
15Literal
16ExprTuple40
17ExprRangelambda_map: 20
start_index: 47
end_index: 48
18Operationoperator: 21
operand: 24
19Operationoperator: 35
operands: 23
20Lambdaparameter: 60
body: 55
21Literal
22ExprTuple24
23ExprTuple25
24Lambdaparameters: 26
body: 27
25ExprRangelambda_map: 28
start_index: 47
end_index: 48
26ExprTuple29
27Conditionalvalue: 30
condition: 31
28Lambdaparameter: 60
body: 32
29ExprRangelambda_map: 33
start_index: 47
end_index: 48
30Operationoperator: 49
operands: 34
31Operationoperator: 35
operands: 36
32Operationoperator: 49
operands: 37
33Lambdaparameter: 60
body: 56
34ExprTuple38, 52
35Literal
36ExprTuple39
37ExprTuple55, 40
38Operationoperator: 41
operands: 42
39ExprRangelambda_map: 43
start_index: 47
end_index: 48
40Variable
41Literal
42ExprTuple44
43Lambdaparameter: 60
body: 45
44ExprRangelambda_map: 46
start_index: 47
end_index: 48
45Operationoperator: 49
operands: 50
46Lambdaparameter: 60
body: 51
47Literal
48Variable
49Literal
50ExprTuple56, 52
51Operationoperator: 53
operands: 54
52Variable
53Literal
54ExprTuple55, 56
55IndexedVarvariable: 57
index: 60
56IndexedVarvariable: 58
index: 60
57Variable
58Variable
59ExprTuple60
60Variable