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, a, b, c, d, e
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Complex, ComplexNonZero, Mult, frac
In [2]:
# build up the expression from sub-expressions
expr = Lambda([a, d], Conditional(Forall(instance_param_or_params = [b, c, e], instance_expr = Equals(Mult(frac(a, Mult(b, c)), frac(Mult(c, d), e)), Mult(frac(a, b), frac(d, e))), domain = ComplexNonZero), And(InSet(a, Complex), InSet(d, Complex))))
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(a, d\right) \mapsto \left\{\forall_{b, c, e \in \mathbb{C}^{\neq 0}}~\left(\left(\frac{a}{b \cdot c} \cdot \frac{c \cdot d}{e}\right) = \left(\frac{a}{b} \cdot \frac{d}{e}\right)\right) \textrm{ if } a \in \mathbb{C} ,  d \in \mathbb{C}\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
1ExprTuple45, 52
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 11
body: 12
9Operationoperator: 31
operands: 13
10Operationoperator: 31
operands: 14
11ExprTuple50, 51, 46
12Conditionalvalue: 15
condition: 16
13ExprTuple45, 17
14ExprTuple52, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22Operationoperator: 48
operands: 27
23Operationoperator: 48
operands: 28
24Operationoperator: 31
operands: 29
25Operationoperator: 31
operands: 30
26Operationoperator: 31
operands: 32
27ExprTuple33, 34
28ExprTuple35, 36
29ExprTuple50, 37
30ExprTuple51, 37
31Literal
32ExprTuple46, 37
33Operationoperator: 41
operands: 38
34Operationoperator: 41
operands: 39
35Operationoperator: 41
operands: 40
36Operationoperator: 41
operands: 42
37Literal
38ExprTuple45, 43
39ExprTuple44, 46
40ExprTuple45, 50
41Literal
42ExprTuple52, 46
43Operationoperator: 48
operands: 47
44Operationoperator: 48
operands: 49
45Variable
46Variable
47ExprTuple50, 51
48Literal
49ExprTuple51, 52
50Variable
51Variable
52Variable