Given a local constant H : C x₁ ... xₙ = D y₁ ... yₘ, where C and D are
fully applied constructors, injection_with H ns base offset does the
following:
- If
C ≠ D, it solves the goal (using the no-confusion rule). - If
C = D(and thusn = m), it adds hypothesesh₁ : x₁ = y₁, ..., hₙ : xₙ = yₙto the local context. Names for thehᵢare taken fromns. Ifnsdoes not contain enough names, then the names are derived frombaseandoffset(by defaulth_1,h_2etc.; seeintro_fresh). - Special case: if
C = Dandn = 0(i.e. the constructors have no arguments), the hypothesish : trueis added to the context.
injection_with returns the new hypotheses and the leftover names from ns
(i.e. those names that were not used to name the new hypotheses). If (and only
if) the goal was solved, the list of new hypotheses is empty.
Simplify the equation h using injectivity of constructors. See
injection_with. Returns the hypotheses that were added to the context, or an
empty list if the goal was solved by contradiction.
Simplifies equations in the context using injectivity of constructors. For
each equation h : C x₁ ... xₙ = D y₁ ... yₘ in the context, where C and D
are constructors of the same data type, injections_with does the following:
- If
C = D, it adds equationsx₁ = y₁, ...,xₙ = yₙ. - If
C ≠ D, it solves the goal by contradiction.
See injection_with for details, including information about base and
offset.
injections_with also recurses into the new equations xᵢ = yᵢ. If it has to
recurse more than five times, it fails.