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 Less, RealNeg, RealPos, frac, greater
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(a, Conditional(Forall(instance_param_or_params = [x, y], instance_expr = greater(frac(a, x), frac(a, y)), domain = RealNeg, condition = Less(x, y)), InSet(a, RealPos))))
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 < y}~\left(\frac{a}{x} > \frac{a}{y}\right) \textrm{ if } a \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
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, 33
23Literal
24ExprTuple30, 32
25ExprTuple32, 31
26Literal
27ExprTuple33, 31
28Literal
29ExprTuple32, 33
30Variable
31Literal
32Variable
33Variable