logo

Expression of type Conditional

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, S, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Forall, InSet, SubsetEq
from proveit.numbers import Min, Natural, Real
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = InSet(Min(a_1_to_n), S), domain = S), domain = Natural), SubsetEq(S, 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\{\forall_{n \in \mathbb{N}}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in S}~\left({\rm Min}\left(a_{1}, a_{2}, \ldots, a_{n}\right) \in S\right)\right] \textrm{ if } S \subseteq \mathbb{R}\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 12
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple36, 7
6Lambdaparameter: 32
body: 9
7Literal
8ExprTuple32
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 15
11Operationoperator: 33
operands: 14
12Literal
13ExprTuple15
14ExprTuple32, 16
15Lambdaparameters: 26
body: 17
16Literal
17Conditionalvalue: 18
condition: 19
18Operationoperator: 33
operands: 20
19Operationoperator: 21
operands: 22
20ExprTuple23, 36
21Literal
22ExprTuple24
23Operationoperator: 25
operands: 26
24ExprRangelambda_map: 27
start_index: 31
end_index: 32
25Literal
26ExprTuple28
27Lambdaparameter: 39
body: 29
28ExprRangelambda_map: 30
start_index: 31
end_index: 32
29Operationoperator: 33
operands: 34
30Lambdaparameter: 39
body: 35
31Literal
32Variable
33Literal
34ExprTuple35, 36
35IndexedVarvariable: 37
index: 39
36Variable
37Variable
38ExprTuple39
39Variable