Outcome-avoiding sampling and REACH
DefinitionFormalizedScopeReach_REACHThe outcome-avoiding transitions remove the outcome token and renormalize every other token probability. The law is the sum of their product masses over outcome-free timelines ending at the same first threshold crossing. The REACH score is one minus the product of the original model non-outcome probabilities along such a timeline. The REACH estimator averages those scores. The theorem targets explicitly require this sampling law to have total mass one; this is the confirmed additional almost-sure termination and viability assumption.
import Definitions.Def_FormalizedScopeReach_SCOPE
noncomputable section
open scoped BigOperators ENNReal
open MeasureTheory
namespace FormalizedScopeReach
variable {V : Type}
def avoidingStepMass (M : Model V) (h : List V) (a : V) : ℝ≥0∞ := by
classical
exact if a = M.outcome then 0 else M.next h a / (1 - M.next h M.outcome)
def avoidingPathMass (M : Model V) (x : Timeline V) : ℝ≥0∞ := by
classical
exact if terminal M x ∧ M.outcome ∉ x then
∏ i : Fin x.length, avoidingStepMass M (x.take i.val) (x.get i)
else 0
def avoidingLaw (M : Model V) : Measure (Timeline V) :=
Measure.sum (fun x => avoidingPathMass M x • Measure.dirac x)
def reachScore (M : Model V) (x : Timeline V) : ℝ :=
1 - ∏ i : Fin x.length, (1 - hazard M (x.take i.val))
def reachEstimator (M : Model V) (n : ℕ)
(xs : Fin n → Timeline V) : ℝ :=
(∑ i, reachScore M (xs i)) / (n : ℝ)
end FormalizedScopeReach
Read-back
What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)
Blind read-back: Def_FormalizedScopeReach_REACH.lean
avoidingStepMass
For any type , a model consisting of a distinguished element , a probability mass function of total mass for every finite list , and a stopping predicate on such lists, any finite list over , and any , avoidingStepMass is when , and otherwise. The subtraction and division take place in the extended nonnegative reals; subtraction is truncated at , and in this arithmetic, whereas a positive numerator divided by is . Since is a probability mass function, if then for every , and this definition consequently gives zero for every in that case. There is no assumption that , that avoids , or that the stopping predicate fails at ; the result is an individual mass value rather than a value whose type asserts a probability mass function. The model includes the requirement that its stopping predicate is false on the empty list.
avoidingPathMass
For any type , any model with distinguished element , transition probability mass functions of total mass , and stopping predicate , and any finite list , avoidingPathMass is the extended nonnegative real product if holds, fails for every , and does not occur in , and it is otherwise. Here is the first entries, and for , while for , with extended nonnegative subtraction and division. No positive-denominator assumption is imposed: if then all are zero, using the probability-mass-function constraints and . A zero factor therefore makes a nonempty product zero. For the empty list the avoidance and proper-prefix conditions hold automatically and the product is , but the model requires , so the terminality condition fails and its mass is . There is no eventual-stopping assumption.
avoidingLaw
For any type and any model with distinguished element , transition probability mass functions of total mass , and stopping predicate , avoidingLaw is the measure on all finite lists over , with every subset measurable, formed by summing weighted point masses over all such lists . A list has weight when it contains no , satisfies , and has for every ; all other lists have weight . Here is its prefix of length and is for and otherwise, using extended nonnegative arithmetic; if , all are zero. The value of the measure on a set is the extended nonnegative sum of these weights for , with no countability assumption on . The empty list contributes weight because the model requires . No argument assumes total mass or eventual stopping, and no infinite lists are included; if never holds the measure is zero.
reachScore
For any type , any model with distinguished element , transition probability mass functions of total mass , and a stopping predicate , and any finite list of length , reachScore is the real number , where is the first entries and each transition mass is converted from an extended nonnegative real to its finite real value, which lies in . Every listed prefix contributes a factor, regardless of whether holds there or whether it contains . There is no assumption that is terminal, avoids , has positive path weight, or is drawn from any measure. The full list is not itself an index in this product. For the empty list the product is and the score is ; if any indexed prefix has , the product is zero and the score is . The model includes the requirement that its stopping predicate is false on the empty list.
reachEstimator
For any type , any model with distinguished element , transition probability mass functions of total mass , and stopping predicate, any natural number , and any family of finite lists over indexed by , reachEstimator is the real number , where is the length of , is its prefix of length , and probabilities are interpreted as their finite real values. It applies to arbitrary lists, without terminality, avoidance, positive-path-weight, sampling-law, or independence assumptions. The stopping predicate does not enter the formula. An empty list has score because its product is . The sample count may be , in which case the result is by the empty-sum and real-division conventions. The model includes the requirement that its stopping predicate is false on the empty list.
Confirmed by the mission captain (proposal self-audit).