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, W
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import And, Exists, Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = ExprTuple(Lambda(W, Conditional(Forall(instance_param_or_params = [A, B], instance_expr = Exists(instance_param_or_params = [U, V], instance_expr = And(InSet(A, U), InSet(B, V)), domain = sub_expr1), condition = InSet(TensorProd(A, B), W)), InClass(W, 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(W \mapsto \left\{\forall_{A, B~|~\left(A {\otimes} B\right) \in W}~\left[\exists_{U, V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(\left(A \in U\right) \land \left(B \in V\right)\right)\right] \textrm{ if } W \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: 18
body: 3
2ExprTuple18
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 36
operands: 8
6Literal
7ExprTuple9
8ExprTuple18, 42
9Lambdaparameters: 22
body: 10
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 16
12Operationoperator: 33
operands: 15
13Literal
14ExprTuple16
15ExprTuple17, 18
16Lambdaparameters: 19
body: 20
17Operationoperator: 21
operands: 22
18Variable
19ExprTuple40, 41
20Conditionalvalue: 23
condition: 24
21Literal
22ExprTuple38, 39
23Operationoperator: 26
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple30, 31
28Operationoperator: 33
operands: 32
29Operationoperator: 33
operands: 34
30Operationoperator: 36
operands: 35
31Operationoperator: 36
operands: 37
32ExprTuple38, 40
33Literal
34ExprTuple39, 41
35ExprTuple40, 42
36Literal
37ExprTuple41, 42
38Variable
39Variable
40Variable
41Variable
42Operationoperator: 43
operand: 45
43Literal
44ExprTuple45
45Variable