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
from proveit.numbers import Complex, ComplexNonZero, Mult, frac
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [x, y], instance_expr = 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), domain = 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())
\forall_{x, y \in \mathbb{C}}~\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)\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: 6
operand: 2
1ExprTuple2
2Lambdaparameters: 39
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 41
body: 12
10Operationoperator: 29
operands: 13
11Operationoperator: 29
operands: 14
12Conditionalvalue: 15
condition: 16
13ExprTuple42, 17
14ExprTuple43, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 40
operands: 26
23Operationoperator: 37
operands: 27
24Operationoperator: 29
operands: 28
25Operationoperator: 29
operands: 30
26ExprTuple31, 32
27ExprTuple33, 34
28ExprTuple44, 35
29Literal
30ExprTuple45, 35
31Operationoperator: 37
operands: 36
32Operationoperator: 37
operands: 38
33Operationoperator: 40
operands: 39
34Operationoperator: 40
operands: 41
35Literal
36ExprTuple42, 44
37Literal
38ExprTuple43, 45
39ExprTuple42, 43
40Literal
41ExprTuple44, 45
42Variable
43Variable
44Variable
45Variable