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 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 Equals, Forall, 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([m, n], Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = Equals(frac(x, Mult(w_1_to_m, Neg(y), z_1_to_n)), Neg(frac(x, Mult(w_1_to_m, y, z_1_to_n)))), domain = Complex, conditions = [NotEquals(y, zero), ExprRange(sub_expr1, NotEquals(IndexedVar(w, sub_expr1), zero), one, m), ExprRange(sub_expr1, NotEquals(IndexedVar(z, sub_expr1), zero), one, n)]))
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_{w_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n} \in \mathbb{C}~|~y \neq 0,\left(w_{1} \neq 0\right), \left(w_{2} \neq 0\right), \ldots, \left(w_{m} \neq 0\right),\left(z_{1} \neq 0\right), \left(z_{2} \neq 0\right), \ldots, \left(z_{n} \neq 0\right)}~\left(\frac{x}{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \left(-y\right)\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}} = \left(-\frac{x}{w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot y\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}}\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
0Lambdaparameters: 1
body: 2
1ExprTuple60, 63
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple56, 48, 57, 58
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple16, 17, 18, 19, 20, 21, 22
14Operationoperator: 39
operands: 23
15Operationoperator: 52
operand: 33
16ExprRangelambda_map: 25
start_index: 62
end_index: 60
17Operationoperator: 42
operands: 26
18Operationoperator: 42
operands: 27
19ExprRangelambda_map: 28
start_index: 62
end_index: 63
20Operationoperator: 45
operands: 29
21ExprRangelambda_map: 30
start_index: 62
end_index: 60
22ExprRangelambda_map: 31
start_index: 62
end_index: 63
23ExprTuple48, 32
24ExprTuple33
25Lambdaparameter: 69
body: 34
26ExprTuple48, 50
27ExprTuple57, 50
28Lambdaparameter: 69
body: 35
29ExprTuple57, 51
30Lambdaparameter: 69
body: 36
31Lambdaparameter: 69
body: 37
32Operationoperator: 54
operands: 38
33Operationoperator: 39
operands: 40
34Operationoperator: 42
operands: 41
35Operationoperator: 42
operands: 43
36Operationoperator: 45
operands: 44
37Operationoperator: 45
operands: 46
38ExprTuple56, 47, 58
39Literal
40ExprTuple48, 49
41ExprTuple64, 50
42Literal
43ExprTuple65, 50
44ExprTuple64, 51
45Literal
46ExprTuple65, 51
47Operationoperator: 52
operand: 57
48Variable
49Operationoperator: 54
operands: 55
50Literal
51Literal
52Literal
53ExprTuple57
54Literal
55ExprTuple56, 57, 58
56ExprRangelambda_map: 59
start_index: 62
end_index: 60
57Variable
58ExprRangelambda_map: 61
start_index: 62
end_index: 63
59Lambdaparameter: 69
body: 64
60Variable
61Lambdaparameter: 69
body: 65
62Literal
63Variable
64IndexedVarvariable: 66
index: 69
65IndexedVarvariable: 67
index: 69
66Variable
67Variable
68ExprTuple69
69Variable