Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Ltac automation.

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Ltac automation.


chronological Thread 
  • From: Tom Prince <tom.prince AT ualberta.net>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Ltac automation.
  • Date: Wed, 09 Feb 2011 14:09:46 -0500

Axiom param : nat -> Type.
Axiom val : ∀ n, param n.

Inductive Laws : nat -> Prop :=
  | law_1 : Laws 1
  | law_6 : Laws 6
  | law_7 : Laws 7.
Definition appl {n} (_:Laws n) := match n return match n with 0 => param (S 
n) | S n => param n end with
                                    | 0 => val 1
                                    | S n => val n
                                  end.

Record rec := { m1 : param 0; m7: param 6; m6: param 5 }.

Goal rec.
constructor.
(* This following three tactics solve the goal, but are very verbose *)
let n:= fresh in (evar (n:nat); assert (Laws n) as P; subst n; [ constructor 
1 | apply (appl P)]).
let n:= fresh in (evar (n:nat); assert (Laws n) as P; subst n; [ constructor 
3 | apply (appl P)]).
let n:= fresh in (evar (n:nat); assert (Laws n) as P; subst n; [ constructor 
2 | apply (appl P)]).
Defined.

Goal rec.
(* I would think the following would also work, but "constuctor" seems
   to be ignoring its argument. Anyway, I have a number of theorems that
   can be proved like this that I would like automate. *)
Ltac TAC k := (let n:= fresh "n" in (evar (n:nat); assert (Laws n) as P; 
subst n); [ constructor k | apply (appl P) ]).
constructor; [TAC 1 | TAC 3 | TAC 2].




Archive powered by MhonArc 2.6.16.

Top of Page