7

I have two hypotheses

IHl: forall (lr : list nat) (d x : nat), d = x \/ In x l' -> (something else)
Head : d = x

I want to apply IHl on Head as it satisfies d = x \/ In x l of IHl. I tried apply with tactic which fails with a simple hint Error: Unable to unify.

Which tactic should I use to instantiate variables in a hypothesis?

Peeyush Kushwaha
  • 3,453
  • 8
  • 35
  • 69
xywang
  • 941
  • 8
  • 24

1 Answers1

10

Your hypothesis IHl takes 4 arguments: lr : list nat, d : nat, x : nat, and _ : d = x \/ In x l'.

Your hypothesis Head : d = x does not have the proper type to be passed as the 4th argument. You need to turn it from a proof of equality into a proof of a disjunction. Fortunately, you can use:

or_introl
     : forall A B : Prop, A -> A \/ B

which is one of the two constructors of the or type.

Now you might have to pass explicitly the B Prop, unless it can be figured out in the context by unification.

Here are things that should work:

(* To keep IHl but use its result, given lr : list nat *)
pose proof (IHl lr _ _ (or_introl Head)).

(* To transform IHl into its result, given lr : list nat *)
specialize (IHl lr _ _ (or_introl Head)).

There's probably an apply you can use, but depending on what is implicit/inferred for you, it's hard for me to tell you which one it is.

Ptival
  • 9,167
  • 36
  • 53
  • 1
    Both of them work. Thanks! The `pose` one will leave IHl intact and place a new hypothesis while `specialize` will directly work on IHl and replace it with the result. – xywang Jul 21 '15 at 01:11