0

I have some equalities (=) and unequalities (<>) in the hypotheses such as:

e : x2 = x1
n : x3 <> x1

I want to use tactics like assumption, but sometimes the expected (un)equality in the goal is in the other direction like:

x1 = x2
x1 <> x3

My question is:

Is it possible to automatically introduce the symmetric forms of (un)equality above into the hypotheses?

If not, is it possible to use Notation to write a tactical to do this.

So far, I can do this manually like this:

assert (x1 = x2) by (symmetry in e; assumption).

assert (x1 <> x3) by (unfold not; intro Hnot; 
  symmetry in Hnot; unfold not in n; apply n in Hnot; inversion Hnot). 

But it is really tedious and noisy. I don't know enough about how to automate this or if there is a better way.

4

1 回答 1

1

也许这种策略可以帮助:

Ltac maybe_intro_sym A B :=
  match goal with
    |[H:B=A|-_] => fail 1
    |[H:A=B|-_] => assert (B=A) by auto
  end.

Ltac maybe_intro_sym_neg A B :=
  match goal with
    |[H:B<>A|-_] => fail 1
    |[H:A<>B|-_] => assert (B<>A) by auto
  end.

Ltac intro_sym :=
  repeat match goal with
    |[H:?A=?B|-_] => maybe_intro_sym A B
    |[H:?A<>?B|-_] => maybe_intro_sym_neg A B
  end.

这是一个例子:

Parameters a b c d:nat.
Goal a=b -> c=d -> c<>d -> True.
intros.
intro_sym.

现在的上下文是

  H : a = b
  H0 : c = d
  H1 : c <> d
  H2 : d = c
  H3 : b = a
  H4 : d <> c
  ============================
   True
于 2015-11-27T20:10:47.573 回答