logo

Expression of type Lambda

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, 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 = 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())
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]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 47
body: 1
1Operationoperator: 8
operand: 3
2ExprTuple3
3Lambdaparameter: 20
body: 5
4ExprTuple20
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 38
operands: 10
8Literal
9ExprTuple11
10ExprTuple20, 44
11Lambdaparameters: 24
body: 12
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 18
14Operationoperator: 35
operands: 17
15Literal
16ExprTuple18
17ExprTuple19, 20
18Lambdaparameters: 21
body: 22
19Operationoperator: 23
operands: 24
20Variable
21ExprTuple42, 43
22Conditionalvalue: 25
condition: 26
23Literal
24ExprTuple40, 41
25Operationoperator: 28
operands: 27
26Operationoperator: 28
operands: 29
27ExprTuple30, 31
28Literal
29ExprTuple32, 33
30Operationoperator: 35
operands: 34
31Operationoperator: 35
operands: 36
32Operationoperator: 38
operands: 37
33Operationoperator: 38
operands: 39
34ExprTuple40, 42
35Literal
36ExprTuple41, 43
37ExprTuple42, 44
38Literal
39ExprTuple43, 44
40Variable
41Variable
42Variable
43Variable
44Operationoperator: 45
operand: 47
45Literal
46ExprTuple47
47Variable