QuantumInfo.ClassicalInfo.Prob
77 declarations
The type of probabilities
#Prob`Prob` is the type of real numbers such that . It is defined as a subtype of the real numbers consisting of all elements in the closed unit interval .
Coercion from `Prob` to
#instCoeRealThere is a natural coercion from the type of probabilities `Prob` (the unit interval ) to the real numbers , which maps a probability to its underlying real value.
Real numbers in can be lifted to `Prob`
#canLiftAny real number such that can be lifted to (or identified as) an element of the type `Prob`. Here, `Prob` represents the subtype of real numbers in the unit interval .
The value as a probability
#instZeroThe type `Prob`, representing real numbers in the interval , has an additive identity element (zero), defined as the real number .
The value as a probability
#instOneThe type `Prob`, representing real numbers in the unit interval , has a multiplicative identity element (one), defined as the real number .
Multiplication of probabilities in
#instMulThe multiplication operation on the type `Prob` (the closed interval ) is defined by the multiplication of the underlying real numbers. For any two probabilities , their product is also in the interval .
The value of is
#coe_zeroLet be the type representing real numbers in the interval . The numerical value of the probability constant is equal to the real number .
The numerical value of the identity element in the type is equal to the real number . Here, represents the interval , and denotes the mapping from to the real numbers.
For any two probability values , the numerical value of their product is equal to the product of their individual numerical values, یعنی . Here, denotes the interval .
For any two probabilities , the numerical value of their infimum (minimum) is equal to the infimum of their individual numerical values, expressed as . Here, is the type of real numbers in the interval , and denotes the coercion or map from to the real numbers .
For any two probabilities , the numerical value of their supremum (maximum) is equal to the supremum of their individual numerical values, which is expressed as . Here, denotes the type of real numbers in the interval , and represents the coercion or map from to the real numbers .
The interval is a commutative monoid with zero under multiplication
#instCommMonoidWithZeroThe type , representing the interval , forms a commutative monoid with zero under multiplication. Specifically, this structure provides: 1. An identity element . 2. A zero element . 3. A multiplication operation that is associative (), commutative (), satisfies identity laws (), and acts as an annihilator for zero ().
The interval is Densely Ordered
#instDenselyOrderedThe type `Prob`, representing the closed unit interval , is a densely ordered set. This means that for any two probabilities such that , there exists a probability such that .
Complete linear order structure of `Prob`
#instCompleteLinearOrderThe type `Prob`, representing the interval , forms a complete linear order. This means that for every subset , there exists a supremum and an infimum within the interval . Furthermore, for any two elements , the relation or always holds, consistent with the standard ordering of real numbers.
Default probability
#instInhabitedThe type `Prob`, representing real numbers in the unit interval , is provided with a default element, which is the probability .
Linear ordered commutative monoid with zero structure of `Prob`
#instLinearOrderedCommMonoidWithZeroThe type `Prob`, representing real numbers in the unit interval , forms a linearly ordered commutative monoid with zero. This structure inherits the standard multiplication from real numbers as the monoid operation, ensuring that for any , if and , then . The order is the standard relation on the real numbers restricted to the interval , where the zero element is the least element.
for any
#zero_le_coeFor any probability , where denotes the set of real numbers in the unit interval , its representation as a real number satisfies .
for any
#coe_le_oneFor any probability , its representation as a real number satisfies .
for any
#zero_leFor any probability in the interval , it holds that .
for any
#le_oneLet be an element of the type `Prob`, which represents the interval of real numbers . Then is less than or equal to , i.e., .
The equality of probabilities is determined by the equality of their real values
#extFor any two probabilities , if their underlying real-number representations are equal, then and are equal as elements of the `Prob` type.
as real numbers as probabilities
#ne_iffLet and be probabilities in the unit interval . The underlying real numbers represented by and are unequal if and only if and are unequal as elements of the type `Prob`.
for
#toReal_mulLet and be elements of the type `Prob`, which represents real numbers in the closed interval . The real value of the product of and within the `Prob` type is equal to the product of their corresponding real values: .
Coercion of a probability to a non-negative real
#toNNRealLet `Prob` denote the type of real numbers in the interval . The function `toNNReal` maps an element to its corresponding value in the set of non-negative real numbers . Specifically, for , the function returns the non-negative real number .
The Value of `toNNReal` for a Probability is viewed as a Non-negative Real
#toNNReal_mkLet be a real number and be the proof that . For the probability value in the interval , its conversion to a non-negative real number () is equal to the non-negative real number . In other words, the mapping from `Prob` to `NNReal` preserves the underlying value while simplifying the property constraint from to .
Coercion from `Prob` to
#instCoeNNRealThere exists a natural coercion from the type of probabilities `Prob` (the interval ) to the type of non-negative real numbers , defined by mapping each probability to its underlying value in .
Condition for Lifting to `Prob` is
#canLiftNNA non-negative real number can be lifted to the type of probabilities `Prob` (the interval ) if and only if . Here, the lifting is defined relative to the coercion (or projection) `toNNReal` from `Prob` to .
The `toNNReal` map sends to
#toNNReal_zeroThe representation of the probability as a non-negative real number is equal to .
The probability equals in
#toNNReal_oneThe representation of the probability as a non-negative real number is equal to the non-negative real number .
The extended non-negative real representation of a probability is consistent across and pathways.
#ofNNReal_toNNRealFor any probability , let be its representation as a non-negative real number. The conversion of this non-negative real value to an extended non-negative real number () is equal to the conversion of the probability , viewed as a real number, directly to an extended non-negative real number. That is, .
Construction of a probability from where
#asProbGiven a non-negative real number and a proof that , this function constructs an element of the type `Prob`, representing the value as a probability in the closed interval .
Construction of from such that
#asProb'Given a non-negative real number and a condition that its underlying value (as a real number) is less than or equal to , this function constructs an element of the type `Prob`. This represents the value as a probability within the closed interval .
If for , then
#zero_lt_coeLet be a probability, defined as a real number in the interval . If is not equal to , then is strictly greater than when treated as a real number.
Truncated subtraction on `Prob`
#instSubSubtraction on the type `Prob` (the set of real numbers in the unit interval ) is defined for any two probabilities as . This operation ensures the result remains within the interval by truncating negative results to .
The real value of for probabilities is
#coe_subLet and be probabilities, represented as real numbers in the interval . The real value of the difference (defined within the space of probabilities) is equal to the maximum of and in the real numbers, denoted as .
The real value of for a probability is
#coe_one_minusLet be a probability, defined as a real number in the interval . Then the real-valued representation of the complement (where subtraction is defined within the space of probabilities) is equal to calculated in the real numbers .
for any probability
#add_one_minusLet be a probability, defined as a real number in the unit interval . Let denote its representation as a real number . Then the sum of and its complement (where subtraction is defined within the space of probabilities) satisfies .
for any probability
#one_minus_invLet be a probability, defined as a real number in the interval . Then the complement of its complement is itself, i.e., , where the subtraction is defined within the space of probabilities.
The type of probabilities `Prob` has an Order Topology
#instOrderTopologyThe type `Prob`, representing the interval , is equipped with the order topology. This means the topology on `Prob` is generated by the open intervals , , and for all .
The infimum in commutes with the coercion to
#coe_iInfLet be the type of probabilities represented by the closed unit interval . For any non-empty index type and any function , the coercion of the infimum of in to the real numbers is equal to the infimum of the coerced values in . That is, where denotes the natural embedding from into .
The type of probabilities `Prob` is nontrivial ( is nontrivial)
#instNontrivialThe type `Prob`, which represents the closed interval , is nontrivial. That is, it contains at least two distinct elements. Specifically, since `Prob` possesses both a zero element () and a one element () as defined by its instances, this theorem implies within the space of probabilities.
in
#top_eq_oneIn the space of probabilities (defined as the interval ), the greatest element under the canonical linear order is equal to .
for any
#sub_zeroFor any probability , subtracting the zero probability from results in itself, where the subtraction on the type `Prob` is defined such that for , .
The Map from `Prob` to is Continuous
#toNNReal_ContinuousThe function , which maps a probability (a real number in the interval ) to its representation as a non-negative real number, is a continuous function.
for
#mul_eq_one_iffLet and be probabilities, defined as real numbers in the interval . Then the product is equal to if and only if both and .
Convex combination of with weights where
#mix_abGiven a type that satisfies the `Mixable` property relative to a type , for any two elements and any real numbers such that , , and , the function returns an element in representing the convex combination of and with weights and .
Convex combination of with probability
#mixLet be a type equipped with a `Mixable` instance and be a probability. The function `Mixable.mix` defines the convex combination of two elements weighted by . Specifically, it is defined as the convex combination where and , satisfying the conditions and .
Let be a type that is `Mixable` with respect to a type . For any element and a proof that satisfies the property required to be an element of , let be the result of the constructor applied to . Then, the mapping of back to the type via the `to_U` function is equal to the original element .
Notation for the convex combination `mix p x₁ x₂`
#term_[_↔_]Let be an element of type `Prob` (representing a value in the interval ) and let be elements of a type equipped with a `Mixable` instance. The notation denotes the convex combination of and weighted by , which is defined as `mix p x₁ x₂`. This corresponds to the mathematical expression .
Notation for Convex Mix
#term_[_↔_:_]This definition introduces a notation for the convex combination (mixing) of two elements and in a type equipped with a `Mixable` instance . Given a probability , the expression represents the result as defined by the mixing operation in .
The convex combination of with is
#mix_zeroLet be a type equipped with a `Mixable` instance. For any two elements , the convex combination of and with probability is equal to . That is, .
`Mixable` instance for a real module over itself
#instUnivLet be an additive commutative monoid that is also a module over the real numbers . There exists an instance of the `Mixable` typeclass for where the underlying vector space representation of an element is the element itself (via the identity map). In this instance, the set of representable elements is the entire space , which is convex. For any two elements and a probability , the mixing operation is defined as the convex combination .
Construction of `Mixable` elements in the universal instance `instUniv` for a real module equals
#mkT_instUnivLet be an additive commutative monoid that is also a module over the real numbers . For any element , if there exists an element in the subtype defined by the universal `Mixable` instance such that its representation in the vector space is , then the result of constructing an element of the `Mixable` type from this witness is simply the pair consisting of and the trivial proof of its representation.
The representation for `instUniv` is the identity map
#to_U_instUnivLet be an additive commutative monoid that is also a module over the real numbers . For the `Mixable` instance where represents itself (via `instUniv`), the underlying vector space representation of any element is equal to the element itself.
Pointwise Existence of Pre-images in Product Mixable Types
#lem_1Let be a type, and for each , let and be types such that is a real vector space (specifically, an additive commutative monoid and a module over ) and there is a `Mixable` instance between and . Let be a dependent function mapping each to an element . If there exists a dependent function mapping each to an element such that the projection of to the universal type (denoted ) equals for all , then for any specific , there exists an element such that .
Pointwise `Mixable` instance for Pi types into
#instPiLet be an index set, and for each , let and be types such that is a real vector space (specifically, an additive commutative monoid and an -module) and is "mixable" into . The definition provides a `Mixable` instance for the product types (Pi types), mapping the dependent function type into the function space . Specifically, the mapping is defined pointwise by . Under this mapping, the image of in is shown to be convex, meaning that for any and any probabilities with , the convex combination corresponds to an element in the product of the mixable types.
Pointwise evaluation of lifted functions in `Mixable` function spaces
#val_mkT_instPiLet and be types such that is mixable into (denoted by the instance `Mixable U T`), where is a real vector space. Consider the function space for some type , which inherits a mixable structure from the pointwise mixability of . For any function that is in the image of the mapping from (i.e., there exists some such that ), let denote the lifting of to the subtype of mixable elements in the function space. Then, for every , the value of this lifted function at is equal to the result of lifting the local value to using the pointwise mixability instance.
The Map to for Functions is Defined Pointwise
#to_U_instPiLet be a type, and let and be types such that is mixable into (via an instance of the `Mixable` typeclass). For any function , the representation of in the function space is given by the pointwise application of the representation map to each value . That is, for all .
Subtype of a `Mixable` type is `Mixable` if the predicate is closed under convex combinations
#instSubtypeLet be a type and be a type that is `Mixable` into . Let be a predicate on . If the subset defined by is convex under the mixing operation of —that is, for any such that and hold, and for any non-negative real numbers with , the convex combination also satisfies —then the subtype is also `Mixable` into . The `Mixable` structure on the subtype is inherited from , where the representation in is given by the composition of the subtype inclusion and the original mapping from to .
`Prob` is `Mixable` over
#instMixableThe type `Prob`, representing real numbers in the interval , is equipped with an instance of the `Mixable` typeclass over the real numbers . This is defined by taking the underlying real value of a probability (the inclusion map into ), ensuring this mapping is injective via the extensionality of probabilities, and proving that the set is convex. Specifically, for any and non-negative such that , the convex combination also belongs to .
`Mixable.to_U` of `Prob` equals
#to_U_mixableLet `Prob` denote the type of real numbers in the interval . For any element , the value obtained by applying the `Mixable.to_U` projection (associated with the `Mixable` instance for real numbers) to is equal to the underlying real value .
for preserves the underlying value
#mkT_mixableLet be the type of real numbers in the interval . For any , if there exists a probability such that its underlying value is equal to , then the constructed mixable element (where is the proof of existence) is equal to a term whose value is and whose membership proof in the interval is derived from .
Convex combination of weighted by probability
#mixLet be the type of real numbers in the interval . For a type that satisfies the `Mixable` property with respect to a real vector space , the function `Prob.mix` takes a probability and two elements , and returns their convex combination, denoted as . This is an alias for `Mixable.mix` provided to enable dot notation on probability values.
Negative logarithm of a probability as an extended non-negative real
#negLogLet be the type of real numbers in the interval . The function `negLog` maps a probability to an extended non-negative real number defined by: \[ \text{negLog}(p) = \begin{cases} \infty & \text{if } p = 0 \\ -\log(p) & \text{if } p > 0 \end{cases} \] where denotes the natural logarithm. For , since , the value is guaranteed to be non-negative, allowing it to be cast into the extended non-negative real numbers.
Notation `—log` for the negative logarithm of a probability
#term—logA scoped notation used within the `Prob` namespace where the prefix symbol `—log` denotes the negative logarithm function `negLog`, which maps a probability to its corresponding value in the extended non-negative real numbers .
The negative logarithm of a probability is antitone
#negLog_AntitoneThe function , which assigns a probability to its negative logarithm (information content) in the extended non-negative real numbers, is antitone. That is, for any probabilities , if , then .
The negative logarithm of the probability is equal to infinity (), where the probability is treated as an element of the closed unit interval and the result is in the extended non-negative real numbers .
for probabilities
#negLog_oneThe negative logarithm of the probability is equal to . Let be the function mapping a probability to the extended non-negative real numbers , then .
For any probability , the negative logarithm is equal to (top) if and only if .
Calculation of for as an extended non-negative real number
#negLog_pos_ENNRealLet be a probability, defined as a real number in the interval . If , then the negative logarithm of , denoted as and taking values in the extended non-negative real numbers , is equal to the non-negative real number (where is the natural logarithm).
The real part of equals
#negLog_pos_RealLet be a probability. The real-valued part of its negative logarithm in the extended non-negative real numbers, denoted as , is equal to the negative of the natural logarithm of , denoted as .
implies
#le_negLog_of_le_expLet be a probability, represented as a real number in the interval . For any real number , if , then the expression of as an extended non-negative real number is less than or equal to the negative logarithm of (denoted as ).
The negative log of a positive probability is not infinite ().
#negLog_ne_topLet be a probability, defined as a real number in the interval , and let its value be denoted by . If , then its negative logarithm (denoted as ) is not equal to infinity () in the extended non-negative real numbers ().
For any probability , its negative logarithm (defined as an extended non-negative real internal to the `Prob` namespace) is equal to the negative of the logarithm of as defined for extended non-negative reals, denoted by .
Let be a probability, defined as a real number in the interval . If , then the negative logarithm of in the extended non-negative real numbers (denoted as ) is equal to the representation of the real number in the extended non-negative real numbers via the map .
for
#zero_lt_negLogFor any probability , the negative logarithm of (denoted as ) is strictly greater than if and only if is not equal to . Here, the negative logarithm maps from the interval to the extended non-negative real numbers .
The Negative Logarithm of a Probability is Continuous
#Continuous_negLogThe function , which maps a probability to its negative logarithm (information content) in the extended non-negative real numbers, is continuous.
