Last active
March 15, 2022 18:51
-
-
Save bond15/e8e56c9367a47cf3cf59a1a195db7c7e to your computer and use it in GitHub Desktop.
Coq Extended Pattern Match - Program Definition
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
Require Import Program.Tactics. | |
Lemma prf (n : nat)(p : n = 0) : bool. | |
Admitted. | |
Program Definition huh(n : nat) : bool := | |
match n with | |
| O => prf n _. (* Program adds the equation `n = 0` to the context of this match branch which is pickec up by the implicit *) | |
| S n => true | |
end. | |
(* | |
Agda does not have this? | |
prf : ∀{n : ℕ} → (p : n ≡ 0) → Bool | |
prf = {! !} | |
huh : ℕ → Bool | |
huh n@zero = prf {n} _ | |
huh _ = true | |
*) |
See "Generation of Equalities"
match x with
| 0 => t
| S n => u
end.
rewritten to
(match x as y return (x = y -> _) with
| 0 => fun H : x = 0 -> t
| S n => fun H : x = S n -> u
end) (eq_refl x).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://coq.inria.fr/refman/addendum/program.html