logo

Expression of type Lambda

from the theory of proveit.physics.quantum.algebra

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 Conditional, Lambda, M, m, n
from proveit.linear_algebra import LinMap, MatrixSpace
from proveit.logic import And, CartExp, Forall, InSet
from proveit.numbers import Complex, NaturalPos
from proveit.physics.quantum import Qmult
In [2]:
# build up the expression from sub-expressions
expr = Lambda([m, n], Conditional(Forall(instance_param_or_params = [M], instance_expr = InSet(Qmult(M), LinMap(CartExp(Complex, n), CartExp(Complex, m))), domain = MatrixSpace(field = Complex, rows = m, columns = n)), And(InSet(m, NaturalPos), InSet(n, NaturalPos))))
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(m, n\right) \mapsto \left\{\forall_{M \in \mathbb{C}^{m \times n}}~\left(\left[M\right] \in \mathcal{L}\left(\mathbb{C}^{n}, \mathbb{C}^{m}\right)\right) \textrm{ if } m \in \mathbb{N}^+ ,  n \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple38, 36
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple10, 11
9Lambdaparameter: 30
body: 12
10Operationoperator: 19
operands: 13
11Operationoperator: 19
operands: 14
12Conditionalvalue: 15
condition: 16
13ExprTuple38, 17
14ExprTuple36, 17
15Operationoperator: 19
operands: 18
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple30, 23
21Operationoperator: 24
operand: 30
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operands: 29
24Literal
25ExprTuple30
26Literal
27ExprTuple31, 32
28Literal
29NamedExprsfield: 37
rows: 38
columns: 36
30Variable
31Operationoperator: 34
operands: 33
32Operationoperator: 34
operands: 35
33ExprTuple37, 36
34Literal
35ExprTuple37, 38
36Variable
37Literal
38Variable