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 ExprTuple, Lambda, P, Py, S, y, z
from proveit.logic import Equals, Forall, Implies, InSet, NotEquals
from proveit.numbers import Complex, Sum, frac, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y]
expr = ExprTuple(Lambda([P, S], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(Py, Complex), domain = S), Forall(instance_param_or_params = [z], instance_expr = Equals(frac(Sum(index_or_indices = sub_expr1, summand = Py, domain = S), z), Sum(index_or_indices = sub_expr1, summand = frac(Py, z), domain = S)), domain = Complex, condition = NotEquals(z, 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(\left(P, S\right) \mapsto \left(\left[\forall_{y \in S}~\left(P\left(y\right) \in \mathbb{C}\right)\right] \Rightarrow \left[\forall_{z \in \mathbb{C}~|~z \neq 0}~\left(\frac{\sum_{y \in S}~P\left(y\right)}{z} = \left[\sum_{y \in S}~\frac{P\left(y\right)}{z}\right]\right)\right]\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
2ExprTuple50, 52
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 9
operand: 11
7Operationoperator: 9
operand: 12
8ExprTuple11
9Literal
10ExprTuple12
11Lambdaparameter: 53
body: 13
12Lambdaparameter: 47
body: 15
13Conditionalvalue: 16
condition: 45
14ExprTuple47
15Conditionalvalue: 17
condition: 18
16Operationoperator: 48
operands: 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19ExprTuple46, 35
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27
24Operationoperator: 43
operands: 28
25Operationoperator: 37
operand: 34
26Operationoperator: 48
operands: 30
27Operationoperator: 31
operands: 32
28ExprTuple33, 47
29ExprTuple34
30ExprTuple47, 35
31Literal
32ExprTuple47, 36
33Operationoperator: 37
operand: 40
34Lambdaparameter: 53
body: 39
35Literal
36Literal
37Literal
38ExprTuple40
39Conditionalvalue: 41
condition: 45
40Lambdaparameter: 53
body: 42
41Operationoperator: 43
operands: 44
42Conditionalvalue: 46
condition: 45
43Literal
44ExprTuple46, 47
45Operationoperator: 48
operands: 49
46Operationoperator: 50
operand: 53
47Variable
48Literal
49ExprTuple53, 52
50Variable
51ExprTuple53
52Variable
53Variable