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 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(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(x ~\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: 47
body: 3
2ExprTuple47
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 29
operands: 8
6Literal
7ExprTuple9
8ExprTuple47, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple41, 42, 35
12Conditionalvalue: 13
condition: 14
13Operationoperator: 29
operands: 15
14Operationoperator: 16
operands: 17
15ExprTuple18, 19
16Literal
17ExprTuple20, 21, 22
18Lambdaparameter: 37
body: 24
19Operationoperator: 25
operands: 26
20Operationoperator: 29
operands: 27
21Operationoperator: 29
operands: 28
22Operationoperator: 29
operands: 30
23ExprTuple37
24Operationoperator: 31
operands: 32
25Literal
26ExprTuple33, 34
27ExprTuple41, 36
28ExprTuple42, 36
29Literal
30ExprTuple35, 36
31Literal
32ExprTuple37, 47
33Operationoperator: 39
operands: 38
34Operationoperator: 39
operands: 40
35Variable
36Literal
37Variable
38ExprTuple41, 42
39Literal
40ExprTuple43, 44
41Variable
42Variable
43Literal
44Operationoperator: 45
operands: 46
45Literal
46ExprTuple47, 48
47Variable
48Operationoperator: 49
operand: 51
49Literal
50ExprTuple51
51Literal