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, Forall, InSet, SetOfAll, SubsetEq
from proveit.numbers import Add, Mod, Real
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda(L, Conditional(Forall(instance_param_or_params = [S], instance_expr = Forall(instance_param_or_params = [c], instance_expr = Equals(Card(SetOfAll(instance_param_or_params = sub_expr1, instance_element = Mod(Add(x, c), L), domain = S)), Card(SetOfAll(instance_param_or_params = sub_expr1, instance_element = Mod(x, L), domain = S))), domain = Real), condition = SubsetEq(S, Real)), InSet(L, 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(L \mapsto \left\{\forall_{S~|~S \subseteq \mathbb{R}}~\left[\forall_{c \in \mathbb{R}}~\left(|\left\{\left(x + c\right) ~\textup{mod}~ L\right\}_{x \in S}| = |\left\{x ~\textup{mod}~ L\right\}_{x \in S}|\right)\right] \textrm{ if } L \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: 50
body: 3
2ExprTuple50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 13
operand: 8
5Operationoperator: 47
operands: 7
6ExprTuple8
7ExprTuple50, 27
8Lambdaparameter: 51
body: 10
9ExprTuple51
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 17
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17
15Literal
16ExprTuple51, 27
17Lambdaparameter: 55
body: 19
18ExprTuple55
19Conditionalvalue: 20
condition: 21
20Operationoperator: 22
operands: 23
21Operationoperator: 47
operands: 24
22Literal
23ExprTuple25, 26
24ExprTuple55, 27
25Operationoperator: 29
operand: 31
26Operationoperator: 29
operand: 32
27Literal
28ExprTuple31
29Literal
30ExprTuple32
31Operationoperator: 34
operand: 36
32Operationoperator: 34
operand: 37
33ExprTuple36
34Literal
35ExprTuple37
36Lambdaparameter: 54
body: 38
37Lambdaparameter: 54
body: 40
38Conditionalvalue: 41
condition: 43
39ExprTuple54
40Conditionalvalue: 42
condition: 43
41Operationoperator: 45
operands: 44
42Operationoperator: 45
operands: 46
43Operationoperator: 47
operands: 48
44ExprTuple49, 50
45Literal
46ExprTuple54, 50
47Literal
48ExprTuple54, 51
49Operationoperator: 52
operands: 53
50Variable
51Variable
52Literal
53ExprTuple54, 55
54Variable
55Variable