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, v
from proveit.linear_algebra import ScalarMult, VecSpaces
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Conditional(Forall(instance_param_or_params = [v, V], instance_expr = Equals(ScalarMult(one, v), v), domains = [V, VecSpaces(K)]), InSet(one, 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 \in V, V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(\left(1 \cdot v\right) = v\right) \textrm{ if } 1 \in K\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 30
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 20
operands: 6
4Literal
5ExprTuple7
6ExprTuple24, 30
7Lambdaparameters: 21
body: 8
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operands: 12
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15, 25
13Literal
14ExprTuple16, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Operationoperator: 22
operands: 23
18Literal
19ExprTuple24, 25
20Literal
21ExprTuple25, 26
22Literal
23ExprTuple26, 27
24Literal
25Variable
26Variable
27Operationoperator: 28
operand: 30
28Literal
29ExprTuple30
30Variable