logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.tensors

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, Conditional, ExprTuple, K, Lambda, U, V
from proveit.linear_algebra import VecSpaces
from proveit.logic import And, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = ExprTuple(Lambda([U, V], Conditional(And(InSet(A, U), InSet(B, V)), And(InClass(U, sub_expr1), InClass(V, 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(U, V\right) \mapsto \left\{\left(A \in U\right) \land \left(B \in V\right) \textrm{ if } U \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right) ,  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
1Lambdaparameters: 2
body: 3
2ExprTuple21, 22
3Conditionalvalue: 4
condition: 5
4Operationoperator: 7
operands: 6
5Operationoperator: 7
operands: 8
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 14
operands: 13
10Operationoperator: 14
operands: 15
11Operationoperator: 17
operands: 16
12Operationoperator: 17
operands: 18
13ExprTuple19, 21
14Literal
15ExprTuple20, 22
16ExprTuple21, 23
17Literal
18ExprTuple22, 23
19Variable
20Variable
21Variable
22Variable
23Operationoperator: 24
operand: 26
24Literal
25ExprTuple26
26Variable