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, Px, Py, X, x, y
from proveit.linear_algebra import Hspace, InnerProd, VecZero
from proveit.logic import Equals, Forall, Implies
from proveit.numbers import zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Px, x), domain = X), Forall(instance_param_or_params = [y], instance_expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(InnerProd(x, y), zero), domain = X), Equals(Py, VecZero(Hspace))), domain = 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(\forall_{x \in X}~\left(P\left(x\right) = x\right), \forall_{y \in \mathcal{H}}~\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)\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 19
operand: 5
2Operationoperator: 19
operand: 6
3ExprTuple5
4ExprTuple6
5Lambdaparameter: 43
body: 7
6Lambdaparameter: 44
body: 8
7Conditionalvalue: 9
condition: 32
8Conditionalvalue: 10
condition: 11
9Operationoperator: 34
operands: 12
10Operationoperator: 13
operands: 14
11Operationoperator: 36
operands: 15
12ExprTuple16, 43
13Literal
14ExprTuple17, 18
15ExprTuple44, 33
16Operationoperator: 27
operand: 43
17Operationoperator: 19
operand: 22
18Operationoperator: 34
operands: 21
19Literal
20ExprTuple22
21ExprTuple23, 24
22Lambdaparameter: 43
body: 26
23Operationoperator: 27
operand: 44
24Operationoperator: 29
operand: 33
25ExprTuple43
26Conditionalvalue: 31
condition: 32
27Variable
28ExprTuple44
29Literal
30ExprTuple33
31Operationoperator: 34
operands: 35
32Operationoperator: 36
operands: 37
33Variable
34Literal
35ExprTuple38, 39
36Literal
37ExprTuple43, 40
38Operationoperator: 41
operands: 42
39Literal
40Variable
41Literal
42ExprTuple43, 44
43Variable
44Variable