Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: occurence check in
mkInjectiveTheoremTypeCore?
(leanprover#3398)
Closes leanprover#3386 Currently, when generating the signature of an injectivity lemma for a certain constructor `c : forall xs, Foo a_1 ... a_n`, `mkInjectiveTheoremTypeCore?` will differentiate between variables which are bound to stay the same between the two equal values (i.e inductive indices), and non-fixed ones. To do that, the function currently checks whether a variable `x ∈ xs` appears in the final co-domain `Foo a_1 ... a_n` of the constructor. This condition isn't enough however. As shown in the linked issue, the codomain may also depend on variables which appears in the type of free vars contained in `Foo a_1 ... a_n`, but not in the term itself. This PR fixes the issue by also checking the types of any free variable occuring in the final codomain, so as to ensure injectivity lemmas are well-typed.
- Loading branch information