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, a, x
from proveit.linear_algebra import ScalarMult, VecSpaces
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], instance_expr = Forall(instance_param_or_params = [x], instance_expr = InSet(ScalarMult(a, x), 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 \in K}~\left[\forall_{x \in V}~\left(\left(a \cdot x\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: 29
body: 2
1ExprTuple29
2Conditionalvalue: 3
condition: 4
3Operationoperator: 16
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple29, 9
8Lambdaparameter: 32
body: 11
9Operationoperator: 12
operand: 20
10ExprTuple32
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple20
14Operationoperator: 16
operand: 19
15Operationoperator: 26
operands: 18
16Literal
17ExprTuple19
18ExprTuple32, 20
19Lambdaparameter: 33
body: 22
20Variable
21ExprTuple33
22Conditionalvalue: 23
condition: 24
23Operationoperator: 26
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple33, 29
28Operationoperator: 30
operands: 31
29Variable
30Literal
31ExprTuple32, 33
32Variable
33Variable