logo

Expression of type Forall

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 w, x, y, z
from proveit.logic import Equals, Forall, NotEquals
from proveit.numbers import Complex, frac, subtract
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [w, x, y, z], instance_expr = Equals(frac(subtract(w, x), subtract(y, z)), frac(subtract(x, w), subtract(z, y))), domain = Complex, condition = 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())
\forall_{w, x, y, z \in \mathbb{C}~|~y \neq z}~\left(\frac{w - x}{y - z} = \frac{x - w}{z - y}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple50, 48, 51, 49
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16, 17, 18
12Operationoperator: 20
operands: 19
13Operationoperator: 20
operands: 21
14Operationoperator: 25
operands: 22
15Operationoperator: 25
operands: 23
16Operationoperator: 25
operands: 24
17Operationoperator: 25
operands: 26
18Operationoperator: 27
operands: 28
19ExprTuple29, 30
20Literal
21ExprTuple31, 32
22ExprTuple50, 33
23ExprTuple48, 33
24ExprTuple51, 33
25Literal
26ExprTuple49, 33
27Literal
28ExprTuple51, 49
29Operationoperator: 37
operands: 34
30Operationoperator: 37
operands: 35
31Operationoperator: 37
operands: 36
32Operationoperator: 37
operands: 38
33Literal
34ExprTuple50, 39
35ExprTuple51, 40
36ExprTuple48, 41
37Literal
38ExprTuple49, 42
39Operationoperator: 46
operand: 48
40Operationoperator: 46
operand: 49
41Operationoperator: 46
operand: 50
42Operationoperator: 46
operand: 51
43ExprTuple48
44ExprTuple49
45ExprTuple50
46Literal
47ExprTuple51
48Variable
49Variable
50Variable
51Variable