logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.inner_products

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, H, K, Lambda, x, y, z
from proveit.linear_algebra import InnerProd, InnerProdSpaces, VecAdd
from proveit.logic import Equals, Forall, InClass
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(H, Conditional(Forall(instance_param_or_params = [x, y, z], instance_expr = Equals(InnerProd(x, VecAdd(y, z)), VecAdd(InnerProd(x, y), InnerProd(x, z))), domain = H), InClass(H, InnerProdSpaces(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(H \mapsto \left\{\forall_{x, y, z \in H}~\left(\left \langle x, y + z\right \rangle = \left(\left \langle x, y\right \rangle + \left \langle x, z\right \rangle\right)\right) \textrm{ if } H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\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: 37
body: 3
2ExprTuple37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple37, 11
10Lambdaparameters: 12
body: 13
11Operationoperator: 14
operand: 18
12ExprTuple44, 43, 45
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple18
16Operationoperator: 19
operands: 20
17Operationoperator: 21
operands: 22
18Variable
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26, 27
23Operationoperator: 41
operands: 28
24Operationoperator: 38
operands: 29
25Operationoperator: 32
operands: 30
26Operationoperator: 32
operands: 31
27Operationoperator: 32
operands: 33
28ExprTuple44, 34
29ExprTuple35, 36
30ExprTuple44, 37
31ExprTuple43, 37
32Literal
33ExprTuple45, 37
34Operationoperator: 38
operands: 39
35Operationoperator: 41
operands: 40
36Operationoperator: 41
operands: 42
37Variable
38Literal
39ExprTuple43, 45
40ExprTuple44, 43
41Literal
42ExprTuple44, 45
43Variable
44Variable
45Variable