This document lists all formal invariants of the SRS model used in the application.
An invariant is a property that must always hold to guarantee:
Invariants are divided into two categories:
SRSConfig (global, static configuration),SRSState (dynamic, persisted state).SRSConfig InvariantsThese invariants concern only the model configuration.
They must be verified:
SRSConfig is created,SettingsScreen.They must not be verified on every runtime SRS update.
λ in lambdas:0 < λ ≤ 1lambdas.length == 6Rationale:
λ is a weighted forgetting factor.rbar) becomes unstable or unbounded.lambdas must provide a value for each Grade used by the SRS.
In the current implementation, this corresponds to a length of 6
(grades 0 to 5), even if some grades may be unused.mu ≥ 0Rationale:
mu < 0 would cause memory to strengthen with delay, which is nonsensical.longPause > 0Rationale:
a zero or negative pause has no temporal meaning.
0 ≤ minTolFactor ≤ 1
Rationale:
learningSteps.isNotEmptyHard invariant.
learningSteps.length > 1Soft invariant (recommended, but not strictly required).
Rationale:
hardReviewFactor ≥ 10 < hardLearningFactor ≤ 1easyBonus ≥ 1Rationale:
dayBoundary < 24hRationale:
wMax = wMaxFactor × rStar0 ≤ wMaxFactor < 1This relationship is definitional and guaranteed by a getter.
It must not be verified dynamically.
The second relation ensures that w < rStar and that the logarithmic
expressions in the model are always defined.
0 < rstar < 1rstar is a probabilistic parameter representing the target recall probability.
0 < easyInterval < iMaxAll intervals are in days.
Note:
It is recommended that easyInterval be greater than or equal to
the last step in learningSteps, to avoid a regression when
graduating with “Easy”.
0 < efMinMinimum possible value of easeFactor.
0 < iMaxMaximum review interval. An interval that is too short has no value but is not forbidden.
efMin < defaultEFDefault value of easeFactor.
0 < defaultW ≤ wMaxDefault value of w.
SRSState InvariantsThese invariants concern the dynamic memorisation state.
They must be:
Unlike SRSConfig, SRSState may attempt to correct certain invariants
to prevent irreversible corruption.
interval > 0interval ≤ config.iMaxRationale:
lastReview ≤ nextReviewRationale:
kFactor > 0Rationale:
kFactor is a forgetting rate (unit: 1 / day),0 ≤ rbar ≤ 1Rationale:
rbar is a weighted average of successes.0 ≤ w ≤ wMaxRationale:
log or exponential undefined).efMin ≤ easeFactorRationale: this is a minimum bound.
learningStepIndex == -10 ≤ learningStepIndex < learningSteps.lengthRationale:
All elements of history must be valid Grade values.
history.isNotEmpty after at least one effective review.history.length must match the number of grades effectively applied.Rationale:
rbar.nextReview = lastReview + intervalRationale:
interval represents the theoretically optimal interval between
lastReview and nextReview.
By construction:
nextReview is computed as lastReview + interval
at the moment the SRS is updated, regardless of whether the current
date has exceeded that value.
These invariants must not cause failures in production, but may trigger:
Examples:
interval and nextReview - lastReview,nextReview slightly in the past.Formulas that must not be treated as invariants:
w = wMax * rbarThis is a w update equation.
w is a stored latent state — it does not strictly depend on wMax and rbar at all times.
For the same reason, there is no invariant between: interval, easeFactor, kFactor, and w.
SRSConfig:
SRSState:
Grade,This document is the reference for any future SRS evolution. Any modification to the model must preserve these invariants or explicitly justify their evolution.