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, b, x, y
from proveit.linear_algebra import VecSpaces, binary_lin_comb_ax_by
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, b], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = InSet(binary_lin_comb_ax_by, 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, b \in K}~\left[\forall_{x, y \in V}~\left(\left(\left(a \cdot x\right) + \left(b \cdot y\right)\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: 42
body: 2
1ExprTuple42
2Conditionalvalue: 3
condition: 4
3Operationoperator: 16
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple42, 9
8Lambdaparameters: 10
body: 11
9Operationoperator: 12
operand: 28
10ExprTuple46, 48
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple28
14Operationoperator: 16
operand: 19
15Operationoperator: 30
operands: 18
16Literal
17ExprTuple19
18ExprTuple20, 21
19Lambdaparameters: 22
body: 23
20Operationoperator: 38
operands: 24
21Operationoperator: 38
operands: 25
22ExprTuple47, 49
23Conditionalvalue: 26
condition: 27
24ExprTuple46, 28
25ExprTuple48, 28
26Operationoperator: 38
operands: 29
27Operationoperator: 30
operands: 31
28Variable
29ExprTuple32, 42
30Literal
31ExprTuple33, 34
32Operationoperator: 35
operands: 36
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36ExprTuple40, 41
37ExprTuple47, 42
38Literal
39ExprTuple49, 42
40Operationoperator: 44
operands: 43
41Operationoperator: 44
operands: 45
42Variable
43ExprTuple46, 47
44Literal
45ExprTuple48, 49
46Variable
47Variable
48Variable
49Variable