Skip to content

Instantly share code, notes, and snippets.

@bmsherman
Created March 28, 2016 16:44
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 bmsherman/23239db85008ee60b69c to your computer and use it in GitHub Desktop.
Save bmsherman/23239db85008ee60b69c to your computer and use it in GitHub Desktop.
An isomorphism of types involving truncation.
Record T { A B : Type } : Type :=
{ to : A -> B
; from : B -> A
; from_to : forall (a : A), from (to a) = a
; to_from : forall (b : B), to (from b) = b
}.
Arguments T : clear implicits.
Inductive inhabited {A : Type} : Prop :=
| elem (a : A) : inhabited.
Arguments inhabited : clear implicits.
Require Import ProofIrrelevance.
Theorem inhabited_idempotent {A : Type} :
T A (inhabited A * A).
Proof.
refine (
{| to := fun a => (elem a, a)
; from := fun p => snd p
|}
).
- intros. reflexivity.
- intros. destruct b. simpl.
replace (elem a) with i by apply proof_irrelevance.
reflexivity.
Defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment