logo

Expression of type ExprTuple

from the theory of proveit.numbers.summation

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, Function, Lambda, R, S, a, f, fa, fx, g, gy, n, x, y
from proveit.logic import Card, Equals, Forall, Implies, InSet, SetOfAll
from proveit.numbers import Complex, Natural, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y]
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [f, g, R, S], instance_expr = Implies(Forall(instance_param_or_params = [a], instance_expr = InSet(fa, Complex), domain = R), Equals(Sum(index_or_indices = [x], summand = fx, domain = R), Sum(index_or_indices = sub_expr1, summand = Function(f, [gy]), domain = S))), conditions = [Equals(SetOfAll(instance_param_or_params = sub_expr1, instance_element = gy, domain = S), R), Equals(Card(S), n), Equals(Card(R), n)]), InSet(n, Natural))))
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(n \mapsto \left\{\forall_{f, g, R, S~|~\left\{g\left(y\right)\right\}_{y \in S} = R, |S| = n, |R| = n}~\left(\left[\forall_{a \in R}~\left(f\left(a\right) \in \mathbb{C}\right)\right] \Rightarrow \left(\left[\sum_{x \in R}~f\left(x\right)\right] = \left[\sum_{y \in S}~f\left(g\left(y\right)\right)\right]\right)\right) \textrm{ if } n \in \mathbb{N}\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
1Lambdaparameter: 36
body: 3
2ExprTuple36
3Conditionalvalue: 4
condition: 5
4Operationoperator: 23
operand: 8
5Operationoperator: 67
operands: 7
6ExprTuple8
7ExprTuple36, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple65, 74, 71, 73
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20, 21, 22
18Operationoperator: 23
operand: 30
19Operationoperator: 28
operands: 25
20Operationoperator: 28
operands: 26
21Operationoperator: 28
operands: 27
22Operationoperator: 28
operands: 29
23Literal
24ExprTuple30
25ExprTuple31, 32
26ExprTuple33, 71
27ExprTuple34, 36
28Literal
29ExprTuple35, 36
30Lambdaparameter: 69
body: 37
31Operationoperator: 39
operand: 48
32Operationoperator: 39
operand: 49
33Operationoperator: 41
operand: 50
34Operationoperator: 44
operand: 73
35Operationoperator: 44
operand: 71
36Variable
37Conditionalvalue: 46
condition: 47
38ExprTuple48
39Literal
40ExprTuple49
41Literal
42ExprTuple50
43ExprTuple73
44Literal
45ExprTuple71
46Operationoperator: 67
operands: 51
47Operationoperator: 67
operands: 52
48Lambdaparameter: 70
body: 53
49Lambdaparameter: 76
body: 54
50Lambdaparameter: 76
body: 55
51ExprTuple56, 57
52ExprTuple69, 71
53Conditionalvalue: 58
condition: 59
54Conditionalvalue: 60
condition: 61
55Conditionalvalue: 72
condition: 61
56Operationoperator: 65
operand: 69
57Literal
58Operationoperator: 65
operand: 70
59Operationoperator: 67
operands: 64
60Operationoperator: 65
operand: 72
61Operationoperator: 67
operands: 68
62ExprTuple69
63ExprTuple70
64ExprTuple70, 71
65Variable
66ExprTuple72
67Literal
68ExprTuple76, 73
69Variable
70Variable
71Variable
72Operationoperator: 74
operand: 76
73Variable
74Variable
75ExprTuple76
76Variable