leanprover / lean3

Lean Theorem Prover
http://leanprover.github.io/
Apache License 2.0
2.15k stars 217 forks source link

fix(library/coinductive_predicates): fix existential types #1984

Closed cipher1024 closed 5 years ago

cipher1024 commented 5 years ago

coinductive_predicates would work badly when given an existential type such as:

coinductive rel : ℕ → ℕ → Prop
| trans (x y z : ℕ) :
  rel x y → rel y z → rel x z

Now it works and produces the following corecursion principle:

rel.corec_on :
  ∀ (C : ℕ → ℕ → Prop) {a a_1 : ℕ},
    C a a_1 → (∀ (a a_1 : ℕ), C a a_1 → (∃ (y : ℕ), C a y ∧ C y a_1)) → rel a a_1
johoelzl commented 5 years ago

Uh why do the other test cases fail now?

cipher1024 commented 5 years ago

The problem was that my use of unify seems only valid for existential types. So I'm making a case distinction now.

Kha commented 5 years ago

Coinductive predicates are being moved to mathlib.

cipher1024 commented 5 years ago

Thanks!