logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.linear_maps

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 A, B, Composition, Conditional, ExprTuple, K, Lambda, V
from proveit.linear_algebra import AntiCommutator, VecAdd, VecSpaces
from proveit.logic import Equals, Forall, InClass
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(Forall(instance_param_or_params = [A, B], instance_expr = Equals(AntiCommutator(A, B), VecAdd(Composition(A, B), Composition(B, A))), domain = V), InClass(V, VecSpaces(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(V \mapsto \left\{\forall_{A, B \in V}~\left(\left\{A, B\right\} = \left(\left(A \circ B\right) + \left(B \circ A\right)\right)\right) \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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: 34
body: 3
2ExprTuple34
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple34, 11
10Lambdaparameters: 35
body: 12
11Operationoperator: 13
operand: 17
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Variable
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 26
operands: 35
23Operationoperator: 27
operands: 28
24Operationoperator: 30
operands: 29
25Operationoperator: 30
operands: 31
26Literal
27Literal
28ExprTuple32, 33
29ExprTuple39, 34
30Literal
31ExprTuple38, 34
32Operationoperator: 36
operands: 35
33Operationoperator: 36
operands: 37
34Variable
35ExprTuple39, 38
36Literal
37ExprTuple38, 39
38Variable
39Variable