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(Mult(a, b), c), frac(d, Mult(b, e))), Mult(frac(a, c), 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 \cdot b}{c} \cdot \frac{d}{b \cdot e}\right) = \left(\frac{a}{c} \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
1ExprTuple50, 46
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
11ExprTuple51, 45, 52
12Conditionalvalue: 15
condition: 16
13ExprTuple50, 17
14ExprTuple46, 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
29ExprTuple51, 37
30ExprTuple45, 37
31Literal
32ExprTuple52, 37
33Operationoperator: 41
operands: 38
34Operationoperator: 41
operands: 39
35Operationoperator: 41
operands: 40
36Operationoperator: 41
operands: 42
37Literal
38ExprTuple43, 45
39ExprTuple46, 44
40ExprTuple50, 45
41Literal
42ExprTuple46, 52
43Operationoperator: 48
operands: 47
44Operationoperator: 48
operands: 49
45Variable
46Variable
47ExprTuple50, 51
48Literal
49ExprTuple51, 52
50Variable
51Variable
52Variable