A coq plugin implementing the translation associated to a modality
Let ◯ be a strict modality.
To explain the translation on positive types as well, we also translate the sum type A + B, with associated constructors inℓ and inr and eliminator ⟨_,_⟩. We note J the eliminator of the identity type.
-
For types (assuming A ≠ Type)
-
[Type] ≔ (Type◯ ; πType◯)
-
We introduce the notation ⟦A⟧ ≔ π1 [A]
-
For dependent sums
-
[Σx:A B] ≔ (Σx:⟦A⟧⟦B⟧, πΣ[A],[B])
-
[(x,y)] ≔ ([x],[y])
-
[πi t] ≔ πi [t]
-
For dependent products
-
[Πx:A B] ≔ (Πx:⟦A⟧⟦B⟧, πΠ[A],[B])
-
[λ x:A, M] ≔ λ x:⟦A⟧, [M]
-
[t t'] ≔ [t] [t']
-
For paths
-
[A = B] ≔ ([A] = [B] ; π=[A],[B])
-
[idpath] ≔ idpath
-
[J] ≔ J
-
For sums
-
[A + B] ≔ (◯ ([|A|] + [|B|]) ; π◯[|A|]+[|B|])
-
[inℓ t] ≔ η(inℓ [t])
-
[inr t] ≔ η(inr [t])
-
[⟨f,g⟩] ≔ ◯rec⟦A⟧+⟦B⟧⟨[f],[g]⟩
where πΣA, B (resp. πΠA, B, resp. π=A, B) is the proof that Σx : AB (resp. ∏x : AB, resp A = B) is modal as soon as A and B are, and π◯A a proof that ◯A is always modal.