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, B, Conditional, ExprRange, IndexedVar, Variable, m
from proveit.core_expr_types import A_1_to_m, B_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, B_1_to_m], instance_expr = Or(B_1_to_m), domain = Boolean, conditions = [Or(A_1_to_m), ExprRange(sub_expr1, Implies(IndexedVar(A, sub_expr1), IndexedVar(B, sub_expr1)), one, 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}, B_{1}, B_{2}, \ldots, B_{m} \in \mathbb{B}~|~A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m},\left(A_{1} \Rightarrow B_{1}\right), \left(A_{2} \Rightarrow B_{2}\right), \ldots, \left(A_{m} \Rightarrow B_{m}\right)}~\left(B_{1} \lor  B_{2} \lor  \ldots \lor  B_{m}\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: 3
operand: 6
2Operationoperator: 31
operands: 5
3Literal
4ExprTuple6
5ExprTuple35, 7
6Lambdaparameters: 8
body: 9
7Literal
8ExprTuple28, 15
9Conditionalvalue: 10
condition: 11
10Operationoperator: 23
operands: 12
11Operationoperator: 13
operands: 14
12ExprTuple15
13Literal
14ExprTuple16, 17, 18, 19
15ExprRangelambda_map: 20
start_index: 34
end_index: 35
16ExprRangelambda_map: 21
start_index: 34
end_index: 35
17ExprRangelambda_map: 22
start_index: 34
end_index: 35
18Operationoperator: 23
operands: 24
19ExprRangelambda_map: 25
start_index: 34
end_index: 35
20Lambdaparameter: 44
body: 40
21Lambdaparameter: 44
body: 26
22Lambdaparameter: 44
body: 27
23Literal
24ExprTuple28
25Lambdaparameter: 44
body: 29
26Operationoperator: 31
operands: 30
27Operationoperator: 31
operands: 32
28ExprRangelambda_map: 33
start_index: 34
end_index: 35
29Operationoperator: 36
operands: 37
30ExprTuple39, 38
31Literal
32ExprTuple40, 38
33Lambdaparameter: 44
body: 39
34Literal
35Variable
36Literal
37ExprTuple39, 40
38Literal
39IndexedVarvariable: 41
index: 44
40IndexedVarvariable: 42
index: 44
41Variable
42Variable
43ExprTuple44
44Variable