Last active
January 12, 2020 11:03
-
-
Save seankearon/dbbd257b52e0fb0951318366db0bbf79 to your computer and use it in GitHub Desktop.
Curry-Howard Exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (A => B and not B) => not A | |
Not<A> ModusTollens<A, B>( | |
Func<A, B> A_implies_B, | |
Not<B> not_B) | |
{ | |
Absurd A_to_Absurd(A a) | |
{ | |
return not_B.Apply(A_implies_B(a)); | |
} | |
return new Not<A>(A_to_Absurd); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (A => B and B => C) => A => C | |
Func<A, C> Syllogism<A, B, C>( | |
Func<A, B> A_implies_B, | |
Func<B, C> B_implies_C) | |
{ | |
C Composed(A a) | |
{ | |
return B_implies_C(A_implies_B(a)); | |
} | |
return Composed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment