logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.inclusion

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, Conditional, ExprTuple, Lambda, P, Px, Py, x, y
from proveit.logic import Forall, Implies, superset_eq
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([A, B, P], Conditional(Implies(Forall(instance_param_or_params = [x], instance_expr = Px, domain = A), Forall(instance_param_or_params = [y], instance_expr = Py, domain = B)), superset_eq(A, B))))
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(A, B, P\right) \mapsto \left\{\left[\forall_{x \in A}~P\left(x\right)\right] \Rightarrow \left[\forall_{y \in B}~P\left(y\right)\right] \textrm{ if } A \supseteq B\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
2ExprTuple30, 32, 25
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple32, 30
10Operationoperator: 13
operand: 15
11Operationoperator: 13
operand: 16
12ExprTuple15
13Literal
14ExprTuple16
15Lambdaparameter: 29
body: 17
16Lambdaparameter: 31
body: 18
17Conditionalvalue: 19
condition: 20
18Conditionalvalue: 21
condition: 22
19Operationoperator: 25
operand: 29
20Operationoperator: 27
operands: 24
21Operationoperator: 25
operand: 31
22Operationoperator: 27
operands: 28
23ExprTuple29
24ExprTuple29, 30
25Variable
26ExprTuple31
27Literal
28ExprTuple31, 32
29Variable
30Variable
31Variable
32Variable