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 VecSpaces, binary_lin_comb_ax_by
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, b], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = InSet(binary_lin_comb_ax_by, 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, 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] \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: 43
body: 3
2ExprTuple43
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple43, 10
9Lambdaparameters: 11
body: 12
10Operationoperator: 13
operand: 29
11ExprTuple47, 49
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple29
15Operationoperator: 17
operand: 20
16Operationoperator: 31
operands: 19
17Literal
18ExprTuple20
19ExprTuple21, 22
20Lambdaparameters: 23
body: 24
21Operationoperator: 39
operands: 25
22Operationoperator: 39
operands: 26
23ExprTuple48, 50
24Conditionalvalue: 27
condition: 28
25ExprTuple47, 29
26ExprTuple49, 29
27Operationoperator: 39
operands: 30
28Operationoperator: 31
operands: 32
29Variable
30ExprTuple33, 43
31Literal
32ExprTuple34, 35
33Operationoperator: 36
operands: 37
34Operationoperator: 39
operands: 38
35Operationoperator: 39
operands: 40
36Literal
37ExprTuple41, 42
38ExprTuple48, 43
39Literal
40ExprTuple50, 43
41Operationoperator: 45
operands: 44
42Operationoperator: 45
operands: 46
43Variable
44ExprTuple47, 48
45Literal
46ExprTuple49, 50
47Variable
48Variable
49Variable
50Variable