Created
September 14, 2023 20:04
-
-
Save wilcoxjay/0eff5a2c4f2f07981e87fa321bdaff99 to your computer and use it in GitHub Desktop.
Induction by hand in Coq
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 List. | |
Import ListNotations. | |
Definition map_length {A B} (f : A -> B) : | |
forall l, length (map f l) = length l. | |
refine (fix loop l := _). | |
refine (match l with | |
| [] => _ | |
| x :: xs => _ | |
end). | |
refine eq_refl. | |
change (S (length (map f xs)) = S (length xs)). (* optional: cleaner simplifying by hand *) | |
refine (f_equal S _). | |
refine (loop xs). | |
Defined. | |
Print map_length. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment