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 Conditional, K, Lambda, P, Px, V, W, c, x
from proveit.linear_algebra import LinMap, ScalarMult, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = Lambda([V, W], Conditional(Forall(instance_param_or_params = [c], instance_expr = Forall(instance_param_or_params = [P], instance_expr = Equals(ScalarMult(c, P), Lambda(x, Conditional(ScalarMult(c, Px), InSet(x, V)))), domain = LinMap(V, W)), domain = K), And(InClass(V, sub_expr1), InClass(W, sub_expr1))))
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_{c \in K}~\left[\forall_{P \in \mathcal{L}\left(V, W\right)}~\left(\left(c \cdot P\right) = \left[x \mapsto \left\{c \cdot P\left(x\right) \textrm{ if } x \in V\right..\right]\right)\right] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right) ,  W \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
0Lambdaparameters: 38
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 18
operand: 7
3Operationoperator: 5
operands: 6
4ExprTuple7
5Literal
6ExprTuple8, 9
7Lambdaparameter: 46
body: 11
8Operationoperator: 13
operands: 12
9Operationoperator: 13
operands: 14
10ExprTuple46
11Conditionalvalue: 15
condition: 16
12ExprTuple48, 17
13Literal
14ExprTuple41, 17
15Operationoperator: 18
operand: 23
16Operationoperator: 44
operands: 20
17Operationoperator: 21
operand: 24
18Literal
19ExprTuple23
20ExprTuple46, 24
21Literal
22ExprTuple24
23Lambdaparameter: 49
body: 26
24Variable
25ExprTuple49
26Conditionalvalue: 27
condition: 28
27Operationoperator: 29
operands: 30
28Operationoperator: 44
operands: 31
29Literal
30ExprTuple32, 33
31ExprTuple49, 34
32Operationoperator: 42
operands: 35
33Lambdaparameter: 51
body: 36
34Operationoperator: 37
operands: 38
35ExprTuple46, 49
36Conditionalvalue: 39
condition: 40
37Literal
38ExprTuple48, 41
39Operationoperator: 42
operands: 43
40Operationoperator: 44
operands: 45
41Variable
42Literal
43ExprTuple46, 47
44Literal
45ExprTuple51, 48
46Variable
47Operationoperator: 49
operand: 51
48Variable
49Variable
50ExprTuple51
51Variable