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, Lambda, m, n, x, y
from proveit.core_expr_types import w_1_to_m, z_1_to_n
from proveit.logic import And, Equals, Forall, InSet, NotEquals
from proveit.numbers import Complex, Mult, NaturalPos, frac, zero
In [2]:
# build up the expression from sub-expressions
expr = Lambda([m, n], Conditional(Forall(instance_param_or_params = [w_1_to_m, x, y, z_1_to_n], instance_expr = Equals(Mult(w_1_to_m, frac(x, y), z_1_to_n), frac(Mult(w_1_to_m, x, z_1_to_n), y)), domain = Complex, condition = NotEquals(y, zero)), 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_{w_{1}, w_{2}, \ldots, w_{m}, x, y, z_{1}, z_{2}, \ldots, z_{n} \in \mathbb{C}~|~y \neq 0}~\left(\left(w_{1} \cdot  w_{2} \cdot  \ldots \cdot  w_{m} \cdot \frac{x}{y}\cdot z_{1} \cdot  z_{2} \cdot  \ldots \cdot  z_{n}\right) = \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 } 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
1ExprTuple55, 58
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 11
body: 12
9Operationoperator: 47
operands: 13
10Operationoperator: 47
operands: 14
11ExprTuple50, 51, 49, 52
12Conditionalvalue: 15
condition: 16
13ExprTuple55, 17
14ExprTuple58, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26, 27, 28
22Operationoperator: 44
operands: 29
23Operationoperator: 42
operands: 30
24ExprRangelambda_map: 31
start_index: 57
end_index: 55
25Operationoperator: 47
operands: 32
26Operationoperator: 47
operands: 33
27ExprRangelambda_map: 34
start_index: 57
end_index: 58
28Operationoperator: 35
operands: 36
29ExprTuple50, 37, 52
30ExprTuple38, 49
31Lambdaparameter: 64
body: 39
32ExprTuple51, 53
33ExprTuple49, 53
34Lambdaparameter: 64
body: 40
35Literal
36ExprTuple49, 41
37Operationoperator: 42
operands: 43
38Operationoperator: 44
operands: 45
39Operationoperator: 47
operands: 46
40Operationoperator: 47
operands: 48
41Literal
42Literal
43ExprTuple51, 49
44Literal
45ExprTuple50, 51, 52
46ExprTuple59, 53
47Literal
48ExprTuple60, 53
49Variable
50ExprRangelambda_map: 54
start_index: 57
end_index: 55
51Variable
52ExprRangelambda_map: 56
start_index: 57
end_index: 58
53Literal
54Lambdaparameter: 64
body: 59
55Variable
56Lambdaparameter: 64
body: 60
57Literal
58Variable
59IndexedVarvariable: 61
index: 64
60IndexedVarvariable: 62
index: 64
61Variable
62Variable
63ExprTuple64
64Variable