logo

Expression of type ExprTuple

from the theory of proveit.numbers.number_sets.real_numbers

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, x
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import IntervalCC, LessEq, Real
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a, b], Conditional(Forall(instance_param_or_params = [x], instance_expr = Equals(InSet(x, IntervalCC(a, b)), And(InSet(x, Real), And(LessEq(a, x), LessEq(x, b)).with_total_ordering_style()))), And(InSet(a, Real), InSet(b, 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(\left(a, b\right) \mapsto \left\{\forall_{x}~\left(\left(x \in \left[a,b\right]\right) = \left(\left(x \in \mathbb{R}\right) \land \left(a \leq x \leq b\right)\right)\right) \textrm{ if } a \in \mathbb{R} ,  b \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
1Lambdaparameters: 25
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 28
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameter: 37
body: 12
9Operationoperator: 26
operands: 13
10Operationoperator: 26
operands: 14
11ExprTuple37
12Operationoperator: 15
operands: 16
13ExprTuple36, 30
14ExprTuple38, 30
15Literal
16ExprTuple17, 18
17Operationoperator: 26
operands: 19
18Operationoperator: 28
operands: 20
19ExprTuple37, 21
20ExprTuple22, 23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operands: 29
24Literal
25ExprTuple36, 38
26Literal
27ExprTuple37, 30
28Literal
29ExprTuple31, 32
30Literal
31Operationoperator: 34
operands: 33
32Operationoperator: 34
operands: 35
33ExprTuple36, 37
34Literal
35ExprTuple37, 38
36Variable
37Variable
38Variable