logo
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
from proveit.logic import Implies, SubsetEq
from proveit.logic.booleans.quantification import general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Implies(general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy).with_wrapping_at(2), SubsetEq(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\{\begin{array}{c} \begin{array}{l} \left[\exists_{x_{1}, x_{2}, \ldots, x_{n} \in A~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right] \Rightarrow  \\ \left[\exists_{y_{1}, y_{2}, \ldots, y_{n} \in B~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right] \end{array} \end{array} \textrm{ if } A \subseteq B\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
operands: 4
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7, 8
5Literal
6ExprTuple44, 46
7Operationoperator: 10
operand: 12
8Operationoperator: 10
operand: 13
9ExprTuple12
10Literal
11ExprTuple13
12Lambdaparameters: 29
body: 14
13Lambdaparameters: 32
body: 15
14Conditionalvalue: 16
condition: 17
15Conditionalvalue: 18
condition: 19
16Operationoperator: 21
operands: 29
17Operationoperator: 22
operands: 20
18Operationoperator: 21
operands: 32
19Operationoperator: 22
operands: 23
20ExprTuple24, 25
21Variable
22Literal
23ExprTuple26, 27
24ExprRangelambda_map: 28
start_index: 42
end_index: 43
25Operationoperator: 31
operands: 29
26ExprRangelambda_map: 30
start_index: 42
end_index: 43
27Operationoperator: 31
operands: 32
28Lambdaparameter: 51
body: 33
29ExprTuple34
30Lambdaparameter: 51
body: 35
31Variable
32ExprTuple36
33Operationoperator: 39
operands: 37
34ExprRangelambda_map: 38
start_index: 42
end_index: 43
35Operationoperator: 39
operands: 40
36ExprRangelambda_map: 41
start_index: 42
end_index: 43
37ExprTuple45, 44
38Lambdaparameter: 51
body: 45
39Literal
40ExprTuple47, 46
41Lambdaparameter: 51
body: 47
42Literal
43Variable
44Variable
45IndexedVarvariable: 48
index: 51
46Variable
47IndexedVarvariable: 49
index: 51
48Variable
49Variable
50ExprTuple51
51Variable