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 K, Lambda, V, a, b, x, y
from proveit.linear_algebra import VecSpaces, binary_lin_comb_ax_by
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Forall(instance_param_or_params = [V], instance_expr = 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), 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_{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]\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: 31
body: 1
1Operationoperator: 19
operand: 3
2ExprTuple3
3Lambdaparameter: 45
body: 5
4ExprTuple45
5Conditionalvalue: 6
condition: 7
6Operationoperator: 19
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple45, 12
11Lambdaparameters: 13
body: 14
12Operationoperator: 15
operand: 31
13ExprTuple49, 51
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple31
17Operationoperator: 19
operand: 22
18Operationoperator: 33
operands: 21
19Literal
20ExprTuple22
21ExprTuple23, 24
22Lambdaparameters: 25
body: 26
23Operationoperator: 41
operands: 27
24Operationoperator: 41
operands: 28
25ExprTuple50, 52
26Conditionalvalue: 29
condition: 30
27ExprTuple49, 31
28ExprTuple51, 31
29Operationoperator: 41
operands: 32
30Operationoperator: 33
operands: 34
31Variable
32ExprTuple35, 45
33Literal
34ExprTuple36, 37
35Operationoperator: 38
operands: 39
36Operationoperator: 41
operands: 40
37Operationoperator: 41
operands: 42
38Literal
39ExprTuple43, 44
40ExprTuple50, 45
41Literal
42ExprTuple52, 45
43Operationoperator: 47
operands: 46
44Operationoperator: 47
operands: 48
45Variable
46ExprTuple49, 50
47Literal
48ExprTuple51, 52
49Variable
50Variable
51Variable
52Variable