logo

Expression of type ExprTuple

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, ExprTuple, 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 = ExprTuple(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())
\left(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)\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 29
body: 3
2ExprTuple29
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 8
operands: 9
7Operationoperator: 15
operands: 10
8Literal
9ExprTuple11, 12
10ExprTuple13, 26
11Operationoperator: 15
operands: 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operand: 21
14ExprTuple19, 26
15Literal
16ExprTuple20, 25
17Literal
18ExprTuple21
19Operationoperator: 29
operand: 25
20Operationoperator: 29
operand: 26
21Lambdaparameter: 33
body: 24
22ExprTuple25
23ExprTuple26
24Conditionalvalue: 27
condition: 28
25Literal
26Literal
27Operationoperator: 29
operand: 33
28Operationoperator: 31
operands: 32
29Variable
30ExprTuple33
31Literal
32ExprTuple33, 34
33Variable
34Literal