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, Lambda, Py, X, x, y
from proveit.linear_algebra import Hspace, InnerProd, VecZero
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(y, Conditional(Implies(Forall(instance_param_or_params = [x], instance_expr = Equals(InnerProd(x, y), zero), domain = X), Equals(Py, VecZero(Hspace))), InSet(y, Hspace))))
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(y \mapsto \left\{\left[\forall_{x \in X}~\left(\left \langle x, y\right \rangle = 0\right)\right] \Rightarrow \left(P\left(y\right) = \vec{0}\left(\mathcal{H}\right)\right) \textrm{ if } y \in \mathcal{H}\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: 35
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 27
operands: 7
5Literal
6ExprTuple8, 9
7ExprTuple35, 24
8Operationoperator: 10
operand: 13
9Operationoperator: 25
operands: 12
10Literal
11ExprTuple13
12ExprTuple14, 15
13Lambdaparameter: 34
body: 17
14Operationoperator: 18
operand: 35
15Operationoperator: 20
operand: 24
16ExprTuple34
17Conditionalvalue: 22
condition: 23
18Variable
19ExprTuple35
20Literal
21ExprTuple24
22Operationoperator: 25
operands: 26
23Operationoperator: 27
operands: 28
24Variable
25Literal
26ExprTuple29, 30
27Literal
28ExprTuple34, 31
29Operationoperator: 32
operands: 33
30Literal
31Variable
32Literal
33ExprTuple34, 35
34Variable
35Variable