Last active
February 22, 2020 11:26
-
-
Save gyu-don/22790700743107536618cbfc11eed67b to your computer and use it in GitHub Desktop.
リストのリストをリストにするやつがモナドであることを示しました。
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. | |
Theorem concat_assoc(X: Type): | |
forall tttx: list (list (list X)), (concat (concat tttx)) = (concat (map (@concat X) tttx)). | |
Proof. | |
intros. | |
induction tttx. | |
simpl. reflexivity. | |
simpl. rewrite <- IHtttx. apply concat_app. | |
Qed. | |
Theorem concat_unit1(X: Type): | |
forall tx: (list X), tx = (concat [tx]). | |
Proof. | |
intros. | |
destruct tx. | |
simpl. reflexivity. | |
simpl. rewrite app_nil_r. reflexivity. | |
Qed. | |
Theorem concat_unit2(X: Type): | |
forall tx: (list X), tx = (concat (map (fun x=>[x]) tx)). | |
Proof. | |
intros. | |
induction tx. | |
simpl. reflexivity. | |
simpl. rewrite <- IHtx. reflexivity. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment