logo

Expression of type ExprTuple

from the theory of proveit.numbers.modular

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, L, Lambda, b, i, j
from proveit.core_expr_types import a_1_to_i, c_1_to_j
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Mod, ModAbs, Natural, Real, RealPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j], Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j], instance_expr = Forall(instance_param_or_params = [L], instance_expr = Equals(ModAbs(Add(a_1_to_i, Mod(b, L), c_1_to_j), L), ModAbs(Add(a_1_to_i, b, c_1_to_j), L)).with_wrapping_at(2), domain = RealPos), domain = Real), And(InSet(i, Natural), InSet(j, 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(\left(i, j\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j} \in \mathbb{R}}~\left[\forall_{L \in \mathbb{R}^+}~\left(\begin{array}{c} \begin{array}{l} \left|a_{1} +  a_{2} +  \ldots +  a_{i} + \left(b ~\textup{mod}~ L\right)+ c_{1} +  c_{2} +  \ldots +  c_{j}\right|_{\textup{mod}\thinspace L} =  \\ \left|a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right|_{\textup{mod}\thinspace L} \end{array} \end{array}\right)\right] \textrm{ if } i \in \mathbb{N} ,  j \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
1Lambdaparameters: 2
body: 3
2ExprTuple58, 61
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 8
5Operationoperator: 19
operands: 7
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 51
body: 11
9Operationoperator: 38
operands: 12
10Operationoperator: 38
operands: 13
11Conditionalvalue: 14
condition: 15
12ExprTuple58, 16
13ExprTuple61, 16
14Operationoperator: 17
operand: 21
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple21
19Literal
20ExprTuple22, 23, 24
21Lambdaparameter: 63
body: 26
22ExprRangelambda_map: 27
start_index: 60
end_index: 58
23Operationoperator: 38
operands: 28
24ExprRangelambda_map: 29
start_index: 60
end_index: 61
25ExprTuple63
26Conditionalvalue: 30
condition: 31
27Lambdaparameter: 69
body: 32
28ExprTuple62, 43
29Lambdaparameter: 69
body: 33
30Operationoperator: 34
operands: 35
31Operationoperator: 38
operands: 36
32Operationoperator: 38
operands: 37
33Operationoperator: 38
operands: 39
34Literal
35ExprTuple40, 41
36ExprTuple63, 42
37ExprTuple64, 43
38Literal
39ExprTuple65, 43
40Operationoperator: 45
operands: 44
41Operationoperator: 45
operands: 46
42Literal
43Literal
44ExprTuple47, 63
45Literal
46ExprTuple48, 63
47Operationoperator: 50
operands: 49
48Operationoperator: 50
operands: 51
49ExprTuple53, 52, 54
50Literal
51ExprTuple53, 62, 54
52Operationoperator: 55
operands: 56
53ExprRangelambda_map: 57
start_index: 60
end_index: 58
54ExprRangelambda_map: 59
start_index: 60
end_index: 61
55Literal
56ExprTuple62, 63
57Lambdaparameter: 69
body: 64
58Variable
59Lambdaparameter: 69
body: 65
60Literal
61Variable
62Variable
63Variable
64IndexedVarvariable: 66
index: 69
65IndexedVarvariable: 67
index: 69
66Variable
67Variable
68ExprTuple69
69Variable