logo

Expression of type ExprTuple

from the theory of proveit.statistics

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, Omega, X, Y, f, fx, g, gx, x
from proveit.logic import Bijections, Equals, Forall, Implies, InClass
from proveit.statistics import Prob, SampleSpaces
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(Omega, Conditional(Forall(instance_param_or_params = [X, Y], instance_expr = Forall(instance_param_or_params = [f, g], instance_expr = Implies(Forall(instance_param_or_params = [x], instance_expr = Equals(Prob(fx), Prob(gx)), domain = X), InClass(Y, SampleSpaces)).with_wrapping_at(1), domains = [Bijections(X, Omega), Bijections(X, Y)])), InClass(Omega, SampleSpaces))))
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(\Omega \mapsto \left\{\forall_{X, Y}~\left[\forall_{f \in \left[X \xrightarrow[\text{onto}]{\text{1-to-1}} \Omega\right], g \in \left[X \xrightarrow[\text{onto}]{\text{1-to-1}} Y\right]}~\left(\begin{array}{c} \begin{array}{l} \left[\forall_{x \in X}~\left(\textrm{Pr}\left(f\left(x\right)\right) = \textrm{Pr}\left(g\left(x\right)\right)\right)\right] \\  \Rightarrow \left(Y \underset{{\scriptscriptstyle c}}{\in} \textrm{SampleSpaces}\right) \end{array} \end{array}\right)\right] \textrm{ if } \Omega \underset{{\scriptscriptstyle c}}{\in} \textrm{SampleSpaces}\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: 40
body: 3
2ExprTuple40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 24
operand: 8
5Operationoperator: 26
operands: 7
6ExprTuple8
7ExprTuple40, 31
8Lambdaparameters: 37
body: 9
9Operationoperator: 24
operand: 11
10ExprTuple11
11Lambdaparameters: 12
body: 13
12ExprTuple54, 55
13Conditionalvalue: 14
condition: 15
14Operationoperator: 16
operands: 17
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22, 23
20Operationoperator: 24
operand: 30
21Operationoperator: 26
operands: 27
22Operationoperator: 44
operands: 28
23Operationoperator: 44
operands: 29
24Literal
25ExprTuple30
26Literal
27ExprTuple41, 31
28ExprTuple54, 32
29ExprTuple55, 33
30Lambdaparameter: 57
body: 34
31Literal
32Operationoperator: 36
operands: 35
33Operationoperator: 36
operands: 37
34Conditionalvalue: 38
condition: 39
35ExprTuple48, 40
36Literal
37ExprTuple48, 41
38Operationoperator: 42
operands: 43
39Operationoperator: 44
operands: 45
40Variable
41Variable
42Literal
43ExprTuple46, 47
44Literal
45ExprTuple57, 48
46Operationoperator: 50
operand: 52
47Operationoperator: 50
operand: 53
48Variable
49ExprTuple52
50Literal
51ExprTuple53
52Operationoperator: 54
operand: 57
53Operationoperator: 55
operand: 57
54Variable
55Variable
56ExprTuple57
57Variable