Questions tagged [curry-howard]

The Curry–Howard correspondence is the direct relationship between computer programs and proofs in programming language theory and proof theory.

Curry–Howard correspondence is also known as Curry–Howard isomorphism, proofs-as-programs correspondence and formulae-as-types correspondence. It is a generalization of a syntactic analogy between systems of formal logic and computational calculi that was first discovered by the American mathematician Haskell Curry and logician William Alvin Howard.

Source http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence

43 questions
6
votes
1 answer

Curry's paradox in Haskell?

Curry's paradox (named after the same person as the present programming language) is a construction possible in a faulty logic that allows one to prove anything. I know nothing about logic, but how hard can it be? module Main where import…
Ignat Insarov
  • 4,660
  • 18
  • 37
6
votes
3 answers

Is it possible to randomly generate theorems that are arbitrarily difficult to prove?

If I understand Curry-Howard's isomorphism correctly, every dependent type correspond to a theorem, for which a program implementing it is a proof. That means that any mathematical problem, such as a^n + b^n = c^n can be, somehow, expressed as a…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
5
votes
1 answer

CoNat : proving that 0 is neutral to the left

I am experimenting with the definition of CoNat taken from this paper by Jesper Cockx and Andreas Abel: open import Data.Bool open import Relation.Binary.PropositionalEquality record CoNat : Set where coinductive field iszero : Bool …
Dave
  • 147
  • 5
5
votes
2 answers

How to prove the principle of explosion (ex falso sequitur quodlibet) in Scala?

How do I show that anything follows from a value of a type with no constructors in Scala? I would like to do a pattern match on the value and have Scala tell me that no patterns can match, but I am open for other suggestions. Here is a short example…
DrPhil
  • 377
  • 1
  • 12
5
votes
1 answer

I can't get my GADT-based toy Dynamic type to work with parametric types

So in order to help me understand some of the more advanced Haskell/GHC features and concepts, I decided to take a working GADT-based implementation of dynamically typed data and extend it to cover parametric types. (I apologize for the length of…
Luis Casillas
  • 29,802
  • 7
  • 49
  • 102
4
votes
1 answer

Agda – difference between type args on the left and right side of the colon

Following definition compiles and behaves well: data Eq {lvl} {A : Set lvl} (x : A) : A → Set where refl : Eq x x However this one does not compile: data Eq {lvl} {A : Set lvl} (x : A) (y : A) : Set where refl : Eq x x because x != y of type…
radrow
  • 6,419
  • 4
  • 26
  • 53
4
votes
0 answers

Understanding Curry-Howard Isomorphism exercise from Thinking With Types

I've begun reading the book Thinking With Types which is my first foray into type level programming. The author provides an exercise and the solution, and I cannot understand how the solution provided is correct. The exercise is I attempted to…
4
votes
1 answer

Can I tell GHC to arbitrarily select which instance to use, because I don't care?

I have some code like this: {-# OPTIONS_GHC -Wall #-} {-# LANUAGE VariousLanguageExtensionsNoneOfWhichWorked #-} import Control.Applicative import Data.Either import Data.Void class Constructive a where lem :: Either (a -> Void) a instance…
PyRulez
  • 10,513
  • 10
  • 42
  • 87
3
votes
1 answer

Why do Leans `Prop`ositions get special treatment?

A question is nagging me since I began going through the interactive Lean tutorial: What is the purpose of the separate Prop hierarchy within Type? As I understand it now, we have the following universe hierarchy in place: Type (n+1) | \ | …
Sebastian Graf
  • 3,602
  • 3
  • 27
  • 38
2
votes
1 answer

Could not deduce SingI of predecessor Nat

I am trying to write a weaken function for finite sets of integers. I am using the singletons package. I have defined and promoted addition, subtraction and predecessor functions, as well as proved some equations on them to help the type-checker.…
denormal
  • 273
  • 1
  • 8
2
votes
2 answers

De Morgan's Laws in Haskell via the Curry-Howard Correspondence

I implemented three of the four De Morgan's Laws in Haskell: notAandNotB :: (a -> c, b -> c) -> Either a b -> c notAandNotB (f, g) (Left x) = f x notAandNotB (f, g) (Right y) = g y notAorB :: (Either a b -> c) -> (a -> c, b -> c) notAorB f = (f .…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
2
votes
2 answers

Curry Howard correspondence and equality

A while ago I read that the function type a -> b corresponds to the relation a ≤ b, or is it a ≥ b? This makes sense to me because two types are isomorphic if we have a bijection between them (i.e. (a ≈ b) ≡ (a -> b, b -> a)). Similarly, (a = b) ≡…
2
votes
1 answer

How to encode the axiom of choice in Haskell/Functional programming?

> {-# LANGUAGE RankNTypes #-} I was wondering if there was a way to represent the axiom of choice in haskell and/or some other functional programming language. As we know, false is represented by the type with no values (Void in haskell). > import…
PyRulez
  • 10,513
  • 10
  • 42
  • 87
2
votes
1 answer

Is there a Scala function of type `Nothing => A`? Or how to construct one?

Through Curry-Howard isomorphism Scala's Unit corresponds to logical true and Nothing to logical false. The fact that logical true is implied by anything is witnessed by a simple function that just discards the argument: def toUnit[A](x: A): Unit =…
Petr
  • 62,528
  • 13
  • 153
  • 317
1
vote
2 answers

Can a compiler prove theorems?

I've read about the Curry-Howard Correspondence. If I got it right, it says that there is a correspondence such that propositions in propositional logic correspond to types, and the proposition is true if the type is inhabited. That a type is…