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, L, Lambda, S, c, x
from proveit.logic import Card, Equals, InSet, SetOfAll
from proveit.numbers import Add, Mod, Real
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda(c, Conditional(Equals(Card(SetOfAll(instance_param_or_params = sub_expr1, instance_element = Mod(Add(c, x), L), domain = S)), Card(SetOfAll(instance_param_or_params = sub_expr1, instance_element = Mod(x, L), domain = S))), InSet(c, Real))))
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(c \mapsto \left\{|\left\{\left(c + x\right) ~\textup{mod}~ L\right\}_{x \in S}| = |\left\{x ~\textup{mod}~ L\right\}_{x \in S}| \textrm{ if } c \in \mathbb{R}\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: 38
body: 3
2ExprTuple38
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 31
operands: 8
6Literal
7ExprTuple9, 10
8ExprTuple38, 11
9Operationoperator: 13
operand: 15
10Operationoperator: 13
operand: 16
11Literal
12ExprTuple15
13Literal
14ExprTuple16
15Operationoperator: 18
operand: 20
16Operationoperator: 18
operand: 21
17ExprTuple20
18Literal
19ExprTuple21
20Lambdaparameter: 39
body: 22
21Lambdaparameter: 39
body: 24
22Conditionalvalue: 25
condition: 27
23ExprTuple39
24Conditionalvalue: 26
condition: 27
25Operationoperator: 29
operands: 28
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operands: 32
28ExprTuple33, 34
29Literal
30ExprTuple39, 34
31Literal
32ExprTuple39, 35
33Operationoperator: 36
operands: 37
34Variable
35Variable
36Literal
37ExprTuple38, 39
38Variable
39Variable