(** Here's an example of how you could use these lemmas. Suppose you have this simple program, [(if a <? 5 then a else 2)], and you want to prove that it evaluates to a number smaller than 6. You can use [blt_reflect] "by hand": *)
(** But there's another way to use [blt_reflect], etc: read on. *)
(* ================================================================= *)
(** ** Some Advanced Tactical Hacking *)
(** You may skip ahead to "Inversion/clear/subst". Right here, we build some machinery that you'll want to _use_, but you won't need to know how to _build_ it.  Let's put several of these [reflect] lemmas into a Hint database, called [bdestruct] because we'll use it in our boolean-destruction tactic: *)
Hint Resolve blt_reflect ble_reflect beq_reflect : bdestruct.
(** Our high-tech _boolean destruction_ tactic: *)
Ltac bdestruct X :=
let H := fresh in let e := fresh "e" in
evar (e: Prop);
assert (H: reflect e X); subst e;
[eauto with bdestruct
| destruct H as [H|H];
[ | try first [apply not_lt in H | apply not_le in H]]].
(** Here's a brief example of how to use [bdestruct].  There are more examples later. *)
Example reflect_example2: forall a, (if a<?5 then a else 2) < 6.
(* ================================================================= *)
(** ** [inversion] / [clear] / [subst] *)
(** Coq's [inversion H] tactic is so good at extracting information from the hypothesis [H] that [H] becomes completely redundant, and one might as well [clear] it from the goal.  Then, since the [inversion] typically creates some equality facts, why not then [subst] ?   This motivates the following useful tactic, [inv]:  *)
Ltac inv H := inversion H; clear H; subst.
(* ================================================================= *)
(** ** Linear Integer Inequalities *)
(** In our proofs about searching and sorting algorithms, we sometimes have to reason about the consequences of less-than and greater-than.  Here's a contrived example. *)
Module Exploration1.

Theorem omega_example1:
forall i j k,
i < j ->
~ (k - 3 <= j) ->
k > i.