logo

Expression of type ExprTuple

from the theory of proveit.numbers.division

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, x, y
from proveit.logic import Forall, InSet
from proveit.numbers import LessEq, RealNonPos, RealPos, frac
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(a, Conditional(Forall(instance_param_or_params = [x, y], instance_expr = LessEq(frac(a, x), frac(a, y)), domain = RealPos, condition = LessEq(x, y)), InSet(a, RealNonPos))))
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(a \mapsto \left\{\forall_{x, y \in \mathbb{R}^+~|~x \leq y}~\left(\frac{a}{x} \leq \frac{a}{y}\right) \textrm{ if } a \in \mathbb{R}^{\le 0}\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: 30
body: 3
2ExprTuple30
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 26
operands: 8
6Literal
7ExprTuple9
8ExprTuple30, 10
9Lambdaparameters: 29
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 28
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20, 21
17Operationoperator: 23
operands: 22
18Operationoperator: 23
operands: 24
19Operationoperator: 26
operands: 25
20Operationoperator: 26
operands: 27
21Operationoperator: 28
operands: 29
22ExprTuple30, 32
23Literal
24ExprTuple30, 33
25ExprTuple32, 31
26Literal
27ExprTuple33, 31
28Literal
29ExprTuple32, 33
30Variable
31Literal
32Variable
33Variable