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 Lambda, m, n, x, y
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, zero
In [2]:
# build up the expression from sub-expressions
expr = Lambda([m, n], Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = 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))), domain = Complex, condition = 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(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(\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)\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
1ExprTuple52, 55
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple48, 49, 42, 50
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple16, 17, 18, 19, 20
14Operationoperator: 35
operands: 21
15Operationoperator: 44
operand: 30
16ExprRangelambda_map: 23
start_index: 54
end_index: 52
17Operationoperator: 38
operands: 24
18Operationoperator: 38
operands: 25
19ExprRangelambda_map: 26
start_index: 54
end_index: 55
20Operationoperator: 27
operands: 28
21ExprTuple29, 42
22ExprTuple30
23Lambdaparameter: 61
body: 31
24ExprTuple49, 43
25ExprTuple42, 43
26Lambdaparameter: 61
body: 32
27Literal
28ExprTuple42, 33
29Operationoperator: 46
operands: 34
30Operationoperator: 35
operands: 36
31Operationoperator: 38
operands: 37
32Operationoperator: 38
operands: 39
33Literal
34ExprTuple48, 40, 50
35Literal
36ExprTuple41, 42
37ExprTuple56, 43
38Literal
39ExprTuple57, 43
40Operationoperator: 44
operand: 49
41Operationoperator: 46
operands: 47
42Variable
43Literal
44Literal
45ExprTuple49
46Literal
47ExprTuple48, 49, 50
48ExprRangelambda_map: 51
start_index: 54
end_index: 52
49Variable
50ExprRangelambda_map: 53
start_index: 54
end_index: 55
51Lambdaparameter: 61
body: 56
52Variable
53Lambdaparameter: 61
body: 57
54Literal
55Variable
56IndexedVarvariable: 58
index: 61
57IndexedVarvariable: 59
index: 61
58Variable
59Variable
60ExprTuple61
61Variable