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, a, x, y
from proveit.linear_algebra import InnerProd, InnerProdSpaces, ScalarMult
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 = [a], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = Equals(InnerProd(ScalarMult(a, x), y), ScalarMult(a, InnerProd(x, y))), domain = H), domain = K), 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_{a \in K}~\left[\forall_{x, y \in H}~\left(\left \langle a \cdot x, y\right \rangle = \left(a \cdot \left \langle x, y\right \rangle\right)\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: 40
body: 3
2ExprTuple40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple40, 10
9Lambdaparameter: 45
body: 12
10Operationoperator: 13
operand: 21
11ExprTuple45
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple21
15Operationoperator: 17
operand: 20
16Operationoperator: 36
operands: 19
17Literal
18ExprTuple20
19ExprTuple45, 21
20Lambdaparameters: 44
body: 22
21Variable
22Conditionalvalue: 23
condition: 24
23Operationoperator: 25
operands: 26
24Operationoperator: 27
operands: 28
25Literal
26ExprTuple29, 30
27Literal
28ExprTuple31, 32
29Operationoperator: 43
operands: 33
30Operationoperator: 41
operands: 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33ExprTuple38, 47
34ExprTuple45, 39
35ExprTuple46, 40
36Literal
37ExprTuple47, 40
38Operationoperator: 41
operands: 42
39Operationoperator: 43
operands: 44
40Variable
41Literal
42ExprTuple45, 46
43Literal
44ExprTuple46, 47
45Variable
46Variable
47Variable