logo

Expression of type Lambda

from the theory of proveit.linear_algebra.linear_maps

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 Function, Lambda, P, Px, V, W, x, y
from proveit.linear_algebra import LinMap, VecAdd
from proveit.logic import Equals, Forall
In [2]:
# build up the expression from sub-expressions
expr = Lambda([V, W], Forall(instance_param_or_params = [P], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = Equals(Function(P, [VecAdd(x, y)]), VecAdd(Px, Function(P, [y]))), domain = V), domain = LinMap(V, W)))
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())
\left(V, W\right) \mapsto \left[\forall_{P \in \mathcal{L}\left(V, W\right)}~\left[\forall_{x, y \in V}~\left(P\left(x + y\right) = \left(P\left(x\right) + P\left(y\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
0Lambdaparameters: 15
body: 1
1Operationoperator: 8
operand: 3
2ExprTuple3
3Lambdaparameter: 39
body: 5
4ExprTuple39
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 30
operands: 10
8Literal
9ExprTuple11
10ExprTuple39, 12
11Lambdaparameters: 37
body: 13
12Operationoperator: 14
operands: 15
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple35, 18
16Operationoperator: 19
operands: 20
17Operationoperator: 21
operands: 22
18Variable
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26
23Operationoperator: 39
operand: 32
24Operationoperator: 36
operands: 28
25Operationoperator: 30
operands: 29
26Operationoperator: 30
operands: 31
27ExprTuple32
28ExprTuple33, 34
29ExprTuple41, 35
30Literal
31ExprTuple42, 35
32Operationoperator: 36
operands: 37
33Operationoperator: 39
operand: 41
34Operationoperator: 39
operand: 42
35Variable
36Literal
37ExprTuple41, 42
38ExprTuple41
39Variable
40ExprTuple42
41Variable
42Variable