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 Conditional, 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, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(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), 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())
\left(V \mapsto \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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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: 50
body: 3
2ExprTuple50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 19
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple50, 10
9Lambdaparameters: 11
body: 12
10Operationoperator: 13
operand: 38
11ExprTuple15
12Conditionalvalue: 16
condition: 17
13Literal
14ExprTuple38
15ExprRangelambda_map: 18
start_index: 45
end_index: 46
16Operationoperator: 19
operand: 22
17Operationoperator: 33
operands: 21
18Lambdaparameter: 58
body: 53
19Literal
20ExprTuple22
21ExprTuple23
22Lambdaparameters: 24
body: 25
23ExprRangelambda_map: 26
start_index: 45
end_index: 46
24ExprTuple27
25Conditionalvalue: 28
condition: 29
26Lambdaparameter: 58
body: 30
27ExprRangelambda_map: 31
start_index: 45
end_index: 46
28Operationoperator: 47
operands: 32
29Operationoperator: 33
operands: 34
30Operationoperator: 47
operands: 35
31Lambdaparameter: 58
body: 54
32ExprTuple36, 50
33Literal
34ExprTuple37
35ExprTuple53, 38
36Operationoperator: 39
operands: 40
37ExprRangelambda_map: 41
start_index: 45
end_index: 46
38Variable
39Literal
40ExprTuple42
41Lambdaparameter: 58
body: 43
42ExprRangelambda_map: 44
start_index: 45
end_index: 46
43Operationoperator: 47
operands: 48
44Lambdaparameter: 58
body: 49
45Literal
46Variable
47Literal
48ExprTuple54, 50
49Operationoperator: 51
operands: 52
50Variable
51Literal
52ExprTuple53, 54
53IndexedVarvariable: 55
index: 58
54IndexedVarvariable: 56
index: 58
55Variable
56Variable
57ExprTuple58
58Variable