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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:52:33+00:00 2026-06-14T23:52:33+00:00

id is the only function of type a -> a , and fst the

  • 0

id is the only function of type a -> a, and
fst the only function of type (a,b) -> a. In these simple cases, this is fairly straightforward to see. But in general, how would you go about proving this? What if there are multiple possible functions of the same type?

Alternatively, given a function’s type, how do you derive the unique (if this is true) function of that type?

Edit: I’m particularly interested in what happens when we start adding constraints into the types.

  • 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-14T23:52:35+00:00Added an answer on June 14, 2026 at 11:52 pm

    The result you are looking for derives from Reynolds’ parametricity, and was most famously shown by Wadler in theorems for free.

    The most elegant way of proving basic parametricity results I have seen use the notion of a “Singleton Type”. Essentially, given any ADT

    data Nat = Zero | Succ Nat
    

    there exists an indexed family (also known as a GADT)

    data SNat n where
       SZero :: SNat Zero
       SSucc :: SNat n -> SNat (Succ n)
    

    and we can give a semantics to our language by “erasing” all the types to an untyped language such that Nat and SNat erase to the same thing. Then, by the typing rules of the language

    id (x :: SNat n) :: SNat n
    

    SNat n has only one inhabitant (its singleton), since the semantics is given by erasure, functions can not use the type of their arguments, so the only value returnable from id on any Nat is the number you gave it. This basic argument can be extended to prove most of the parametricity results and was used by Karl Crary in A Simple Proof Technique for Parametricity Results although the presentation I have here is inspired by Stone and Harper

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

Sidebar

Related Questions

<?php $a="php.net s earch for in the all php.net sites this mirror only function
This function only works once, when I click an anchor element again, nothign happens.
I'm trying to print the output of function only when it is true but
I would like to activate a .mouseover function only if the mouse lays down
Sometimes this function can be called too quickly and multiple elements are created but
The tabexpansion function only works partially when I override it like so: function tabexpansion
the following javascript function only seems to work when i have the final confirm()
I had only one function to Add another row to the table id=tblOtherParties and
For some reason my galleryScroll() function only runs once, even though the function calls
I'm having some trouble trying running a function only once when onresize event is

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.