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, alpha, beta, x
from proveit.linear_algebra import ScalarMult
from proveit.logic import Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(x, Conditional(Forall(instance_param_or_params = [alpha, beta], instance_expr = Equals(ScalarMult(alpha, ScalarMult(beta, x)), ScalarMult(ScalarMult(alpha, beta), x)), domain = K), InSet(x, V))))
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(x \mapsto \left\{\forall_{\alpha, \beta \in K}~\left(\left(\alpha \cdot \left(\beta \cdot x\right)\right) = \left(\left(\alpha \cdot \beta\right) \cdot x\right)\right) \textrm{ if } x \in V\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: 33
body: 3
2ExprTuple33
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 25
operands: 8
6Literal
7ExprTuple9
8ExprTuple33, 10
9Lambdaparameters: 32
body: 11
10Variable
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 31
operands: 22
19Operationoperator: 31
operands: 23
20Operationoperator: 25
operands: 24
21Operationoperator: 25
operands: 26
22ExprTuple34, 27
23ExprTuple28, 33
24ExprTuple34, 29
25Literal
26ExprTuple35, 29
27Operationoperator: 31
operands: 30
28Operationoperator: 31
operands: 32
29Variable
30ExprTuple35, 33
31Literal
32ExprTuple34, 35
33Variable
34Variable
35Variable