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, Conditional, Lambda
from proveit.logic import And, Boolean, Implies, InSet, Not
In [2]:
# build up the expression from sub-expressions
expr = Lambda(A, Conditional(C, And(InSet(A, Boolean), 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())
A \mapsto \left\{C \textrm{ if } A \in \mathbb{B} ,  A \Rightarrow C ,  (\lnot A) \Rightarrow 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: 18
body: 1
1Conditionalvalue: 15
condition: 2
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6, 7
5Operationoperator: 8
operands: 9
6Operationoperator: 11
operands: 10
7Operationoperator: 11
operands: 12
8Literal
9ExprTuple18, 13
10ExprTuple18, 15
11Literal
12ExprTuple14, 15
13Literal
14Operationoperator: 16
operand: 18
15Variable
16Literal
17ExprTuple18
18Variable