Skip to content

Instantly share code, notes, and snippets.

@neubig
Last active August 29, 2015 13:57
Show Gist options
  • Save neubig/9905393 to your computer and use it in GitHub Desktop.
Save neubig/9905393 to your computer and use it in GitHub Desktop.
This is a program that answers the age-old problem of whether P=NP
#!/usr/bin/python
################################################################################
# pequalnp.py
# Graham Neubig
# 4/1/2014
#
# This is a program that provides an answer for the age-old problem of whether
# the class of problems that can be verified in polynomial time (NP) is equal
# to the class of problems for which an answer can be provided in polynomial
# time (P). This is one of the most major unsolved problems in computer
# science.
#
# This program is based on the Curry-Howard isomorphism, which provides a
# direct relationship between computer programs and mathematical proofs.
# Using this correspondence, mathematical proofs can be expressed as programs,
# which has led to a number of applications in automatic theorem proving and
# assisted theorem proving.
#
# This program consists of two parts.
# The first part is the representation of the theorem in a computer readable
# format. In this case, we take a simple, natural-language representation of
# the theorem.
#
# The second is the "answer" function, which is in a way, an automatic theorem
# prover (or more accurately investigator). Given a theorem to prove in the
# appropriate format, it will perform computation, and return an answer
# regarding whether the theorem can be proven. If the function returns the
# answer "Yes." we will know that the theorem is true, and we can investigate
# the program that was used to generate the proof. Conversely, if the function
# returns the answer "No." we will know that the theorem is false, and we can
# examine the program used to generate the proof of falsity.
#
# OK, enough with the explanation, here is the program!
################################################################################
##### Part 1: Theorem definition
pequalnp_definition = """
Let P be the class of problems that can be solved in polynomial time.
Let NP be the class of problems for which the answer can be verified in
polynomial time.
Is P == NP?
"""
##### Part 2: Theorem investigation function
def answer(x):
return 'Probably Not!'
##### Part 3: Go!
print pequalnp_definition
print answer(pequalnp_definition)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment