logo

Expression of type ExprTuple

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, ExprTuple, Lambda, w, x, y, z
from proveit.logic import And, Equals, InSet, NotEquals
from proveit.numbers import Complex, frac, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([w, x, y, z], Conditional(Equals(frac(subtract(w, x), subtract(y, z)), frac(subtract(x, w), subtract(z, y))), And(InSet(w, Complex), InSet(x, Complex), InSet(y, Complex), InSet(z, Complex), NotEquals(y, z)))))
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(\left(w, x, y, z\right) \mapsto \left\{\frac{w - x}{y - z} = \frac{x - w}{z - y} \textrm{ if } w \in \mathbb{C} ,  x \in \mathbb{C} ,  y \in \mathbb{C} ,  z \in \mathbb{C} ,  y \neq z\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple48, 46, 49, 47
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13, 14, 15, 16
10Operationoperator: 18
operands: 17
11Operationoperator: 18
operands: 19
12Operationoperator: 23
operands: 20
13Operationoperator: 23
operands: 21
14Operationoperator: 23
operands: 22
15Operationoperator: 23
operands: 24
16Operationoperator: 25
operands: 26
17ExprTuple27, 28
18Literal
19ExprTuple29, 30
20ExprTuple48, 31
21ExprTuple46, 31
22ExprTuple49, 31
23Literal
24ExprTuple47, 31
25Literal
26ExprTuple49, 47
27Operationoperator: 35
operands: 32
28Operationoperator: 35
operands: 33
29Operationoperator: 35
operands: 34
30Operationoperator: 35
operands: 36
31Literal
32ExprTuple48, 37
33ExprTuple49, 38
34ExprTuple46, 39
35Literal
36ExprTuple47, 40
37Operationoperator: 44
operand: 46
38Operationoperator: 44
operand: 47
39Operationoperator: 44
operand: 48
40Operationoperator: 44
operand: 49
41ExprTuple46
42ExprTuple47
43ExprTuple48
44Literal
45ExprTuple49
46Variable
47Variable
48Variable
49Variable