lean4-htt/tests/lean/run/10234.lean
Wojciech Różowski 5c03ab9630
fix: unfolding order on predicates (#10245)
This PR changes the implementation of a function `unfoldPredRel` used in
(co)inductive predicate machinery, that unfolds pointwise order on
predicates to quantifications and implications. Previous implementation
relied on `withDeclsDND` that could not deal with types which depend on
each other. This caused the following example to fail:

```lean4
inductive infSeq_functor1.{u} {α : Type u} (r : α → α → Prop) (call : {α : Type u} → (r : α → α → Prop) → α → Prop) : α → Prop where
  | step : r a b → infSeq_functor1 r call b → infSeq_functor1 r call a

def infSeq1 (r : α → α → Prop) : α → Prop := infSeq_functor1 r (infSeq1)
  coinductive_fixpoint monotonicity by sorry

#check infSeq1.coinduct
```
Closes #10234.
2025-09-08 10:07:15 +00:00

28 lines
1.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

inductive infSeq_functor1.{u} {α : Type u} (r : αα → Prop) (call : {α : Type u} → (r : αα → Prop) → α → Prop) : α → Prop where
| step : r a b → infSeq_functor1 r call b → infSeq_functor1 r call a
def infSeq1 (r : αα → Prop) : α → Prop := infSeq_functor1 r (infSeq1)
coinductive_fixpoint monotonicity by sorry
/--
info: infSeq1.coinduct.{u_1} (pred : {α : Type u_1} → (αα → Prop) → α → Prop)
(hyp : ∀ {α : Type u_1} (r : αα → Prop) (a : α), pred r a → infSeq_functor1 r (fun {α} => pred) a) {α : Type u_1}
(r : αα → Prop) (a✝ : α) : pred r a✝ → infSeq1 r a✝
-/
#guard_msgs in
#check infSeq1.coinduct
def infSeq_functor2 {α : Sort u} (r : αα → Prop) (call : {α : Sort u} → (r : αα → Prop) → α → Prop) : α → Prop := fun a =>
∃ b, r a b ∧ call r b
def infSeq2 (r : αα → Prop) : α → Prop := infSeq_functor2 r infSeq2
coinductive_fixpoint monotonicity sorry
/--
info: infSeq2.coinduct.{u_1} (pred : {α : Sort u_1} → (αα → Prop) → α → Prop)
(hyp : ∀ {α : Sort u_1} (r : αα → Prop) (a : α), pred r a → ∃ b, r a b ∧ (fun {α} => pred) r b) {α : Sort u_1}
(r : αα → Prop) (a✝ : α) : pred r a✝ → infSeq2 r a✝
-/
#guard_msgs in
#check infSeq2.coinduct