logo

Expression of type Conditional

from the theory of proveit.numbers.summation

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, Function, R, S, a, f, fa, fx, gy, n, x, y
from proveit.logic import And, Card, Equals, Forall, Implies, InSet, SetOfAll
from proveit.numbers import Complex, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y]
expr = Conditional(Implies(Forall(instance_param_or_params = [a], instance_expr = InSet(fa, Complex), domain = R), Equals(Sum(index_or_indices = [x], summand = fx, domain = R), Sum(index_or_indices = sub_expr1, summand = Function(f, [gy]), domain = S))), And(Equals(SetOfAll(instance_param_or_params = sub_expr1, instance_element = gy, domain = S), R), Equals(Card(S), n), Equals(Card(R), n)))
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[\forall_{a \in R}~\left(f\left(a\right) \in \mathbb{C}\right)\right] \Rightarrow \left(\left[\sum_{x \in R}~f\left(x\right)\right] = \left[\sum_{y \in S}~f\left(g\left(y\right)\right)\right]\right) \textrm{ if } \left\{g\left(y\right)\right\}_{y \in S} = R ,  |S| = n ,  |R| = n\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
6ExprTuple9, 10, 11
7Operationoperator: 12
operand: 19
8Operationoperator: 17
operands: 14
9Operationoperator: 17
operands: 15
10Operationoperator: 17
operands: 16
11Operationoperator: 17
operands: 18
12Literal
13ExprTuple19
14ExprTuple20, 21
15ExprTuple22, 60
16ExprTuple23, 25
17Literal
18ExprTuple24, 25
19Lambdaparameter: 58
body: 26
20Operationoperator: 28
operand: 37
21Operationoperator: 28
operand: 38
22Operationoperator: 30
operand: 39
23Operationoperator: 33
operand: 62
24Operationoperator: 33
operand: 60
25Variable
26Conditionalvalue: 35
condition: 36
27ExprTuple37
28Literal
29ExprTuple38
30Literal
31ExprTuple39
32ExprTuple62
33Literal
34ExprTuple60
35Operationoperator: 56
operands: 40
36Operationoperator: 56
operands: 41
37Lambdaparameter: 59
body: 42
38Lambdaparameter: 65
body: 43
39Lambdaparameter: 65
body: 44
40ExprTuple45, 46
41ExprTuple58, 60
42Conditionalvalue: 47
condition: 48
43Conditionalvalue: 49
condition: 50
44Conditionalvalue: 61
condition: 50
45Operationoperator: 54
operand: 58
46Literal
47Operationoperator: 54
operand: 59
48Operationoperator: 56
operands: 53
49Operationoperator: 54
operand: 61
50Operationoperator: 56
operands: 57
51ExprTuple58
52ExprTuple59
53ExprTuple59, 60
54Variable
55ExprTuple61
56Literal
57ExprTuple65, 62
58Variable
59Variable
60Variable
61Operationoperator: 63
operand: 65
62Variable
63Variable
64ExprTuple65
65Variable