logo

Expression of type Implies

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 Px, d, x, y, z
from proveit.logic import Equals, Forall, Implies, InSet, NotEquals
from proveit.numbers import Complex, Interval, Sum, frac, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
sub_expr2 = Interval(y, z)
expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(Px, Complex), domain = sub_expr2), Forall(instance_param_or_params = [d], instance_expr = Equals(frac(Sum(index_or_indices = sub_expr1, summand = Px, domain = sub_expr2), d), Sum(index_or_indices = sub_expr1, summand = frac(Px, d), domain = sub_expr2)), domain = Complex, condition = NotEquals(d, zero)))
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[\forall_{x \in \{y~\ldotp \ldotp~z\}}~\left(P\left(x\right) \in \mathbb{C}\right)\right] \Rightarrow \left[\forall_{d \in \mathbb{C}~|~d \neq 0}~\left(\frac{\sum_{x = y}^{z} P\left(x\right)}{d} = \left(\sum_{x = y}^{z} \frac{P\left(x\right)}{d}\right)\right)\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 6
operand: 8
4Operationoperator: 6
operand: 9
5ExprTuple8
6Literal
7ExprTuple9
8Lambdaparameter: 50
body: 10
9Lambdaparameter: 44
body: 12
10Conditionalvalue: 13
condition: 42
11ExprTuple44
12Conditionalvalue: 14
condition: 15
13Operationoperator: 45
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple43, 32
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 40
operands: 25
22Operationoperator: 34
operand: 31
23Operationoperator: 45
operands: 27
24Operationoperator: 28
operands: 29
25ExprTuple30, 44
26ExprTuple31
27ExprTuple44, 32
28Literal
29ExprTuple44, 33
30Operationoperator: 34
operand: 37
31Lambdaparameter: 50
body: 36
32Literal
33Literal
34Literal
35ExprTuple37
36Conditionalvalue: 38
condition: 42
37Lambdaparameter: 50
body: 39
38Operationoperator: 40
operands: 41
39Conditionalvalue: 43
condition: 42
40Literal
41ExprTuple43, 44
42Operationoperator: 45
operands: 46
43Operationoperator: 47
operand: 50
44Variable
45Literal
46ExprTuple50, 49
47Variable
48ExprTuple50
49Operationoperator: 51
operands: 52
50Variable
51Literal
52ExprTuple53, 54
53Variable
54Variable