logo

Expression of type ExprTuple

from the theory of proveit.core_expr_types.lambda_maps

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 Conditional, ExprTuple, Lambda
from proveit.core_expr_types import Q__a_1_to_i, Q__b_1_to_i, Q__c_1_to_i, a_1_to_i, b_1_to_i, c_1_to_i, f__a_1_to_i, f__b_1_to_i, g__a_1_to_i, g__c_1_to_i
from proveit.logic import Equals, Forall
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Forall(instance_param_or_params = [a_1_to_i], instance_expr = Equals(f__a_1_to_i, g__a_1_to_i), condition = Q__a_1_to_i), Equals(Lambda([b_1_to_i], Conditional(f__b_1_to_i, Q__b_1_to_i)), Lambda([c_1_to_i], Conditional(g__c_1_to_i, Q__c_1_to_i))).with_wrapping_at(2))
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_{1}, a_{2}, \ldots, a_{i}~|~Q\left(a_{1}, a_{2}, \ldots, a_{i}\right)}~\left(f\left(a_{1}, a_{2}, \ldots, a_{i}\right) = g\left(a_{1}, a_{2}, \ldots, a_{i}\right)\right), \begin{array}{c} \begin{array}{l} \left[\left(b_{1}, b_{2}, \ldots, b_{i}\right) \mapsto \left\{f\left(b_{1}, b_{2}, \ldots, b_{i}\right) \textrm{ if } Q\left(b_{1}, b_{2}, \ldots, b_{i}\right)\right..\right] =  \\ \left[\left(c_{1}, c_{2}, \ldots, c_{i}\right) \mapsto \left\{g\left(c_{1}, c_{2}, \ldots, c_{i}\right) \textrm{ if } Q\left(c_{1}, c_{2}, \ldots, c_{i}\right)\right..\right] \end{array} \end{array}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 3
operand: 6
2Operationoperator: 18
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 29
body: 9
7Lambdaparameters: 20
body: 10
8Lambdaparameters: 22
body: 11
9Conditionalvalue: 12
condition: 13
10Conditionalvalue: 14
condition: 15
11Conditionalvalue: 16
condition: 17
12Operationoperator: 18
operands: 19
13Operationoperator: 21
operands: 29
14Operationoperator: 27
operands: 20
15Operationoperator: 21
operands: 20
16Operationoperator: 28
operands: 22
17Operationoperator: 21
operands: 22
18Literal
19ExprTuple23, 24
20ExprTuple25
21Variable
22ExprTuple26
23Operationoperator: 27
operands: 29
24Operationoperator: 28
operands: 29
25ExprRangelambda_map: 30
start_index: 36
end_index: 37
26ExprRangelambda_map: 31
start_index: 36
end_index: 37
27Variable
28Variable
29ExprTuple32
30Lambdaparameter: 43
body: 33
31Lambdaparameter: 43
body: 34
32ExprRangelambda_map: 35
start_index: 36
end_index: 37
33IndexedVarvariable: 38
index: 43
34IndexedVarvariable: 39
index: 43
35Lambdaparameter: 43
body: 40
36Literal
37Variable
38Variable
39Variable
40IndexedVarvariable: 41
index: 43
41Variable
42ExprTuple43
43Variable