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, ExprTuple, K, Lambda, U, V, W
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import And, Exists, Forall, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [W], instance_expr = 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)), 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(K \mapsto \left[\forall_{W \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\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]\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: 48
body: 2
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 21
body: 6
5ExprTuple21
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 39
operands: 11
9Literal
10ExprTuple12
11ExprTuple21, 45
12Lambdaparameters: 25
body: 13
13Conditionalvalue: 14
condition: 15
14Operationoperator: 16
operand: 19
15Operationoperator: 36
operands: 18
16Literal
17ExprTuple19
18ExprTuple20, 21
19Lambdaparameters: 22
body: 23
20Operationoperator: 24
operands: 25
21Variable
22ExprTuple43, 44
23Conditionalvalue: 26
condition: 27
24Literal
25ExprTuple41, 42
26Operationoperator: 29
operands: 28
27Operationoperator: 29
operands: 30
28ExprTuple31, 32
29Literal
30ExprTuple33, 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33Operationoperator: 39
operands: 38
34Operationoperator: 39
operands: 40
35ExprTuple41, 43
36Literal
37ExprTuple42, 44
38ExprTuple43, 45
39Literal
40ExprTuple44, 45
41Variable
42Variable
43Variable
44Variable
45Operationoperator: 46
operand: 48
46Literal
47ExprTuple48
48Variable