Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (45 sloc) 1.114 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
Require Export Bool.
Require Setoid.

Set Implicit Arguments.

Section beq.

  Variable A : Type.
  Variable beq : A -> A -> bool.
  Variable beq_ok : forall x y, beq x y = true <-> x = y.

  Lemma beq_refl : forall x, beq x x = true.
  Proof.
    intros. rewrite (beq_ok x x). reflexivity.
  Qed.

End beq.

Lemma andb_intro : forall a b, a = true -> b = true -> a && b = true.
Proof.
  intros. subst. reflexivity.
Qed.

Lemma andb_elim : forall a b, a && b = true -> a = true /\ b = true.
Proof.
  destruct a; destruct b; intuition.
Qed.

Lemma band_discr : forall b1 b2,
  b1 = true ->
  b2 = true ->
  ~(b1 && b2 = false).
Proof.
  intros. subst. discriminate.
Qed.

Lemma bool_case : forall b, {b = true} + {b = false}.
Proof.
  destruct b; auto.
Qed.

Lemma not_false_true b : b = true -> b <> false.
Proof.
  intros. destruct b; discriminate.
Qed.

Ltac band_discr :=
  match goal with
  | _: ?X && ?Y = false |- _ => apply (@band_discr X Y); trivial
  end.

Ltac bool_solver :=
  match goal with
  | |- ?X && ?Y = true =>
      eapply (proj2 (andb_true_iff _ _)); split; bool_solver
  | _ => idtac
  end.
Something went wrong with that request. Please try again.