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 Card, Equals, Forall, InSet, SetOfAll
from proveit.numbers import Add, Integer, Interval, Mod, NaturalPos, greater_eq
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Interval(a, b)
expr = ExprTuple(Lambda(N, Conditional(Forall(instance_param_or_params = [a, b, c], instance_expr = Equals(Card(SetOfAll(instance_param_or_params = [x], instance_element = Mod(Add(x, c), N), domain = sub_expr1)), N), domain = Integer, condition = greater_eq(Card(sub_expr1), N)), 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}~|~|\{a~\ldotp \ldotp~b\}| \geq N}~\left(|\left\{\left(x + c\right) ~\textup{mod}~ N\right\}_{x \in \{a~\ldotp \ldotp~b\}}| = N\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: 44
operands: 8
6Literal
7ExprTuple9
8ExprTuple47, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple55, 56, 54
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 47
17Literal
18ExprTuple20, 21, 22, 23
19Operationoperator: 35
operand: 30
20Operationoperator: 44
operands: 25
21Operationoperator: 44
operands: 26
22Operationoperator: 44
operands: 27
23Operationoperator: 28
operands: 29
24ExprTuple30
25ExprTuple55, 31
26ExprTuple56, 31
27ExprTuple54, 31
28Literal
29ExprTuple47, 32
30Operationoperator: 33
operand: 37
31Literal
32Operationoperator: 35
operand: 48
33Literal
34ExprTuple37
35Literal
36ExprTuple48
37Lambdaparameter: 53
body: 39
38ExprTuple53
39Conditionalvalue: 40
condition: 41
40Operationoperator: 42
operands: 43
41Operationoperator: 44
operands: 45
42Literal
43ExprTuple46, 47
44Literal
45ExprTuple53, 48
46Operationoperator: 49
operands: 50
47Variable
48Operationoperator: 51
operands: 52
49Literal
50ExprTuple53, 54
51Literal
52ExprTuple55, 56
53Variable
54Variable
55Variable
56Variable