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, a, b, c
from proveit.logic import And, InSet, NotEquals
from proveit.numbers import Abs, Add, LessEq, Mod, ModAbs, Real, subtract, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a, b, c], Conditional(LessEq(ModAbs(subtract(Mod(Add(b, a), c), b), c), Abs(a)), And(InSet(a, Real), InSet(b, Real), InSet(c, Real), NotEquals(c, zero)))))
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(\left(a, b, c\right) \mapsto \left\{\left|\left(\left(b + a\right) ~\textup{mod}~ c\right) - b\right|_{\textup{mod}\thinspace c} \leq \left|a\right| \textrm{ if } a \in \mathbb{R} ,  b \in \mathbb{R} ,  c \in \mathbb{R} ,  c \neq 0\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
1Lambdaparameters: 2
body: 3
2ExprTuple41, 40, 37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13, 14, 15
10Operationoperator: 16
operands: 17
11Operationoperator: 18
operand: 41
12Operationoperator: 22
operands: 20
13Operationoperator: 22
operands: 21
14Operationoperator: 22
operands: 23
15Operationoperator: 24
operands: 25
16Literal
17ExprTuple26, 37
18Literal
19ExprTuple41
20ExprTuple41, 27
21ExprTuple40, 27
22Literal
23ExprTuple37, 27
24Literal
25ExprTuple37, 28
26Operationoperator: 38
operands: 29
27Literal
28Literal
29ExprTuple30, 31
30Operationoperator: 32
operands: 33
31Operationoperator: 34
operand: 40
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple40
36Operationoperator: 38
operands: 39
37Variable
38Literal
39ExprTuple40, 41
40Variable
41Variable