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
| (* Tree on Ssreflect *) | |
| Require Import | |
| Ssreflect.ssreflect | |
| Ssreflect.ssrfun | |
| Ssreflect.ssrbool | |
| Ssreflect.eqtype | |
| Ssreflect.ssrnat | |
| Ssreflect.seq. |
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
| (* Directed finite graph *) | |
| Require Import | |
| Ssreflect.ssreflect Ssreflect.ssrbool | |
| Ssreflect.ssrfun Ssreflect.eqtype | |
| Ssreflect.ssrnat Ssreflect.seq | |
| Ssreflect.path Ssreflect.fintype | |
| Ssreflect.fingraph. | |
| Set Implicit Arguments. |
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
| digits :: (Integral a) => a -> [a] | |
| digits n | n == 0 = [] | |
| | n < 10 = [n] | |
| | otherwise = n `mod` 10:digits (n `div` 10) | |
| sqrSum :: (Integral a) => [a] -> a | |
| sqrSum = foldr (\x -> (x^2 +)) 0 | |
| compress :: (Integral a) => a -> a | |
| compress = sqrSum.digits |
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 | |
| Ssreflect.ssreflect | |
| Ssreflect.eqtype | |
| Ssreflect.ssrbool | |
| Ssreflect.fintype | |
| Ssreflect.seq. | |
| Goal | |
| (forall (T : finType) (xs : seq T), | |
| #|xs| = #|T| -> forall x, x \in xs). |
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 Wellfounded. | |
| Require Import List. | |
| (** * Structural Recursive foldr & Well-founded Recursive foldr *) | |
| Section FoldR. | |
| Context {A B: Set}(op: A -> B -> B)(e: B). | |
| (** ** normal foldr *) | |
| Fixpoint foldr (l: list A) := |
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 Wellfounded. | |
| Require Import List. | |
| (** * Structural Recursive fold & Well-founded Recursive fold | |
| ** foldr | |
| *) | |
| Section FoldR. | |
| Context {A B: Set}(op: A -> B -> B)(e: B). |
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 Wellfounded. | |
| Require Import List. | |
| (** * Structural Recursive fold & Well-founded Recursive fold | |
| ** foldr | |
| *) | |
| Section FoldR. | |
| Context {A B: Set}(op: A -> B -> B)(e: B). |
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
| Inductive leq (n: nat): nat -> Set := | |
| | leq_n : leq n n | |
| | leq_S (m: nat): n <= m -> leq n m -> leq n (S m). | |
| Lemma leq_n_unique: | |
| forall (n: nat)(H: leq n n), | |
| H = leq_n n. | |
| Proof. | |
| intros n H. | |
| destruct H. (* fail... *) |
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
| Module Type Ma. | |
| Parameter R : Type. | |
| End Ma. | |
| Module Type Mb (A : Ma). | |
| Include A. | |
| Definition tmp := R. | |
| Back. | |
| Back. | |
| Back. |
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
| (* モナドを作ってみましょう *) | |
| Set Implicit Arguments. | |
| Unset Strict Implicit. | |
| Notation 型全体 := Type. | |
| Notation 命題 := Prop. | |
| Notation "T '上の変換'" := (T -> T) (at level 55, left associativity). | |
| Notation "X 'から' Y 'への関数'" := (X -> Y) (at level 60, right associativity). |