(** The [consider] tactic recovers some of the ease of reasoning about ** decision procedures when they are implemented as functions into bool. ** ** Implementation by Thomas Braibant (thomas.braibant@gmail.com) **)
(*Require Setoid. *)
(** This file defines some inductives, type-classes and tactics to perform reflection on a small scale *)
(** Two inductives to perform case-based reasonning *)
Inductive reflect (P Q : Prop) : bool -> Type :=
| reflect_true : P -> reflect P Q true
| reflect_false : Q -> reflect P Q false.
Inductive semi_reflect (P : Prop) : bool -> Type :=
| semi_reflect_true : P -> semi_reflect P true
| semi_reflect_false : semi_reflect P false.

(* Specifications: *)
Lemma iff_to_reflect {A B} (P : A -> B -> Prop) (T : A -> B -> bool)  :
(forall x y, T x y = true <-> P x y) ->
(forall x y, reflect (P x y) (~P x y) (T x y)).
Lemma impl_to_semireflect {A B} (P : A -> B -> Prop) (T : A -> B -> bool)  :
(forall x y, T x y = true -> P x y) ->
(forall x y, semi_reflect (P x y) (T x y)).
Lemma reflect_true_inv P Q : reflect P Q true -> P.
Lemma reflect_false_inv P Q : reflect P Q false -> Q.
Lemma semi_reflect_true_inv P : semi_reflect P true -> P.
Class Reflect (T : bool) (P Q : Prop) := _Reflect : reflect P Q T.