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 ExprTuple, H, K, Lambda, a, x, y
from proveit.linear_algebra import InnerProd, InnerProdSpaces, ScalarMult
from proveit.logic import Equals, Forall
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [H], instance_expr = 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), domain = 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(K \mapsto \left[\forall_{H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\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]\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: 24
body: 2
2Operationoperator: 20
operand: 4
3ExprTuple4
4Lambdaparameter: 43
body: 6
5ExprTuple43
6Conditionalvalue: 7
condition: 8
7Operationoperator: 20
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple43, 13
12Lambdaparameter: 48
body: 15
13Operationoperator: 16
operand: 24
14ExprTuple48
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple24
18Operationoperator: 20
operand: 23
19Operationoperator: 39
operands: 22
20Literal
21ExprTuple23
22ExprTuple48, 24
23Lambdaparameters: 47
body: 25
24Variable
25Conditionalvalue: 26
condition: 27
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Literal
29ExprTuple32, 33
30Literal
31ExprTuple34, 35
32Operationoperator: 46
operands: 36
33Operationoperator: 44
operands: 37
34Operationoperator: 39
operands: 38
35Operationoperator: 39
operands: 40
36ExprTuple41, 50
37ExprTuple48, 42
38ExprTuple49, 43
39Literal
40ExprTuple50, 43
41Operationoperator: 44
operands: 45
42Operationoperator: 46
operands: 47
43Variable
44Literal
45ExprTuple48, 49
46Literal
47ExprTuple49, 50
48Variable
49Variable
50Variable