Simplifies an overlap hypothesis of an equation for a match alternative.
The equation for an alternative has one hypothesis for each previous alternative that overlaps
it. The hypothesis states that the previous alternative does not match. Before it is simplified,
it has the form ∀ xs, eqs → False, where xs are the pattern variables of the previous
alternative, and eqs are numEqs equations p = q or p ≍ q between the patterns of the two
alternatives.
The type of the goal mvarId must be a hypothesis of this form. This function returns
noneif the hypothesis is redundant: the equationseqsare contradictory, andmvarIdhas been closed. Example:none = some 0 → False.some mvarId'otherwise. The type ofmvarId'is the simplified hypothesis, andmvarIdhas been proved usingmvarId'.
The equations are processed one at a time.
p = qis removed ifpandqare definitionally equal.p = x, wherexis one of the variablesxs, is removed, andxis replaced withp.p ≍ qis replaced withp = qifpandqhave the same type.- An equation between constructor applications is replaced with the equations between their fields. If the constructors are different, the hypothesis is redundant.
- Any other equation is kept.
The simplified hypothesis is ∀ xs', eqs' → False, where eqs' are the equations that were kept,
and xs' are the variables in xs that occur in them.
Examples, where n : Nat and x : Nat × Nat are variables of the alternative being processed:
some n = some 0 → Falseis simplified ton = 0 → False.∀ m, some n = some (m + 1) → Falseis simplified to∀ m, n = m + 1 → False.∀ a, n = a → x = (a, 0) → Falseis simplified tox = (n, 0) → False.∀ m, some n = some m → Falseis simplified toFalse: the previous alternative always matches.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the simplified form of the overlap hypothesis h of an equation for a match
alternative, or none if h is redundant. h must be of the form ∀ xs, eqs → False, where
eqs are numEqs equations. See simpH for the simplification steps and examples.
Only the statement is computed: h is the type of the hypothesis as generated from the patterns,
and the result is the type used in the statement of the equation.
Equations
- One or more equations did not get rendered due to their size.