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, c, x
from proveit.logic import And, Forall, InSet
from proveit.numbers import IntervalCO, Mult, Real
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a, b, c], Conditional(Forall(instance_param_or_params = [x], instance_expr = InSet(Mult(c, x), IntervalCO(Mult(c, a), Mult(c, b))), domain = IntervalCO(a, b)), And(InSet(a, Real), InSet(b, Real), 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(\left(a, b, c\right) \mapsto \left\{\forall_{x \in \left[a,b\right)}~\left(\left(c \cdot x\right) \in \left[c \cdot a,c \cdot b\right)\right) \textrm{ if } a \in \mathbb{R} ,  b \in \mathbb{R} ,  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
1Lambdaparameters: 2
body: 3
2ExprTuple38, 40, 39
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple11, 12, 13
10Lambdaparameter: 32
body: 15
11Operationoperator: 23
operands: 16
12Operationoperator: 23
operands: 17
13Operationoperator: 23
operands: 18
14ExprTuple32
15Conditionalvalue: 19
condition: 20
16ExprTuple38, 21
17ExprTuple40, 21
18ExprTuple39, 21
19Operationoperator: 23
operands: 22
20Operationoperator: 23
operands: 24
21Literal
22ExprTuple25, 26
23Literal
24ExprTuple32, 27
25Operationoperator: 36
operands: 28
26Operationoperator: 30
operands: 29
27Operationoperator: 30
operands: 31
28ExprTuple39, 32
29ExprTuple33, 34
30Literal
31ExprTuple38, 40
32Variable
33Operationoperator: 36
operands: 35
34Operationoperator: 36
operands: 37
35ExprTuple39, 38
36Literal
37ExprTuple39, 40
38Variable
39Variable
40Variable