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, Lambda, N, a, b, c, x
from proveit.logic import Bijections, Forall, InSet
from proveit.numbers import Add, Integer, Interval, Mod, NaturalPos, one, subtract, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(N, Conditional(Forall(instance_param_or_params = [a, b, c], instance_expr = InSet(Lambda(x, Mod(Add(c, x), N)), Bijections(Interval(a, b), Interval(zero, subtract(N, one)))), domain = Integer), InSet(N, NaturalPos))))
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_{a, b, c \in \mathbb{Z}}~\left(\left[x \mapsto \left(\left(c + x\right) ~\textup{mod}~ N\right)\right] \in \left[\{a~\ldotp \ldotp~b\} \xrightarrow[\text{onto}]{\text{1-to-1}} \{0~\ldotp \ldotp~N - 1\}\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: 49
body: 3
2ExprTuple49
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 29
operands: 8
6Literal
7ExprTuple9
8ExprTuple49, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple41, 42, 45
12Conditionalvalue: 13
condition: 14
13Operationoperator: 29
operands: 15
14Operationoperator: 16
operands: 17
15ExprTuple18, 19
16Literal
17ExprTuple20, 21, 22
18Lambdaparameter: 46
body: 24
19Operationoperator: 25
operands: 26
20Operationoperator: 29
operands: 27
21Operationoperator: 29
operands: 28
22Operationoperator: 29
operands: 30
23ExprTuple46
24Operationoperator: 31
operands: 32
25Literal
26ExprTuple33, 34
27ExprTuple41, 35
28ExprTuple42, 35
29Literal
30ExprTuple45, 35
31Literal
32ExprTuple36, 49
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36Operationoperator: 47
operands: 40
37ExprTuple41, 42
38Literal
39ExprTuple43, 44
40ExprTuple45, 46
41Variable
42Variable
43Literal
44Operationoperator: 47
operands: 48
45Variable
46Variable
47Literal
48ExprTuple49, 50
49Variable
50Operationoperator: 51
operand: 53
51Literal
52ExprTuple53
53Literal