logo

Expression of type Forall

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, ExprRange, IndexedVar, Variable, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import Boolean, Forall, Implies, Or
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = 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))
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())
\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]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 6
operand: 2
1ExprTuple2
2Lambdaparameters: 16
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameter: 34
body: 13
10ExprRangelambda_map: 14
start_index: 28
end_index: 29
11Operationoperator: 15
operands: 16
12ExprTuple34
13Conditionalvalue: 34
condition: 17
14Lambdaparameter: 37
body: 18
15Literal
16ExprTuple19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19ExprRangelambda_map: 24
start_index: 28
end_index: 29
20Literal
21ExprTuple25
22Literal
23ExprTuple33, 26
24Lambdaparameter: 37
body: 33
25ExprRangelambda_map: 27
start_index: 28
end_index: 29
26Literal
27Lambdaparameter: 37
body: 30
28Literal
29Variable
30Operationoperator: 31
operands: 32
31Literal
32ExprTuple33, 34
33IndexedVarvariable: 35
index: 37
34Variable
35Variable
36ExprTuple37
37Variable