logo

Expression of type And

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 Px, Py, X, x, y
from proveit.linear_algebra import Hspace, InnerProd, VecZero
from proveit.logic import And, Equals, Forall, Implies
from proveit.numbers import zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = And(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)).with_wrapping_at(2)
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())
\begin{array}{c} \left[\forall_{x \in X}~\left(P\left(x\right) = x\right)\right] \land  \\ \left[\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] \end{array}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()(2)('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 21
operand: 7
4Operationoperator: 21
operand: 8
5ExprTuple7
6ExprTuple8
7Lambdaparameter: 45
body: 9
8Lambdaparameter: 46
body: 10
9Conditionalvalue: 11
condition: 34
10Conditionalvalue: 12
condition: 13
11Operationoperator: 36
operands: 14
12Operationoperator: 15
operands: 16
13Operationoperator: 38
operands: 17
14ExprTuple18, 45
15Literal
16ExprTuple19, 20
17ExprTuple46, 35
18Operationoperator: 29
operand: 45
19Operationoperator: 21
operand: 24
20Operationoperator: 36
operands: 23
21Literal
22ExprTuple24
23ExprTuple25, 26
24Lambdaparameter: 45
body: 28
25Operationoperator: 29
operand: 46
26Operationoperator: 31
operand: 35
27ExprTuple45
28Conditionalvalue: 33
condition: 34
29Variable
30ExprTuple46
31Literal
32ExprTuple35
33Operationoperator: 36
operands: 37
34Operationoperator: 38
operands: 39
35Variable
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple45, 42
40Operationoperator: 43
operands: 44
41Literal
42Variable
43Literal
44ExprTuple45, 46
45Variable
46Variable