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 Conditional, 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, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = Lambda(V, Conditional(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), InClass(V, 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())
V \mapsto \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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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: 49
body: 2
1ExprTuple49
2Conditionalvalue: 3
condition: 4
3Operationoperator: 18
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple49, 9
8Lambdaparameters: 10
body: 11
9Operationoperator: 12
operand: 37
10ExprTuple14
11Conditionalvalue: 15
condition: 16
12Literal
13ExprTuple37
14ExprRangelambda_map: 17
start_index: 44
end_index: 45
15Operationoperator: 18
operand: 21
16Operationoperator: 32
operands: 20
17Lambdaparameter: 57
body: 52
18Literal
19ExprTuple21
20ExprTuple22
21Lambdaparameters: 23
body: 24
22ExprRangelambda_map: 25
start_index: 44
end_index: 45
23ExprTuple26
24Conditionalvalue: 27
condition: 28
25Lambdaparameter: 57
body: 29
26ExprRangelambda_map: 30
start_index: 44
end_index: 45
27Operationoperator: 46
operands: 31
28Operationoperator: 32
operands: 33
29Operationoperator: 46
operands: 34
30Lambdaparameter: 57
body: 53
31ExprTuple35, 49
32Literal
33ExprTuple36
34ExprTuple52, 37
35Operationoperator: 38
operands: 39
36ExprRangelambda_map: 40
start_index: 44
end_index: 45
37Variable
38Literal
39ExprTuple41
40Lambdaparameter: 57
body: 42
41ExprRangelambda_map: 43
start_index: 44
end_index: 45
42Operationoperator: 46
operands: 47
43Lambdaparameter: 57
body: 48
44Literal
45Variable
46Literal
47ExprTuple53, 49
48Operationoperator: 50
operands: 51
49Variable
50Literal
51ExprTuple52, 53
52IndexedVarvariable: 54
index: 57
53IndexedVarvariable: 55
index: 57
54Variable
55Variable
56ExprTuple57
57Variable