-1

I need to prove that the height of a formula's tree is always less than the number of nodes of the same tree, but I got stuck after the assumption and don't know how to proceed. Can somebody help me fill the "admit." spaces?

Require Import String.
Require Import Init.Nat.
Require Import PeanoNat.
Require Import Plus.
Require Import Le.

Theorem le_plus_trans2 : forall n m p, (n <= m) -> (n <= p + m).

Proof.
 intros n m p.
 intros x.
 apply le_trans with (m:= m).
 assumption.
 admit.
Qed.
Anton Trunov
  • 15,074
  • 2
  • 23
  • 43
Rafael Santos
  • 39
  • 1
  • 6
  • Please remove "using induction" in the title of the question, so that it can be useful to other people. – Yves Jun 25 '18 at 05:52

2 Answers2

3

If you Require Import Coq.omega.Omega, you can replace all of your admits with omega.

Alternatively, if you want a less hammer-ful solution, you can replace your admits with

 etransitivity; [ eassumption | apply le_plus_l || apply le_plus_r ].

That is, you can use the fact that x <= x + y and that y <= x + y, for x : nat and y : nat.

Edit (after your update of the question). Your question now contains a completely different goal, but this goal can still be solved by the standard arithmetic hammer. If you Require Import Coq.omega.Omega, your entire theorem is proven by intros; omega.

Jason Gross
  • 5,928
  • 1
  • 26
  • 53
  • I found a way using le_plus_trans, using the fact that as k1 <= x, k1 <= x + y. But know I need k2 <= x + y, knowing that k2 <= y. For that I created the le_plus_trans2 theorem, but still need to prove the last part xD – Rafael Santos Jun 25 '18 at 01:27
  • 1
    It's poor form to replace your question with a different one after the question has already been answered. However, I've updated my answer with the standard solution to all problems of this form: `omega`. – Jason Gross Jun 25 '18 at 01:39
  • 1
    Also, did you read my original answer? The goal you have remaining is exactly the theorem statement `le_plus_r`, which I mention in my answer. – Jason Gross Jun 25 '18 at 01:40
  • I'm sorry for changing it, it's just that my main goal is to complete the whole proof. I read it, but I misread the "definition" of le_plus_r, so that's why I'm confused. Anyway, thank you very much for your help and time! – Rafael Santos Jun 25 '18 at 01:50
  • No worries. I think the general etiquette on StackOverflow is to post separate questions if a complete answer to the question you posted leaves you with new questions. – Jason Gross Jun 25 '18 at 18:09
1

Try using Plus.le_plus_trans and PeanoNat.Nat.add_comm.

Ifaz Kabir
  • 134
  • 8