logo

Expression of type Lambda

from the theory of proveit.numbers.division

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, ExprRange, IndexedVar, Lambda, Variable, m, n, w, x, y, z
from proveit.core_expr_types import w_1_to_m, z_1_to_n
from proveit.logic import And, Equals, InSet, NotEquals
from proveit.numbers import Complex, Mult, Neg, frac, one, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = Lambda([w_1_to_m, x, y, z_1_to_n], Conditional(Equals(frac(Mult(w_1_to_m, Neg(x), z_1_to_n), y), Neg(frac(Mult(w_1_to_m, x, z_1_to_n), y))), And(ExprRange(sub_expr1, InSet(IndexedVar(w, sub_expr1), Complex), one, m), InSet(x, Complex), InSet(y, Complex), ExprRange(sub_expr1, InSet(IndexedVar(z, sub_expr1), Complex), one, n), NotEquals(y, zero))))
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_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n}\right) \mapsto \left\{\frac{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \left(-x\right)\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}{y} = \left(-\frac{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot x\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}{y}\right) \textrm{ if } \left(w_{1} \in \mathbb{C}\right) ,  \left(w_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(w_{m} \in \mathbb{C}\right) ,  x \in \mathbb{C} ,  y \in \mathbb{C}, \left(z_{1} \in \mathbb{C}\right) ,  \left(z_{2} \in \mathbb{C}\right) ,  \ldots ,  \left(z_{n} \in \mathbb{C}\right) ,  y \neq 0\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
1ExprTuple43, 44, 37, 45
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12, 13, 14, 15
9Operationoperator: 30
operands: 16
10Operationoperator: 39
operand: 25
11ExprRangelambda_map: 18
start_index: 49
end_index: 47
12Operationoperator: 33
operands: 19
13Operationoperator: 33
operands: 20
14ExprRangelambda_map: 21
start_index: 49
end_index: 50
15Operationoperator: 22
operands: 23
16ExprTuple24, 37
17ExprTuple25
18Lambdaparameter: 56
body: 26
19ExprTuple44, 38
20ExprTuple37, 38
21Lambdaparameter: 56
body: 27
22Literal
23ExprTuple37, 28
24Operationoperator: 41
operands: 29
25Operationoperator: 30
operands: 31
26Operationoperator: 33
operands: 32
27Operationoperator: 33
operands: 34
28Literal
29ExprTuple43, 35, 45
30Literal
31ExprTuple36, 37
32ExprTuple51, 38
33Literal
34ExprTuple52, 38
35Operationoperator: 39
operand: 44
36Operationoperator: 41
operands: 42
37Variable
38Literal
39Literal
40ExprTuple44
41Literal
42ExprTuple43, 44, 45
43ExprRangelambda_map: 46
start_index: 49
end_index: 47
44Variable
45ExprRangelambda_map: 48
start_index: 49
end_index: 50
46Lambdaparameter: 56
body: 51
47Variable
48Lambdaparameter: 56
body: 52
49Literal
50Variable
51IndexedVarvariable: 53
index: 56
52IndexedVarvariable: 54
index: 56
53Variable
54Variable
55ExprTuple56
56Variable