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, Conditional, 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 17
body: 2
1ExprTuple17
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 35
operands: 7
5Literal
6ExprTuple8
7ExprTuple17, 41
8Lambdaparameters: 21
body: 9
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 15
11Operationoperator: 32
operands: 14
12Literal
13ExprTuple15
14ExprTuple16, 17
15Lambdaparameters: 18
body: 19
16Operationoperator: 20
operands: 21
17Variable
18ExprTuple39, 40
19Conditionalvalue: 22
condition: 23
20Literal
21ExprTuple37, 38
22Operationoperator: 25
operands: 24
23Operationoperator: 25
operands: 26
24ExprTuple27, 28
25Literal
26ExprTuple29, 30
27Operationoperator: 32
operands: 31
28Operationoperator: 32
operands: 33
29Operationoperator: 35
operands: 34
30Operationoperator: 35
operands: 36
31ExprTuple37, 39
32Literal
33ExprTuple38, 40
34ExprTuple39, 41
35Literal
36ExprTuple40, 41
37Variable
38Variable
39Variable
40Variable
41Operationoperator: 42
operand: 44
42Literal
43ExprTuple44
44Variable