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 And, Card, Equals, Forall, Implies, InSet, SetOfAll
from proveit.numbers import Complex, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y]
expr = ExprTuple(Lambda([f, g, R, S], Conditional(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))), And(Equals(SetOfAll(instance_param_or_params = sub_expr1, instance_element = gy, domain = S), R), Equals(Card(S), n), Equals(Card(R), n)))))
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(f, g, R, S\right) \mapsto \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) \textrm{ if } \left\{g\left(y\right)\right\}_{y \in S} = R ,  |S| = n ,  |R| = 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
1Lambdaparameters: 2
body: 3
2ExprTuple57, 66, 63, 65
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13, 14
10Operationoperator: 15
operand: 22
11Operationoperator: 20
operands: 17
12Operationoperator: 20
operands: 18
13Operationoperator: 20
operands: 19
14Operationoperator: 20
operands: 21
15Literal
16ExprTuple22
17ExprTuple23, 24
18ExprTuple25, 63
19ExprTuple26, 28
20Literal
21ExprTuple27, 28
22Lambdaparameter: 61
body: 29
23Operationoperator: 31
operand: 40
24Operationoperator: 31
operand: 41
25Operationoperator: 33
operand: 42
26Operationoperator: 36
operand: 65
27Operationoperator: 36
operand: 63
28Variable
29Conditionalvalue: 38
condition: 39
30ExprTuple40
31Literal
32ExprTuple41
33Literal
34ExprTuple42
35ExprTuple65
36Literal
37ExprTuple63
38Operationoperator: 59
operands: 43
39Operationoperator: 59
operands: 44
40Lambdaparameter: 62
body: 45
41Lambdaparameter: 68
body: 46
42Lambdaparameter: 68
body: 47
43ExprTuple48, 49
44ExprTuple61, 63
45Conditionalvalue: 50
condition: 51
46Conditionalvalue: 52
condition: 53
47Conditionalvalue: 64
condition: 53
48Operationoperator: 57
operand: 61
49Literal
50Operationoperator: 57
operand: 62
51Operationoperator: 59
operands: 56
52Operationoperator: 57
operand: 64
53Operationoperator: 59
operands: 60
54ExprTuple61
55ExprTuple62
56ExprTuple62, 63
57Variable
58ExprTuple64
59Literal
60ExprTuple68, 65
61Variable
62Variable
63Variable
64Operationoperator: 66
operand: 68
65Variable
66Variable
67ExprTuple68
68Variable