Library Coqtail.Fresh.Inhabited.Examples

Require Import Monad.

Lemma ex_inhabited_sig : A (f : AProp), ex f[ sig f ].
Proof.
intros A f Hex.
destruct Hex as (x, fx).
constructor.
x.
apply fx.
Qed.

Lemma ex_is_inhabited_sig A (f : AProp) : ex f [ sig f ].
Proof.
split; repeat intros []; eauto.
Qed.

Lemma Prop_inhabited_stable : P : Prop, P[P].
Proof.
auto.
Qed.

Lemma Prop_inhabited_inversion : P : Prop, [P]P.
Proof.
intros ? []; apply id.
Qed.

Lemma Type_inhabited_stable : P : Type, P[P].
Proof.
auto.
Qed.

Definition epsilon := (A : Type) (f : AProp), ( x, f x) → { x | f x }.

Definition algebraic := P : Type, [ P ]P.

Lemma Type_inhabited_inversion_implies_epsilon : algebraicepsilon.
Proof.
intros Hs A f Hex.
apply Hs.
apply ex_inhabited_sig; assumption.
Qed.

Require Import InhabitedTactics.

Lemma unlift_example : (P Q : Type) (R : Prop), [ P ][ PQ ][ QR ]R.
Proof.
intros P Q R p pq qr.
unlift.
tauto.
Qed.

Lemma unlift_example2 : (P Q R : Type), [ P ][ PQ ][ QR ][ R ].
Proof.
intros P Q R p pq qr.
unlift.
tauto.
Qed.

Lemma unlift_example3 : (P Q R : Type), [ P ][ PQ ][ QR ]R.
Proof.
intros P Q R p pq qr.
intuition.
Admitted.

Lemma stronger_inhabited_in_hypothese : A B, ([A][B]) → (A[B]).
Proof.
eauto.
Qed.

Definition not (A : Type) : Type := AFalse.


Lemma stronger_inhabited_in_hypothese' :
  ( A B, (A[B]) → ([A][B])) →
  True .
Proof.
intros HH.
apply I.
Qed.

Lemma inhabited_sum_or : (A B : Type) (P : Prop),
 (([A] [B]) → P) ((A + B) → P).
Proof.
intros; split.
  intuition.
  intros ? [ [ ] | [ ] ]; auto.
Qed.