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, x
from proveit.logic import Card, Equals, Forall, InSet, SetOfAll
from proveit.numbers import 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], instance_expr = Equals(SetOfAll(instance_param_or_params = [x], instance_element = Mod(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 \in \mathbb{Z}~|~|\{a~\ldotp \ldotp~b\}| \geq N}~\left(\left\{x ~\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: 50
body: 3
2ExprTuple50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 46
operands: 8
6Literal
7ExprTuple9
8ExprTuple50, 10
9Lambdaparameters: 55
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20, 21, 22
18Operationoperator: 23
operand: 30
19Operationoperator: 54
operands: 25
20Operationoperator: 46
operands: 26
21Operationoperator: 46
operands: 27
22Operationoperator: 28
operands: 29
23Literal
24ExprTuple30
25ExprTuple31, 32
26ExprTuple56, 33
27ExprTuple57, 33
28Literal
29ExprTuple50, 34
30Lambdaparameter: 51
body: 36
31Literal
32Operationoperator: 37
operands: 38
33Literal
34Operationoperator: 39
operand: 52
35ExprTuple51
36Conditionalvalue: 41
condition: 42
37Literal
38ExprTuple50, 43
39Literal
40ExprTuple52
41Operationoperator: 44
operands: 45
42Operationoperator: 46
operands: 47
43Operationoperator: 48
operand: 53
44Literal
45ExprTuple51, 50
46Literal
47ExprTuple51, 52
48Literal
49ExprTuple53
50Variable
51Variable
52Operationoperator: 54
operands: 55
53Literal
54Literal
55ExprTuple56, 57
56Variable
57Variable