logo

Expression of type Conditional

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, PofA, QofA
from proveit.logic import And, Boolean, Forall, QimplPofFalse, QimplPofTrue
In [2]:
# build up the expression from sub-expressions
expr = 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\{\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..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 19
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameter: 33
body: 9
7Operationoperator: 11
operands: 10
8Operationoperator: 11
operands: 12
9Conditionalvalue: 13
condition: 14
10ExprTuple15, 16
11Literal
12ExprTuple17, 18
13Operationoperator: 22
operand: 33
14Operationoperator: 19
operands: 20
15Operationoperator: 30
operand: 26
16Operationoperator: 22
operand: 26
17Operationoperator: 30
operand: 27
18Operationoperator: 22
operand: 27
19Literal
20ExprTuple24, 25
21ExprTuple26
22Variable
23ExprTuple27
24Operationoperator: 28
operands: 29
25Operationoperator: 30
operand: 33
26Literal
27Literal
28Literal
29ExprTuple33, 32
30Variable
31ExprTuple33
32Literal
33Variable