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, 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(Mod(Add(a_1_to_i, Mod(b, L), c_1_to_j), L), Mod(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(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + \left(b ~\textup{mod}~ L\right)+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) ~\textup{mod}~ L\right) =  \\ \left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}\right) ~\textup{mod}~ L\right) \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
2ExprTuple57, 60
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 8
5Operationoperator: 19
operands: 7
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 50
body: 11
9Operationoperator: 38
operands: 12
10Operationoperator: 38
operands: 13
11Conditionalvalue: 14
condition: 15
12ExprTuple57, 16
13ExprTuple60, 16
14Operationoperator: 17
operand: 21
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple21
19Literal
20ExprTuple22, 23, 24
21Lambdaparameter: 62
body: 26
22ExprRangelambda_map: 27
start_index: 59
end_index: 57
23Operationoperator: 38
operands: 28
24ExprRangelambda_map: 29
start_index: 59
end_index: 60
25ExprTuple62
26Conditionalvalue: 30
condition: 31
27Lambdaparameter: 68
body: 32
28ExprTuple61, 43
29Lambdaparameter: 68
body: 33
30Operationoperator: 34
operands: 35
31Operationoperator: 38
operands: 36
32Operationoperator: 38
operands: 37
33Operationoperator: 38
operands: 39
34Literal
35ExprTuple40, 41
36ExprTuple62, 42
37ExprTuple63, 43
38Literal
39ExprTuple64, 43
40Operationoperator: 54
operands: 44
41Operationoperator: 54
operands: 45
42Literal
43Literal
44ExprTuple46, 62
45ExprTuple47, 62
46Operationoperator: 49
operands: 48
47Operationoperator: 49
operands: 50
48ExprTuple52, 51, 53
49Literal
50ExprTuple52, 61, 53
51Operationoperator: 54
operands: 55
52ExprRangelambda_map: 56
start_index: 59
end_index: 57
53ExprRangelambda_map: 58
start_index: 59
end_index: 60
54Literal
55ExprTuple61, 62
56Lambdaparameter: 68
body: 63
57Variable
58Lambdaparameter: 68
body: 64
59Literal
60Variable
61Variable
62Variable
63IndexedVarvariable: 65
index: 68
64IndexedVarvariable: 66
index: 68
65Variable
66Variable
67ExprTuple68
68Variable