Defining a type hierarchy in Coq or Agda

I would like to create a kind of type hierarchy:

B is of type A  ( B::A )

C and D are of type of B   (C,D ::B) 

E and F are of type of C     (E,F ::C)

I asked here if this can be done directly in Isabelle, but the answer you see is no. Is it possible to code this directly in Agda or Coq?

PS: suppose A..F are abstract, and some functions are defined for each type)

thank

+4
source share
1 answer

, - . _isOfType_, Set ( A B), indeed , - , ( A ):

data _isOfType_ {ℓ} {A : Set ℓ} (a : A) : (B : Set ℓ) → Set where
  indeed : a isOfType A

, , . , f, C . , E F C f :

example : ∀ (A : Set₃) (B : Set₂) (C D : Set₁) (E F : Set) →
    B isOfType A
  → C isOfType B → D isOfType B
  → E isOfType C → F isOfType C
  → (f : C → C → C) → C
example A B .Set D E F _ _ _ indeed indeed f = f E F

Agda , ? .

+6

All Articles