Skip to content

Instantly share code, notes, and snippets.

@gyu-don
Last active February 22, 2020 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyu-don/22790700743107536618cbfc11eed67b to your computer and use it in GitHub Desktop.
Save gyu-don/22790700743107536618cbfc11eed67b to your computer and use it in GitHub Desktop.
リストのリストをリストにするやつがモナドであることを示しました。
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