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, one, subtract, zero
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(SetOfAll(instance_param_or_params = [x], instance_element = Mod(Add(c, x), N), domain = sub_expr1), Interval(zero, subtract(N, one))), 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(c + x\right) ~\textup{mod}~ N\right\}_{x \in \{a~\ldotp \ldotp~b\}} = \{0~\ldotp \ldotp~N - 1\}\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: 53
body: 3
2ExprTuple53
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 48
operands: 8
6Literal
7ExprTuple9
8ExprTuple53, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple62, 63, 60
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22, 23, 24
19Operationoperator: 25
operand: 33
20Operationoperator: 58
operands: 27
21Operationoperator: 48
operands: 28
22Operationoperator: 48
operands: 29
23Operationoperator: 48
operands: 30
24Operationoperator: 31
operands: 32
25Literal
26ExprTuple33
27ExprTuple34, 35
28ExprTuple62, 36
29ExprTuple63, 36
30ExprTuple60, 36
31Literal
32ExprTuple53, 37
33Lambdaparameter: 61
body: 39
34Literal
35Operationoperator: 56
operands: 40
36Literal
37Operationoperator: 41
operand: 54
38ExprTuple61
39Conditionalvalue: 43
condition: 44
40ExprTuple53, 45
41Literal
42ExprTuple54
43Operationoperator: 46
operands: 47
44Operationoperator: 48
operands: 49
45Operationoperator: 50
operand: 55
46Literal
47ExprTuple52, 53
48Literal
49ExprTuple61, 54
50Literal
51ExprTuple55
52Operationoperator: 56
operands: 57
53Variable
54Operationoperator: 58
operands: 59
55Literal
56Literal
57ExprTuple60, 61
58Literal
59ExprTuple62, 63
60Variable
61Variable
62Variable
63Variable