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, a, b, x, y
from proveit.linear_algebra import binary_lin_comb_ax_by
from proveit.logic import And, Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a, b], Conditional(Forall(instance_param_or_params = [x, y], instance_expr = InSet(binary_lin_comb_ax_by, V), domain = V), And(InSet(a, K), InSet(b, 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(\left(a, b\right) \mapsto \left\{\forall_{x, y \in V}~\left(\left(\left(a \cdot x\right) + \left(b \cdot y\right)\right) \in V\right) \textrm{ if } a \in K ,  b \in 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
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple36, 38
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 12
body: 13
10Operationoperator: 28
operands: 14
11Operationoperator: 28
operands: 15
12ExprTuple37, 39
13Conditionalvalue: 16
condition: 17
14ExprTuple36, 18
15ExprTuple38, 18
16Operationoperator: 28
operands: 19
17Operationoperator: 20
operands: 21
18Variable
19ExprTuple22, 32
20Literal
21ExprTuple23, 24
22Operationoperator: 25
operands: 26
23Operationoperator: 28
operands: 27
24Operationoperator: 28
operands: 29
25Literal
26ExprTuple30, 31
27ExprTuple37, 32
28Literal
29ExprTuple39, 32
30Operationoperator: 34
operands: 33
31Operationoperator: 34
operands: 35
32Variable
33ExprTuple36, 37
34Literal
35ExprTuple38, 39
36Variable
37Variable
38Variable
39Variable