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, 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 = ExprTuple(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())
\left(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]\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: 32
body: 2
2Operationoperator: 20
operand: 4
3ExprTuple4
4Lambdaparameter: 46
body: 6
5ExprTuple46
6Conditionalvalue: 7
condition: 8
7Operationoperator: 20
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple46, 13
12Lambdaparameters: 14
body: 15
13Operationoperator: 16
operand: 32
14ExprTuple50, 52
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple32
18Operationoperator: 20
operand: 23
19Operationoperator: 34
operands: 22
20Literal
21ExprTuple23
22ExprTuple24, 25
23Lambdaparameters: 26
body: 27
24Operationoperator: 42
operands: 28
25Operationoperator: 42
operands: 29
26ExprTuple51, 53
27Conditionalvalue: 30
condition: 31
28ExprTuple50, 32
29ExprTuple52, 32
30Operationoperator: 42
operands: 33
31Operationoperator: 34
operands: 35
32Variable
33ExprTuple36, 46
34Literal
35ExprTuple37, 38
36Operationoperator: 39
operands: 40
37Operationoperator: 42
operands: 41
38Operationoperator: 42
operands: 43
39Literal
40ExprTuple44, 45
41ExprTuple51, 46
42Literal
43ExprTuple53, 46
44Operationoperator: 48
operands: 47
45Operationoperator: 48
operands: 49
46Variable
47ExprTuple50, 51
48Literal
49ExprTuple52, 53
50Variable
51Variable
52Variable
53Variable