logo

Expression of type Lambda

from the theory of proveit.logic.booleans

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, Lambda
from proveit.logic import Boolean, Forall, Implies, Not
In [2]:
# build up the expression from sub-expressions
expr = Lambda(C, Forall(instance_param_or_params = [A], instance_expr = C, domain = Boolean, conditions = [Implies(A, C), Implies(Not(A), C)]))
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[\forall_{A \in \mathbb{B}~|~A \Rightarrow C, (\lnot A) \Rightarrow C}~C\right]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 20
body: 2
1ExprTuple20
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameter: 23
body: 6
6Conditionalvalue: 20
condition: 7
7Operationoperator: 8
operands: 9
8Literal
9ExprTuple10, 11, 12
10Operationoperator: 13
operands: 14
11Operationoperator: 16
operands: 15
12Operationoperator: 16
operands: 17
13Literal
14ExprTuple23, 18
15ExprTuple23, 20
16Literal
17ExprTuple19, 20
18Literal
19Operationoperator: 21
operand: 23
20Variable
21Literal
22ExprTuple23
23Variable