logo

Expression of type Conditional

from the theory of proveit.logic.booleans.disjunction

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 A, C, Conditional, ExprRange, IndexedVar, Variable, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import Boolean, Forall, Implies, InSet, Or
from proveit.numbers import Natural, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = Conditional(Forall(instance_param_or_params = [A_1_to_m], instance_expr = Forall(instance_param_or_params = [C], instance_expr = C, condition = ExprRange(sub_expr1, Implies(IndexedVar(A, sub_expr1), C), one, m)), domain = Boolean, condition = Or(A_1_to_m)), InSet(m, 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_{1}, A_{2}, \ldots, A_{m} \in \mathbb{B}~|~A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m}}~\left[\forall_{C~|~\left(A_{1} \Rightarrow C\right), \left(A_{2} \Rightarrow C\right), \ldots, \left(A_{m} \Rightarrow C\right)}~C\right] \textrm{ if } m \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: 10
operand: 5
2Operationoperator: 26
operands: 4
3ExprTuple5
4ExprTuple33, 6
5Lambdaparameters: 20
body: 7
6Literal
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 24
operands: 12
10Literal
11ExprTuple13
12ExprTuple14, 15
13Lambdaparameter: 38
body: 17
14ExprRangelambda_map: 18
start_index: 32
end_index: 33
15Operationoperator: 19
operands: 20
16ExprTuple38
17Conditionalvalue: 38
condition: 21
18Lambdaparameter: 41
body: 22
19Literal
20ExprTuple23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23ExprRangelambda_map: 28
start_index: 32
end_index: 33
24Literal
25ExprTuple29
26Literal
27ExprTuple37, 30
28Lambdaparameter: 41
body: 37
29ExprRangelambda_map: 31
start_index: 32
end_index: 33
30Literal
31Lambdaparameter: 41
body: 34
32Literal
33Variable
34Operationoperator: 35
operands: 36
35Literal
36ExprTuple37, 38
37IndexedVarvariable: 39
index: 41
38Variable
39Variable
40ExprTuple41
41Variable