0

I am trying to prove the pumping Lemma (which is one of the exercises of the Logical Foundations book). I thought I had completed the MStarApp case but the interpreter tells me that there are still unfocused goals remaining. Only I can't bring this remaining goal to the front. I tried every bullet level but each time I get [Focus] Wrong bullet: No more goals. I don't know if something is wrong with my proof or if it's a bug in the interpreter. Any help would be much appreciated.

- (* MStarApp *)
    intros.
    destruct s1.
    -- replace ([ ] ++ s2) with s2 in *. apply (IH2 H).
       reflexivity.
    -- pose proof (lt_ge_cases (length (x::s1)) (pumping_constant re)) as [
    Hs1lt | Hs1ge].
      --- exists [ ], (x::s1), s2. repeat split.
        + unfold not. intro. inversion H0.
        + simpl. simpl in Hs1lt. 
          apply n_lt_m__n_le_m in Hs1lt.
          apply Hs1lt.
        + simpl. intro m. 
          apply (napp_star T m (x::s1) s2 re Hmatch1 Hmatch2).
      --- unfold ge in Hs1ge. pose proof (IH1 Hs1ge) as [
        s2' [s3' [s4' [Hxs1Eq [Hs3notEmpty [
        Hlens2's3' Hnapp]]]]]].
        exists s2', s3', (s4' ++ s2). repeat split.
        + rewrite Hxs1Eq. repeat rewrite <- app_assoc.
          reflexivity.
        + assumption.
        + simpl. assumption.
        + intro m. pose proof Hnapp m.
          replace (s2' ++ napp m s3' ++ s4' ++ s2) with 
          ((s2' ++ napp m s3' ++ s4') ++ s2).
          constructor.
          ++ assumption.
          ++ assumption.
          ++ repeat rewrite <- app_assoc. reflexivity.
(* 'There are unfocused goals.' *)

Edit: I don't know if this is relevant, but higher in my proof (in the MApp case) I have an assert whose closing curly bracket is highlighted in an unusual way (in yellow instead of green -- I am using the Coq language support extension in VSCode).

unusual highlighting

user566206
  • 47
  • 4
  • 1
    I would guess that the issue is an existential variable that has not been properly solved, but is not displayed as a goal. You can try using [Unshelve or unshelve](https://coq.inria.fr/refman/proofs/writing-proofs/proof-mode.html#coq:cmd.Unshelve) to see what this variable is. If you want more debugging and/or a better explanation, please post code that we can run through (ideally, somewhat minimized, but that is not necessary) so that we can check what happens in more details. – Meven Lennon-Bertrand Jul 08 '22 at 08:33
  • Have you `admit`ed any of the previous goals? – larsr Jul 08 '22 at 08:40
  • 1
    The proof goes through just fine if I create a lemma strictly for that proof branch, so the unproven goals must come from some of the other branches. – larsr Jul 08 '22 at 08:49

1 Answers1

1

You have unfinished business in some of the earlier proof branches. The one you are providing does not have any unfinished goals. You have left unfinished or admited some of the earlier goals. Or probably you didn't finish the assert properly. You need to show that part of the proof if you want help with that.

This is the proof state where your proof begins, and it is solved by your proof script.


Lemma foo   
(T: Type)
(s1 s2: list T)
(re: reg_exp T)
(Hmatch1: s1 =~ re)
(Hmatch2: s2 =~ Star re)
(IH1: pumping_constant re <= length s1 ->
      exists s2 s3 s4 : list T,
        s1 = s2 ++ s3 ++ s4 /\
        s3 <> [ ] /\
        length s2 + length s3 <= pumping_constant re /\
        (forall m : nat, s2 ++ napp m s3 ++ s4 =~ re))
(IH2: pumping_constant (Star re) <= length s2 ->
      exists s1 s3 s4 : list T,
        s2 = s1 ++ s3 ++ s4 /\
        s3 <> [ ] /\
        length s1 + length s3 <= pumping_constant (Star re) /\
        (forall m : nat, s1 ++ napp m s3 ++ s4 =~ Star re))
:
pumping_constant (Star re) <= length (s1 ++ s2) ->
exists s0 s3 s4 : list T,
  s1 ++ s2 = s0 ++ s3 ++ s4 /\
  s3 <> [ ] /\
  length s0 + length s3 <= pumping_constant (Star re) /\
  (forall m : nat, s0 ++ napp m s3 ++ s4 =~ Star re)
.
larsr
  • 5,447
  • 19
  • 38
  • That was it! My `assert` in the `MApp` case was not properly finished and I didn't noticed it. Thank you so much for your help, much appreciated :-) – user566206 Jul 08 '22 at 16:19