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 H, v, w
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, InnerProd
from proveit.logic import And, Equals, Forall, InSet, Set
from proveit.numbers import KroneckerDelta
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
expr = And(InSet(sub_expr1, Bases(H)), Forall(instance_param_or_params = [v, w], instance_expr = Equals(InnerProd(v, w), KroneckerDelta(v, w)), domain = sub_expr1))
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(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(H\right)\right) \land \left[\forall_{v, w \in \left\{x_{1}, x_{2}, \ldots, x_{n}\right\}}~\left(\left \langle v, w\right \rangle = \delta_{v, w}\right)\right]
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.()()('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: 17
operands: 1
1ExprTuple2, 3
2Operationoperator: 27
operands: 4
3Operationoperator: 5
operand: 8
4ExprTuple31, 7
5Literal
6ExprTuple8
7Operationoperator: 9
operand: 12
8Lambdaparameters: 25
body: 11
9Literal
10ExprTuple12
11Conditionalvalue: 13
condition: 14
12Variable
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 23
operands: 25
20Operationoperator: 24
operands: 25
21Operationoperator: 27
operands: 26
22Operationoperator: 27
operands: 28
23Literal
24Literal
25ExprTuple29, 30
26ExprTuple29, 31
27Literal
28ExprTuple30, 31
29Variable
30Variable
31Operationoperator: 32
operands: 33
32Literal
33ExprTuple34
34ExprRangelambda_map: 35
start_index: 36
end_index: 37
35Lambdaparameter: 41
body: 38
36Literal
37Variable
38IndexedVarvariable: 39
index: 41
39Variable
40ExprTuple41
41Variable