0

I want to prove this :

1 subgoals
x : nat
y : nat
z : nat
______________________________________(1/1)
x + y - z = x + (y - z)

It looks trivial, but it confuse me a lot, and I need it for another proof.

Thanks.

Anton Trunov
  • 15,074
  • 2
  • 23
  • 43
Moody
  • 25
  • 6

1 Answers1

4

What you're trying to prove doesn't hold if y <= z, because with nat a-b is zero if a <= b.

Omega is a useful tactic to use for inequalities and simple arithmetic over nat.

Require Import Omega.
Theorem foo:
    forall x y z:nat, (x = 0 \/ z <= y) <->  x + y - z = x + (y - z).
    intros; omega.
Qed.

However, your identity of course holds for the integers Z.

Require Import ZArith.
Open Scope Z.
Theorem fooZ:
    forall x y z:Z, x + y - z = x + (y - z).
    intros; omega.
Qed.
larsr
  • 5,447
  • 19
  • 38