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