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, Conditional, ExprTuple, Lambda, P, PofA, Q, QofA
from proveit.logic import And, Boolean, Forall, QimplPofFalse, QimplPofTrue
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([P, Q], Conditional(Forall(instance_param_or_params = [A], instance_expr = PofA, domain = Boolean, condition = QofA), And(QimplPofTrue, QimplPofFalse))))
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(\left(P, Q\right) \mapsto \left\{\forall_{A \in \mathbb{B}~|~Q\left(A\right)}~P\left(A\right) \textrm{ if } Q\left(\top\right) \Rightarrow P\left(\top\right) ,  Q\left(\bot\right) \Rightarrow P\left(\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
1Lambdaparameters: 2
body: 3
2ExprTuple25, 33
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 22
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameter: 36
body: 12
10Operationoperator: 14
operands: 13
11Operationoperator: 14
operands: 15
12Conditionalvalue: 16
condition: 17
13ExprTuple18, 19
14Literal
15ExprTuple20, 21
16Operationoperator: 25
operand: 36
17Operationoperator: 22
operands: 23
18Operationoperator: 33
operand: 29
19Operationoperator: 25
operand: 29
20Operationoperator: 33
operand: 30
21Operationoperator: 25
operand: 30
22Literal
23ExprTuple27, 28
24ExprTuple29
25Variable
26ExprTuple30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operand: 36
29Literal
30Literal
31Literal
32ExprTuple36, 35
33Variable
34ExprTuple36
35Literal
36Variable