Zulip Chat Archive

Stream: new members

Topic: why does this inductive compile with no base cases?


Quinn (Sep 01 2024 at 23:43):

inductive Metacircuit : Type :=
| Abs : String -> Metacircuit -> Metacircuit
| App : Metacircuit -> Metacircuit -> Metacircuit

I don't know how to construct terms of this type

Quinn (Sep 01 2024 at 23:45):

shouldn't the termination checker disallow this?

Eric Paul (Sep 02 2024 at 00:24):

It's perfectly fine to have a type for which you cannot construct any terms. An example of such a type is False. In fact, you can show that having a term of your type means you can construct one of False:

inductive Metacircuit : Type :=
| Abs : String -> Metacircuit -> Metacircuit
| App : Metacircuit -> Metacircuit -> Metacircuit

example : Metacircuit  False := by
  intro m
  induction m with
  | Abs _ _ ih => trivial
  | App _ _ => trivial

Quinn (Sep 02 2024 at 01:04):

Oh right.

Quinn (Sep 02 2024 at 01:04):

So there's like a spectrum between failing the termination checker and constructing a proof of false?

Quinn (Sep 02 2024 at 01:05):

Why not just get rid of the termination checker, and use malformed types to construct proofs of false?

Quinn (Sep 02 2024 at 01:05):

I had forgotten about constructorless types and how they might relate, so thanks!

Adomas Baliuka (Sep 02 2024 at 02:48):

Quinn said:

Why not just get rid of the termination checker, and use malformed types to construct proofs of false?

I would think that we want to have non-inhabited types. Sometimes it might be interesting and hard to prove whether a type is inhabited.

Proofs of False should clearly not be allowed. Did I misunderstandil the question?

Quinn (Sep 02 2024 at 02:56):

Oops! Didn't mean proof of false, meant A->False

Luigi Massacci (Sep 03 2024 at 10:55):

Constructing terms of type : A -> False is very much allowed, that's what @Eric Paul just did for you


Last updated: May 02 2025 at 03:31 UTC