logo

Expression of type Lambda

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, Lambda, 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 = Lambda(m, 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())
m \mapsto \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()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 37
body: 2
1ExprTuple37
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 33
operands: 7
5Literal
6ExprTuple8
7ExprTuple37, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple30, 17
11Conditionalvalue: 12
condition: 13
12Operationoperator: 25
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17
15Literal
16ExprTuple18, 19, 20, 21
17ExprRangelambda_map: 22
start_index: 36
end_index: 37
18ExprRangelambda_map: 23
start_index: 36
end_index: 37
19ExprRangelambda_map: 24
start_index: 36
end_index: 37
20Operationoperator: 25
operands: 26
21ExprRangelambda_map: 27
start_index: 36
end_index: 37
22Lambdaparameter: 46
body: 42
23Lambdaparameter: 46
body: 28
24Lambdaparameter: 46
body: 29
25Literal
26ExprTuple30
27Lambdaparameter: 46
body: 31
28Operationoperator: 33
operands: 32
29Operationoperator: 33
operands: 34
30ExprRangelambda_map: 35
start_index: 36
end_index: 37
31Operationoperator: 38
operands: 39
32ExprTuple41, 40
33Literal
34ExprTuple42, 40
35Lambdaparameter: 46
body: 41
36Literal
37Variable
38Literal
39ExprTuple41, 42
40Literal
41IndexedVarvariable: 43
index: 46
42IndexedVarvariable: 44
index: 46
43Variable
44Variable
45ExprTuple46
46Variable