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.logic import And, Implies
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = Lambda(C, Conditional(C, And(ExprRange(sub_expr1, Implies(IndexedVar(A, sub_expr1), C), one, 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())
C \mapsto \left\{C \textrm{ if } \left(A_{1} \Rightarrow C\right) \land  \left(A_{2} \Rightarrow C\right) \land  \ldots \land  \left(A_{m} \Rightarrow C\right)\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 14
body: 2
1ExprTuple14
2Conditionalvalue: 14
condition: 3
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6
6ExprRangelambda_map: 7
start_index: 8
end_index: 9
7Lambdaparameter: 17
body: 10
8Literal
9Variable
10Operationoperator: 11
operands: 12
11Literal
12ExprTuple13, 14
13IndexedVarvariable: 15
index: 17
14Variable
15Variable
16ExprTuple17
17Variable