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, Q, f, g, i
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, Implies, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(i, Conditional(Forall(instance_param_or_params = [f, g, Q], instance_expr = Implies(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)).with_wrapping_at(2)), InSet(i, NaturalPos))))
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(i \mapsto \left\{\forall_{f, g, Q}~\left(\begin{array}{c} \begin{array}{l} \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)\right] \Rightarrow  \\ \left(\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) \end{array} \end{array}\right) \textrm{ if } i \in \mathbb{N}^+\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
1Lambdaparameter: 51
body: 3
2ExprTuple51
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple51, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple41, 42, 35
12Operationoperator: 13
operands: 14
13Literal
14ExprTuple15, 16
15Operationoperator: 17
operand: 20
16Operationoperator: 32
operands: 19
17Literal
18ExprTuple20
19ExprTuple21, 22
20Lambdaparameters: 43
body: 23
21Lambdaparameters: 34
body: 24
22Lambdaparameters: 36
body: 25
23Conditionalvalue: 26
condition: 27
24Conditionalvalue: 28
condition: 29
25Conditionalvalue: 30
condition: 31
26Operationoperator: 32
operands: 33
27Operationoperator: 35
operands: 43
28Operationoperator: 41
operands: 34
29Operationoperator: 35
operands: 34
30Operationoperator: 42
operands: 36
31Operationoperator: 35
operands: 36
32Literal
33ExprTuple37, 38
34ExprTuple39
35Variable
36ExprTuple40
37Operationoperator: 41
operands: 43
38Operationoperator: 42
operands: 43
39ExprRangelambda_map: 44
start_index: 50
end_index: 51
40ExprRangelambda_map: 45
start_index: 50
end_index: 51
41Variable
42Variable
43ExprTuple46
44Lambdaparameter: 57
body: 47
45Lambdaparameter: 57
body: 48
46ExprRangelambda_map: 49
start_index: 50
end_index: 51
47IndexedVarvariable: 52
index: 57
48IndexedVarvariable: 53
index: 57
49Lambdaparameter: 57
body: 54
50Literal
51Variable
52Variable
53Variable
54IndexedVarvariable: 55
index: 57
55Variable
56ExprTuple57
57Variable