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, w, x, y, z
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([x, y], Conditional(Forall(instance_param_or_params = [z, w], instance_expr = Equals(Mult(frac(x, z), frac(y, w)), frac(Mult(x, y), Mult(z, w))), domain = ComplexNonZero), And(InSet(x, Complex), InSet(y, 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(x, y\right) \mapsto \left\{\forall_{z, w \in \mathbb{C}^{\neq 0}}~\left(\left(\frac{x}{z} \cdot \frac{y}{w}\right) = \frac{x \cdot y}{z \cdot w}\right) \textrm{ if } x \in \mathbb{C} ,  y \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: 37
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 18
operands: 6
4Literal
5ExprTuple7
6ExprTuple8, 9
7Lambdaparameters: 39
body: 10
8Operationoperator: 27
operands: 11
9Operationoperator: 27
operands: 12
10Conditionalvalue: 13
condition: 14
11ExprTuple40, 15
12ExprTuple41, 15
13Operationoperator: 16
operands: 17
14Operationoperator: 18
operands: 19
15Literal
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22, 23
20Operationoperator: 38
operands: 24
21Operationoperator: 35
operands: 25
22Operationoperator: 27
operands: 26
23Operationoperator: 27
operands: 28
24ExprTuple29, 30
25ExprTuple31, 32
26ExprTuple42, 33
27Literal
28ExprTuple43, 33
29Operationoperator: 35
operands: 34
30Operationoperator: 35
operands: 36
31Operationoperator: 38
operands: 37
32Operationoperator: 38
operands: 39
33Literal
34ExprTuple40, 42
35Literal
36ExprTuple41, 43
37ExprTuple40, 41
38Literal
39ExprTuple42, 43
40Variable
41Variable
42Variable
43Variable