logo

Expression of type Conditional

from the theory of proveit.numbers.numerals.decimals

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, a, n
from proveit.core_expr_types import b_1_to_n
from proveit.logic import Forall, InSet
from proveit.numbers import DecimalSequence, Digits, Natural, NaturalPos, greater, zero
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a, b_1_to_n], instance_expr = InSet(DecimalSequence(a, b_1_to_n), NaturalPos), domain = Digits, condition = greater(a, zero)), InSet(n, Natural))
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_{a, b_{1}, b_{2}, \ldots, b_{n} \in \mathbb{N}^{\leq 9}~|~a > 0}~\left(\texttt{\#}(a ~ b_{1}, b_{2}, \ldots, b_{n}) \in \mathbb{N}^+\right) \textrm{ if } n \in \mathbb{N}\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: 3
operand: 6
2Operationoperator: 32
operands: 5
3Literal
4ExprTuple6
5ExprTuple31, 7
6Lambdaparameters: 20
body: 8
7Literal
8Conditionalvalue: 9
condition: 10
9Operationoperator: 32
operands: 11
10Operationoperator: 12
operands: 13
11ExprTuple14, 15
12Literal
13ExprTuple16, 17, 18
14Operationoperator: 19
operands: 20
15Literal
16Operationoperator: 32
operands: 21
17ExprRangelambda_map: 22
start_index: 30
end_index: 31
18Operationoperator: 23
operands: 24
19Literal
20ExprTuple28, 25
21ExprTuple28, 35
22Lambdaparameter: 38
body: 26
23Literal
24ExprTuple27, 28
25ExprRangelambda_map: 29
start_index: 30
end_index: 31
26Operationoperator: 32
operands: 33
27Literal
28Variable
29Lambdaparameter: 38
body: 34
30Literal
31Variable
32Literal
33ExprTuple34, 35
34IndexedVarvariable: 36
index: 38
35Literal
36Variable
37ExprTuple38
38Variable