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, B, C, Conditional, D, Lambda
from proveit.logic import And, Boolean, Implies, InSet, Not, Or
In [2]:
# build up the expression from sub-expressions
expr = Lambda([A, B, C, D], Conditional(Or(Not(A), Not(B)), And(InSet(A, Boolean), InSet(B, Boolean), InSet(C, Boolean), InSet(D, Boolean), Or(Not(C), Not(D)), Implies(A, C), Implies(B, D))))
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())
\left(A, B, C, D\right) \mapsto \left\{(\lnot A) \lor (\lnot B) \textrm{ if } A \in \mathbb{B} ,  B \in \mathbb{B} ,  C \in \mathbb{B} ,  D \in \mathbb{B} ,  (\lnot C) \lor (\lnot D) ,  A \Rightarrow C ,  B \Rightarrow D\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple32, 33, 37, 38
2Conditionalvalue: 3
condition: 4
3Operationoperator: 24
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10, 11, 12, 13, 14, 15, 16
8Operationoperator: 35
operand: 32
9Operationoperator: 35
operand: 33
10Operationoperator: 22
operands: 19
11Operationoperator: 22
operands: 20
12Operationoperator: 22
operands: 21
13Operationoperator: 22
operands: 23
14Operationoperator: 24
operands: 25
15Operationoperator: 27
operands: 26
16Operationoperator: 27
operands: 28
17ExprTuple32
18ExprTuple33
19ExprTuple32, 29
20ExprTuple33, 29
21ExprTuple37, 29
22Literal
23ExprTuple38, 29
24Literal
25ExprTuple30, 31
26ExprTuple32, 37
27Literal
28ExprTuple33, 38
29Literal
30Operationoperator: 35
operand: 37
31Operationoperator: 35
operand: 38
32Variable
33Variable
34ExprTuple37
35Literal
36ExprTuple38
37Variable
38Variable