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, Lambda, P, PofA
from proveit.logic import And, Boolean, Equals, FALSE, Forall, Implies, PofFalse, PofTrue, TRUE
In [2]:
# build up the expression from sub-expressions
expr = Lambda(P, Implies(And(Equals(PofTrue, FALSE), Equals(PofFalse, TRUE)), Equals(Forall(instance_param_or_params = [A], instance_expr = PofA, domain = Boolean), FALSE)))
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())
P \mapsto \left(\left(\left(P\left(\top\right) = \bot\right) \land \left(P\left(\bot\right) = \top\right)\right) \Rightarrow \left(\left[\forall_{A \in \mathbb{B}}~P\left(A\right)\right] = \bot\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: 28
body: 2
1ExprTuple28
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operands: 8
6Operationoperator: 14
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple12, 25
10Operationoperator: 14
operands: 13
11Operationoperator: 14
operands: 15
12Operationoperator: 16
operand: 20
13ExprTuple18, 25
14Literal
15ExprTuple19, 24
16Literal
17ExprTuple20
18Operationoperator: 28
operand: 24
19Operationoperator: 28
operand: 25
20Lambdaparameter: 32
body: 23
21ExprTuple24
22ExprTuple25
23Conditionalvalue: 26
condition: 27
24Literal
25Literal
26Operationoperator: 28
operand: 32
27Operationoperator: 30
operands: 31
28Variable
29ExprTuple32
30Literal
31ExprTuple32, 33
32Variable
33Literal