Created
April 21, 2021 10:35
-
-
Save yoshihiro503/7163cfa52557cc0a6be39fdf899e19f6 to your computer and use it in GitHub Desktop.
list mapがリストの長さを変えないことを証明する例です
This file contains hidden or 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. | |
Fixpoint list_map {A B:Type} (f : A -> B) (xs : list A) := | |
match xs with | |
| [] => [] | |
| x :: xs => f x :: list_map f xs | |
end. | |
Theorem list_map_length : forall (A B: Type) (f: A -> B) xs, | |
length (list_map f xs) = length xs. | |
Proof. | |
induction xs. | |
- reflexivity. | |
- simpl. now rewrite IHxs. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment