1

After some work on an exercise, I've reached the following proof state:

(tail1 is a nat list pattern generator, lng is generalized)

1 subgoal
n' : nat
IH_n' : forall lng : nat, lng > n' -> nth n' (update (tail1 lng) 0 1) 9 = 1
lng : nat
H : S lng > S n'
______________________________________(1/1)
nth (S n') (update (tail1 (S lng)) 0 1) 9 = 1

Using apply IH_n' fails with the following error:

Unable to unify "nth n' (update (tail1 ?M1305) 0 1) 9 = 1" with "nth (S n') (update (tail1 (S lng)) 0 1) 9 = 1".

  • Is it the ?M1305 - (S lng) pair that can't be unified?
  • What is ?M1305 exactly?
  • Is it possible to move forward from here?
Mike Doe
  • 16,349
  • 11
  • 65
  • 88
Attila Karoly
  • 951
  • 5
  • 13

2 Answers2

1

The problem here is that you are trying to apply an hypothesis on n' for S n', whereas n' is not quantified in IH_n'.

It would only work if your hypothesis was:

IH_n' : forall n' lng : nat, lng > n' -> nth n' (update (tail1 lng) 0 1) 9 = 1

To answer your other question, ?_ is the existential variable which would be replaced if your hypothesis was applicable, because the variable lng is quantified in the hypothesis.

If you want some help on how to prove this goal, could you share the code please ? (even though I think you should do unfold nth, update; simpl to see if you can apply your hypothesis somewhere.

Lucien David
  • 310
  • 2
  • 9
  • Lucien, thanks for your reply. Here's what I have so far: x80.org/collacoq/bimaxobehu.coq tail1 produces 011... sequences and my original intent is to prove that each item is 1 following the leading 0. After some effort I decided to update the sequence so that it's all 1s, however, I still can't solve it and it's likely not an easier way. I'd appreciate any further help. – Attila Karoly Jun 10 '20 at 15:05
1

Hypothesis IH_n' is universally quantified by lng:nat. To apply it to the goal, Coq needs to instantiate it. ?M1305 is the name it gives to the value of lng it has yet to find.

The error message does not necessarily mean that ?M1305 and (S lng) cannot be unified. The issue might come from elsewhere. For example, your goal starts with nth (S n'), while the hypothesis starts with nth n'. Obviously, (S n') and n' cannot be unified.

Your first step, assuming the goal is provable, is to make sure it starts with nth n'. To do so, you need the second argument of nth to be of the form (cons foo bar).

Guillaume Melquiond
  • 1,243
  • 4
  • 11