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 8889707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:19:38+00:00 2026-06-14T22:19:38+00:00

I am trying to define the predecessor function for binary natural numbers (lists of

  • 0

I am trying to define the predecessor function for binary natural numbers (lists of bits). I want to restrict the input of my function to numbers that are trimmed (do not have leading zeros) and that are positive (So, I do not have to worry about the predecessor of zero).

Here is the definition of the operator pred:

Program Fixpoint pred (nat1: Nat) (H1: is_trim nat1 = True) (H2: is_pos nat1 H1 = True): Nat :=
  match nat1 with
  | Empt => _
  | Fill Zer nat2 => Fill One (pred nat2 H1 H2)
  | Fill One nat2 => Fill Zer nat2
  end.

My first obligation is as follow:

nat1: Nat
H1: is_trim nat1 = True
H2: is_pos nat1 H1 = True
H3: Empt = nat1
______________________________________(1/1)
Nat

But, I do not know how to solve it.

The contradiction is obviously in H2. But, because it depends on H1, I cannot just rewrite nat1 with Empt and then (is_pos Empt H1) with False.

How should I prove this ?

  • 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-14T22:19:39+00:00Added an answer on June 14, 2026 at 10:19 pm

    This goal is indeed trivial in that you can return any natural number for the Empt case, and rest assured that nobody can reach that number because they first have to pass in a proper H2 : is_pos nat1 H1.

    I believe the next “correct” way to solve such a thing is to use a dependent pattern-matching, in the lines of:

    Program Fixpoint pred (nat1: Nat) (H1: is_trim nat1 = True) (H2: is_pos nat1 H1 = True): Nat :=
      match nat1 as nat1' return is_pos nat1' H1 -> Nat with
      | Empt => fun isposEmpt =>
          (* hopefully, is_pos Empt H1 immediately reduces to False, and you can do this: *)
          False_rec Nat isposEmpt
      | Fill Zer nat2 => fun _ => Fill One (pred nat2 H1 H2)
      | Fill One nat2 => fun _ => Fill Zer nat2
      end H2.
    

    That is, you require a proof that nat1 is positive as an argument of your match, and you conclude in the Empt case that the proof is bogus, so you can return bogus too.

    Hopefully this works and makes some sense. Please provide the necessary definitions next time to help people play with your example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to define a function in Haskell that takes an integer argument c
I'm trying to define a function that will allow me to get a value
when trying to define a function that would remove the largest subset of set
I'm trying to define a method in my vb.net interface that will only accept
I am trying to define an abstract class that has operators to compare two
I'm trying to define a very simple function in Drools as below: import java.util.List;
I'm trying to define a service endpoint in my web.config file so that I
I'm trying to define a predicate where it searches a list of lists for
I'm trying to define a task that emits (using echo) a message when a
I am trying to define a WCF contract that returns an interface, something like

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.