logo

Expression of type Lambda

from the theory of proveit.linear_algebra.addition

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 K, Lambda, V, x
from proveit.linear_algebra import VecAdd, VecSpaces, VecZero
from proveit.logic import Equals, Forall
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecZero(V)
expr = Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [x], instance_expr = Equals(VecAdd(x, sub_expr1), sub_expr1), domain = V), domain = 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())
K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{x \in V}~\left(\left(x + \vec{0}\left(V\right)\right) = \vec{0}\left(V\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
0Lambdaparameter: 19
body: 1
1Operationoperator: 7
operand: 3
2ExprTuple3
3Lambdaparameter: 31
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple31, 12
11Lambdaparameter: 27
body: 14
12Operationoperator: 15
operand: 19
13ExprTuple27
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19Variable
20Literal
21ExprTuple24, 28
22Literal
23ExprTuple27, 31
24Operationoperator: 25
operands: 26
25Literal
26ExprTuple27, 28
27Variable
28Operationoperator: 29
operand: 31
29Literal
30ExprTuple31
31Variable