user5775230
user5775230

Reputation:

Understanding type inference issues in agda when proving basic function application laws

I'm trying a to prove the identity law for function application. I get yellow highlighting with respect to supposed identity function, apfId, below. I don't understand, doesn't _≡_ {A} have the type A → A → Set? Is there any simple way to check the type of an expression in Agda, like :t in the ghci?

———— Error —————————————————————————————————————————————————
/home/wmacmil/agda2020/agda/MLTT/Id.agda:217,49-55
Set₁ != Set
when checking that the expression _≡_ {A} has type A → A → Set

Any suggestions are very much appreciated.

data _≡_ {A : Set} (a : A) : A → Set where
  r : a ≡ a

infix 20 _≡_

J : {A : Set}
    → (D : (x y : A) → (x ≡ y) →  Set)
    -- → (d : (a : A) → (D a a r ))
    → ((a : A) → (D a a r ))
    → (x y : A)
    → (p : x ≡ y)
    ------------------------------------
    → D x y p
J D d x .x r = d x


-- ap\_
apf : {A B : Set} → {x y : A} → (f : A → B) → (x ≡ y) → f x ≡ f y
apf {A} {B} {x} {y} f p = J D d x y p
  where
    D : (x y : A) → x ≡ y → Set
    D x y p = {f : A → B} → f x ≡ f y
    d : (x : A) → D x x r
    d = λ x → r 

apfId : {A : Set} {x y : A} (p : x ≡ y) → (apf (_≡_ {A}) p) ≡ p -- it highlights yellow at the _≡_

Upvotes: 1

Views: 141

Answers (1)

user5775230
user5775230

Reputation:

I misinterpreted the id_A function in the HoTT book as the identity type of A (commonly denoted Id_A x x), not the identity function idA : A -> A.

Upvotes: 1

Related Questions