logo

Expression of type ExprTuple

from the theory of proveit.numbers.ordering

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, S, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Forall, InSet, SubsetEq
from proveit.numbers import Max, NaturalPos, Real
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(S, Conditional(Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = InSet(Max(a_1_to_n), S), domain = S), domain = NaturalPos), SubsetEq(S, 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(S \mapsto \left\{\forall_{n \in \mathbb{N}^+}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in S}~\left({\rm Max}\left(a_{1}, a_{2}, \ldots, a_{n}\right) \in S\right)\right] \textrm{ if } S \subseteq \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: 39
body: 3
2ExprTuple39
3Conditionalvalue: 4
condition: 5
4Operationoperator: 15
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple39, 10
9Lambdaparameter: 35
body: 12
10Literal
11ExprTuple35
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 18
14Operationoperator: 36
operands: 17
15Literal
16ExprTuple18
17ExprTuple35, 19
18Lambdaparameters: 29
body: 20
19Literal
20Conditionalvalue: 21
condition: 22
21Operationoperator: 36
operands: 23
22Operationoperator: 24
operands: 25
23ExprTuple26, 39
24Literal
25ExprTuple27
26Operationoperator: 28
operands: 29
27ExprRangelambda_map: 30
start_index: 34
end_index: 35
28Literal
29ExprTuple31
30Lambdaparameter: 42
body: 32
31ExprRangelambda_map: 33
start_index: 34
end_index: 35
32Operationoperator: 36
operands: 37
33Lambdaparameter: 42
body: 38
34Literal
35Variable
36Literal
37ExprTuple38, 39
38IndexedVarvariable: 40
index: 42
39Variable
40Variable
41ExprTuple42
42Variable