Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Elim tactic and dependency problem

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Elim tactic and dependency problem


chronological Thread 
  • From: Nadeem Abdul Hamid <nadeem AT acm.org>
  • To: coq-club AT pauillac.inria.fr
  • Subject: [Coq-Club] Elim tactic and dependency problem
  • Date: Tue, 3 Mar 2009 16:27:49 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=OGlx5W17rLJfKB+aVNmJQLDkuYSgNd7VbLN8bTrT85FyyPQcK/4FhnoMGpK1Vm5c+E wTtAFrzb++0wnyWG9jGFFiSJGLHQB4Xa5rCr1kM+L9mtrZ9LECVxmHYKXqFqseJxA0i8 dhIdCbiPn6rMGyobo1rUxp0lygQDf5z/x6+B4=
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hello all,
I have a Coq problem:

Consider the following situation (a simplified abstraction of a program that I am working on), the development for which goes through fine:

    Parameter elt : Set.
    Parameter expr1 : nat -> bool.
    Parameter func1 : forall i:nat, option elt.

    Goal
     forall i,
      ((if (expr1 i) as b return (expr1 i = b -> bool)
        then fun X : expr1 i = true =>
          match (func1 i) with
            | Some _ => true
            | _ => false
          end
        else fun _ => false) (refl_equal _) = true) ->
      elt.
    Proof.
      intros i.
      elim (expr1 i); try (intros Habs; discriminate Habs).
      elim (func1 i); try (intros Habs; discriminate Habs).
      intros e _; exact e.
    Defined.

Basically, reasoning that if the big, complicated expression reduced to 'true' then it must have been the case that func1 produced some element, and that is exactly what is needed.


Now, however, if 'func1' depends on a proof of 'expr1', then the elim tactic no longer succeeds, I guess because of the dependencies introduced:

    Parameter elt : Set.
    Parameter expr1 : nat -> bool.
    Parameter func1 : forall i:nat, expr1 i = true -> option elt.

    Goal forall i,
      ((if (expr1 i) as b return (expr1 i = b -> bool)
        then fun X : expr1 i = true =>
          match (func1 i X) with
            | Some _ => true
            | _ => false
          end
        else fun _ => false) (refl_equal _) = true) ->
      elt.
    Proof.
      intros i.
      elim (expr1 i).

Problem: "Abstracting over the term "expr1 i" leads to a term...
                 which is ill-typed."

      (* note: func1 is opaque because this goal is actually happening
in the body of a fixpoint defined using 'Program', and func1 is
the recursive call, so it is not possible to unfold it to get rid of
the dependency on X through reduction/simplification of '(func1 i X)'.*)


Is there any way to solve the problem in the second instance?

Thanks in advance for any help/suggestions.

--- nadeem





Archive powered by MhonArc 2.6.16.

Top of Page