logo

Expression of type ExprTuple

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 ExprTuple, K, Lambda, V
from proveit.core_expr_types import a_1_to_n, x_1_to_n
from proveit.linear_algebra import VecSpaces, lin_comb_axn
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = InSet(lin_comb_axn, 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())
\left(K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in K}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\left(\left(\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right) \in V\right)\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
0ExprTuple1
1Lambdaparameter: 41
body: 2
2Operationoperator: 22
operand: 4
3ExprTuple4
4Lambdaparameter: 53
body: 6
5ExprTuple53
6Conditionalvalue: 7
condition: 8
7Operationoperator: 22
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple53, 13
12Lambdaparameters: 14
body: 15
13Operationoperator: 16
operand: 41
14ExprTuple18
15Conditionalvalue: 19
condition: 20
16Literal
17ExprTuple41
18ExprRangelambda_map: 21
start_index: 48
end_index: 49
19Operationoperator: 22
operand: 25
20Operationoperator: 36
operands: 24
21Lambdaparameter: 61
body: 56
22Literal
23ExprTuple25
24ExprTuple26
25Lambdaparameters: 27
body: 28
26ExprRangelambda_map: 29
start_index: 48
end_index: 49
27ExprTuple30
28Conditionalvalue: 31
condition: 32
29Lambdaparameter: 61
body: 33
30ExprRangelambda_map: 34
start_index: 48
end_index: 49
31Operationoperator: 50
operands: 35
32Operationoperator: 36
operands: 37
33Operationoperator: 50
operands: 38
34Lambdaparameter: 61
body: 57
35ExprTuple39, 53
36Literal
37ExprTuple40
38ExprTuple56, 41
39Operationoperator: 42
operands: 43
40ExprRangelambda_map: 44
start_index: 48
end_index: 49
41Variable
42Literal
43ExprTuple45
44Lambdaparameter: 61
body: 46
45ExprRangelambda_map: 47
start_index: 48
end_index: 49
46Operationoperator: 50
operands: 51
47Lambdaparameter: 61
body: 52
48Literal
49Variable
50Literal
51ExprTuple57, 53
52Operationoperator: 54
operands: 55
53Variable
54Literal
55ExprTuple56, 57
56IndexedVarvariable: 58
index: 61
57IndexedVarvariable: 59
index: 61
58Variable
59Variable
60ExprTuple61
61Variable