Created
January 5, 2025 14:00
-
-
Save gelisam/339bddae9a25bc63596524623d4b6169 to your computer and use it in GitHub Desktop.
a function can be passed a postulate as an irrelevant argument and still still compute a result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- a demonstration that a function can be passed a postulate as an irrelevant | |
-- argument and still still compute a result | |
module Irrelevance where | |
open import Data.Nat | |
open import Relation.Binary.PropositionalEquality | |
open ≡-Reasoning | |
postulate | |
undefined : ℕ | |
data Vec (A : Set) : ℕ → Set where | |
nil | |
: Vec A 0 | |
cons | |
: {n : ℕ} | |
→ A | |
→ Vec A n | |
→ Vec A (suc n) | |
length : {A : Set} → {n : ℕ} → Vec A n → ℕ | |
length nil | |
= 0 | |
length (cons _ xs) | |
= 1 + length xs | |
test : length {ℕ} {undefined} (cons 1 (cons 2 nil)) ≡ 2 | |
test = refl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment