# Confused about nested inductive coinductive types

**URL:** <https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509>\
**Category:** Using Rocq\
**Created:** [December 17, 2021, 9:28pm UTC](https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509 "2021-12-17T21:28:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![molossus\_spondee](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.rocq-prover.org/molossus_spondee/32/627_2.png) [@molossus\_spondee](https://discourse.rocq-prover.org/u/molossus_spondee)\
**Post date:** [December 17, 2021, 9:28pm UTC](https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509/1 "2021-12-17T21:28:14Z")

</div>

Given the following definition of ordinals how would you define a nice induction principle over them?

```auto
CoInductive stream A := {
  head: A ;
  tail: stream A ;
}.
Inductive ord := O | S (n: ord) | Sup (s: stream ord).
```

---

<div class="post-metadata">

**Author:** ![Lyxia](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.rocq-prover.org/lyxia/32/75_2.png) [@Lyxia](https://discourse.rocq-prover.org/u/Lyxia)\
**Post date:** [December 19, 2021, 12:12am UTC](https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509/2 "2021-12-19T00:12:31Z")

</div>

I couldn’t figure out how to use `Fixpoint` through coinductive types either, but if you replace `stream A` with `nat -> A` it’s possible to define

```auto
Fixpoint ord_ind (P : ord -> Prop)
    (HO : P O)
    (HS : forall n, P n -> P (S n))
    (HSup : forall f, (forall i, P (f i)) -> P (Sup f))
  : forall n, P n.

```

---

<div class="post-metadata">

**Author:** ![molossus\_spondee](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.rocq-prover.org/molossus_spondee/32/627_2.png) [@molossus\_spondee](https://discourse.rocq-prover.org/u/molossus_spondee)\
**Post date:** [December 19, 2021, 6:39am UTC](https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509/3 "2021-12-19T06:39:46Z")

</div>

Ah well that was what I was planning on avoiding.

And I don’t think there is way to define an isomorphism between

```auto
Inductive ord := O | S (n: ord) | Lim (p: nat -> ord).

```

And the other representation without extensionality which I was maybe thinking of assuming but it’d be nice not to have to use

---

<div class="post-metadata">

**Author:** ![molossus\_spondee](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.rocq-prover.org/molossus_spondee/32/627_2.png) [@molossus\_spondee](https://discourse.rocq-prover.org/u/molossus_spondee)\
**Post date:** [December 21, 2021, 8:51pm UTC](https://discourse.rocq-prover.org/t/confused-about-nested-inductive-coinductive-types/1509/4 "2021-12-21T20:51:49Z")

</div>

> <https://gist.github.com/mstewartgallus/aac82f6c132d66d53a1a3dae238463c3>

Full context for an induction principle which doesn’t quite go through.

See also [How is coinduction the dual of induction? – Blog – Joachim Breitner's Homepage](https://www.joachim-breitner.de/blog/727-How_is_coinduction_the_dual_of_induction_)
