Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:33:57+00:00 2026-06-06T10:33:57+00:00

Trying to prove correctness of a insertion function of elements into a bst I

  • 0

Trying to prove correctness of a insertion function of elements into a bst I got stuck trying to prove a seemingly trivial lemma.
My attempt so far:

Inductive tree : Set :=
| leaf : tree
| node : tree -> nat -> tree -> tree.    

Fixpoint In (n : nat) (T : tree) {struct T} : Prop :=
  match T with
  | leaf => False
  | node l v r => In n l \/ v = n \/ In n r
  end.

(* all_lte is the proposition that all nodes in tree t 
   have value at most n *)  
Definition all_lte (n : nat) (t : tree) : Prop :=
  forall x, In x t -> (x <= n).

Lemma all_lte_trans: forall n m t, n <= m /\ all_lte n t -> all_lte m t.
Proof.
intros.
destruct H.
unfold all_lte in H0.
unfold all_lte.
intros.

Clearly if everything in the tree is smaller than n and n <= m everything is smaller than m, but I cannot seem to make coq believe me. How do I continue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:34:04+00:00Added an answer on June 6, 2026 at 10:34 am

    You have to use the le_trans theorem :

    le_trans: forall n m p : nat, n <= m -> m <= p -> n <= p
    

    that comes from Le package.
    It meas that you have to import Le or more generally Arith with :

    Require Import Arith.
    

    at the beginning of your file. Then, you can do :

    eapply le_trans.
    eapply H0; trivial.
    trivial.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to simply prove here that this simple function isn't good enough to
I'm trying to prove a simple lemma in Agda, which I think is true.
Simple case of trying to prove I can convert NSString to NSDate . Create
I'm trying to prove the statement ~(a->~b) => a in a Hilbert style system.
I'm trying to prove that changing document.domain can be used only for cross scripting
im trying to prove if there exists a object with a particular status in
I am trying to prove something, and I'm not sure if my math is
I am trying to catch the bad_alloc exception in order to prove that the
I'm trying to use heterogenous equality to prove statements involving this indexed datatype: data
We're trying to implement a quick prototype to prove something is possible with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.