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
Set Implicit Arguments. | |
Require Import Omega. | |
(* equivalence of types along with elementary facts *) | |
Definition equiv(X Y : Type) := {f : X -> Y & {g : Y -> X & (forall x, g (f x) = x) /\ | |
(forall y, f (g y) = y)}}. | |
Lemma equiv_trans(X Y Z : Type) : equiv X Y -> equiv Y Z -> equiv X Z. | |
Proof. |
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
Set Implicit Arguments. | |
Require Import Omega. | |
Require Import Wf_nat. | |
Require Import Relation_Operators. | |
Require Import Coq.Wellfounded.Lexicographic_Product. | |
(* simultaneously produces a proof of the arith. equation eq and uses it to rewrite in the goal *) | |
Ltac omega_rewrite eq := | |
let Hf := fresh in |
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
Definition f_id : forall X Y, (X -> Y) -> X -> Y := fun X Y f => f. | |
Definition next : forall W X Y Z, ((X -> Y) -> Z) -> (W * X -> Y) -> W -> Z := | |
fun W X Y Z f g x => f (fun y => g (x,y)). | |
Fixpoint arity X n := | |
match n with | |
| 0 => X | |
| S m => X -> arity X m |
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 SetoidClass Nat. | |
Fixpoint Fin n := | |
match n with | |
| 0 => Empty_set | |
| S m => (unit + Fin m)%type | |
end. | |
Class Finite(X : Type)`{Setoid X} := { | |
card : nat; |
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 Lia PeanoNat. | |
Definition monotone(f : nat -> nat) := | |
forall x, f x < f (S x). | |
Definition cofinal(f : nat -> nat) := | |
forall x, { y : nat & x < f y }. | |
Lemma monotone_cofinal : forall f, monotone f -> cofinal f. | |
Proof. |
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. | |
Inductive rose(X : Type) : Type := | |
| node : X -> list (rose X) -> rose X. | |
Fixpoint rose_map{X Y}(f : X -> Y)(r : rose X) : rose Y := | |
match r with | |
| node _ x rs => node _ (f x) (List.map (rose_map f) rs) | |
end. |
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 Wf_nat Lia. | |
Inductive three := a | b | c. | |
(* a => 0; b => 10; c => 11 *) | |
Fixpoint encode(f : nat -> three)(n : nat) : bool := | |
match f 0 with | |
| a => match n with | |
| 0 => false |
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 Lia PeanoNat Bool.Bool. | |
Section Exhaustible. | |
Definition surj{X Y}(f : X -> Y) := | |
forall y, exists x, f x = y. | |
Definition dec(P : Prop) := {P} + {~P}. | |
Definition exh(X : Type) := forall p : X -> bool, |
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 Equations.Equations. | |
Require Import Lia. | |
Require Import List. | |
Import ListNotations. | |
Fixpoint count_up n := | |
match n with | |
| 0 => [] | |
| S m => 0 :: map S (count_up m) | |
end. |
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
Definition FPO{X}(Y : (X -> X) -> X) := | |
forall f, f (Y f) = Y f. | |
Section FPOs. | |
Variables A B : Type. | |
Variable Y_A : (A -> A) -> A. | |
Variable Y_B : (B -> B) -> B. | |
Hypothesis Y_A_FPO : FPO Y_A. |
OlderNewer