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, C, Conditional, ExprRange, IndexedVar, Lambda, 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 = Lambda(m, 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())
m \mapsto \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()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 35
body: 2
1ExprTuple35
2Conditionalvalue: 3
condition: 4
3Operationoperator: 12
operand: 7
4Operationoperator: 28
operands: 6
5ExprTuple7
6ExprTuple35, 8
7Lambdaparameters: 22
body: 9
8Literal
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 15
11Operationoperator: 26
operands: 14
12Literal
13ExprTuple15
14ExprTuple16, 17
15Lambdaparameter: 40
body: 19
16ExprRangelambda_map: 20
start_index: 34
end_index: 35
17Operationoperator: 21
operands: 22
18ExprTuple40
19Conditionalvalue: 40
condition: 23
20Lambdaparameter: 43
body: 24
21Literal
22ExprTuple25
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operands: 29
25ExprRangelambda_map: 30
start_index: 34
end_index: 35
26Literal
27ExprTuple31
28Literal
29ExprTuple39, 32
30Lambdaparameter: 43
body: 39
31ExprRangelambda_map: 33
start_index: 34
end_index: 35
32Literal
33Lambdaparameter: 43
body: 36
34Literal
35Variable
36Operationoperator: 37
operands: 38
37Literal
38ExprTuple39, 40
39IndexedVarvariable: 41
index: 43
40Variable
41Variable
42ExprTuple43
43Variable