Answers.Body: <p>Yes, we can program in natural language.</p>
  <p>Specifications in natural language are normally neither precise nor complete. But when using a large language model like GPT-4, that is not a problem:
  The model makes assumptions for parts you did not specify.</p>
  <p>Sometimes that is good enough, but in general, you need to refine your specification until it is complete and precise enough to fit the requirements you try to express in natural language.</p>
  <p>Note that you do not need to fully understand your actual requirements from the start, you can incrementally refine them too.</p>
  <p>To illustrate it, I will give a example using GPT-4:</p>
  <p>(All prompts are shown, there is no further prompt engineering, it is zero-shot. <em>Prompt:</em> is what the programmer writes, <em>GPT-4:</em>, <em>Output:</em> is the output from the current version of the program executed as python.)</p>
  <hr />
  <p>Prompt:</p>
  <pre><code>Write a python function that can concatenate some strings, and print the result with 10 characters per line.
  </code></pre>
  <p>GPT-4:</p>
  <pre><code>def concat_and_print(strings):
      concatenated = &quot;&quot;.join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  strings = [&quot;hello&quot;, &quot;world&quot;, &quot;this&quot;, &quot;is&quot;, &quot;a&quot;, &quot;test&quot;]
  concat_and_print(strings)
  </code></pre>
  <p>Output:</p>
  <pre><code>helloworld
  thisisates
  t
  </code></pre>
  <p>Prompt:</p>
  <pre><code>I want to give the strings as args.
  </code></pre>
  <p>GPT-4:</p>
  <pre><code>def concat_and_print(*strings):
      concatenated = &quot;&quot;.join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  concat_and_print(&quot;hello&quot;, &quot;world&quot;, &quot;this&quot;, &quot;is&quot;, &quot;a&quot;, &quot;test&quot;)
  </code></pre>
  <p>Output:</p>
  <pre><code>helloworld
  thisisates
  t
  </code></pre>
  <p>Prompt:</p>
  <pre><code>add spaces
  </code></pre>
  <p>GPT-4:</p>
  <pre><code>def concat_and_print(*strings):
      concatenated = &quot; &quot;.join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  concat_and_print(&quot;hello&quot;, &quot;world&quot;, &quot;this&quot;, &quot;is&quot;, &quot;a&quot;, &quot;test&quot;)
  </code></pre>
  <p>Output:</p>
  <pre><code>hello worl
  d this is 
  a test
  </code></pre>
  <hr />
  <p>Note how the specification is not only incomplete, but also imprecise. Much less exact than natural langue could be. The specification <code>add spaces</code> does not say where the spaces should be added. Not even that they should be added to the output. It is not specified that they should be between the words, but the interpretation of it is what I meant.</p>
  <p>(This is a real chat session with GPT-4, not cherry picked or edited.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-24T10:13:50.443Z
Answers.LastActivityDate: 2023-03-24T10:13:50.443Z
Answers.UserDisplayName: Volker Siegel
Answers.Body: <p><a href="https://en.wikipedia.org/wiki/Controlled_natural_language" rel="nofollow noreferrer">Controlled Natural Language</a> (of the second type) can be used for programming, with no need to pass the Turing test.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-24T10:28:00.547Z
Answers.LastActivityDate: 2023-03-24T10:34:44.137Z
Answers.LastEditDate: 2023-03-24T10:34:44.137Z
Answers.UserDisplayName: Jaume Oliver Lafont
Answers.Body: <p>I think this is a very interesting question.  It's highly hypothetical, so my simple answer will also, necessarily, be hypothetical.</p>
  
  <ul>
  <li>If the AI can pass the Turing Test, it can be assumed it has a command of the human language(s) used in that process</li>
  </ul>
  
  <p>Self-awareness in this context would seem to be irrelevant, as would the question of whether the AI actually "understands" the content, or is merely imitating natural language.</p>
  
  <ul>
  <li>If the AI has a command of the human language(s), it would be a reasonable assumption that it could translate natural language instructions into machine code</li>
  </ul>
  
  <p>It might be best to think of the problem in the simplest terms.  If you asked this hypothetical AI to "draw a red square on the screen", it's hard to see that task as impossible, or even difficult.</p>
  
  <p>Obviously, as the instructions became more complicated, there would be a greater margin for error, and it would be useful to integrate precise, formal terms related to functions, as <a href="https://ai.stackexchange.com/a/4626/1671">Randy points out</a>. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-13T00:25:16.753Z
Answers.Text: @Bobs it depends on what the AI is being asked to do.  It might not necessarily have to code in machine language proper, for instance Python or JS or any computer code would work.  But unless it's using a computer language based on natural language, it would still have to code in code.
Answers.UserDisplayName: DukeZhou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-13T02:47:51.710Z
Answers.Text: @Bobs I suppose you could have the low-level function be autonomic, even where they had the intelligence to translate natural language into machine code, but classical computing will always be based on 1's and 0's, and even quantum computing on qbits, so there's no way to get around the the fact that any instructions are ultimately reduced to a sting, mostly likely in base-2.  On top of that, natural language is inefficient for coding, but even if it were used, it's getting translated into machine language and a binary string.
Answers.UserDisplayName: DukeZhou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-18T21:32:49.383Z
Answers.Text: @Bobs haha.  that would be awesome if someone could find a way to harness it!  Wouldn't hold my breath though
Answers.UserDisplayName: DukeZhou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-30T19:35:13.383Z
Answers.LastActivityDate: 2017-11-30T19:35:13.383Z
Answers.UserDisplayName: DukeZhou
Answers.Body: <p>No.  Humans pass the Turing Test but cannot express themselves with enough precision and little enough ambiguity to code well in English (natural language).  No machine will improve on that until it can greatly improve on human-level clarity in expressing their purpose when programming.</p>
  
  <p>Is it possible to program in natural language?  Yes, I think so.  But it would require superhuman intelligence to anticipate all the possible confusions that might arise when a word is not sufficiently precise or accurate to represent an software activity or mechanism.  This probably would require adopting a rigorous convention in choosing a subset of unambiguous words to form a "natural" programming language (a kind of creole).  Coding consistently using only those words would require discipline that exceeds the ability of most humans, methinks.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-30T18:08:45.043Z
Answers.Text: Follow up: Given its precise syntactic grammar, is Sanskrit the best candidate for natural language coding\ passing the Turing test? If not, which  language is?
Answers.UserDisplayName: Ayan Mullick
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-30T19:37:53.013Z
Answers.Text: I like this answer, but I think the the final sentence needs some clarification.  "Most humans" may be correct, but is ambiguous and hard to substantiate.  It's probably a safe assumption that programmers, technicians, engineers, scientists, etc., would be able to master this "nlp programming language".
Answers.UserDisplayName: DukeZhou
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-24T10:32:26.940Z
Answers.Text: The kind of help development environments provide, showing alternatives at the current context, might be a great help to guide humans, in a way that extreme discipline would not be required.
Answers.UserDisplayName: Jaume Oliver Lafont
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-30T16:16:57.363Z
Answers.LastActivityDate: 2017-11-30T16:24:24.207Z
Answers.LastEditDate: 2017-11-30T16:24:24.207Z
Answers.UserDisplayName: Randy
Body: <p>Technically speaking, could we code in natural language once we pass the Turing test? Would passing the Turing test at least simplify programming languages' syntax?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-02T19:47:15.567Z
Comments.Text: Looking for a quantitative answer..
Comments.UserDisplayName: Ayan Mullick
Tags: <natural-language-processing><human-like><programming-languages>
Title: Could we code in Natural language once we pass the Turing test?
UserDisplayName: Ayan Mullick
ThreadText: # Could we code in Natural language once we pass the Turing test?
  
  (Asked by: username_0 on 2017-11-30)
  
  Technically speaking, could we code in natural language once we pass the Turing test? Would passing the Turing test at least simplify programming languages' syntax?
  
  **Tags:** natural-language-processing, human-like, programming-languages
  > **Comments:**
  > **username_0**: Looking for a quantitative answer..  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2023-03-24. Score: 0 | Accepted answer
  
  Yes, we can program in natural language.
  Specifications in natural language are normally neither precise nor complete. But when using a large language model like GPT-4, that is not a problem:
  The model makes assumptions for parts you did not specify.
  Sometimes that is good enough, but in general, you need to refine your specification until it is complete and precise enough to fit the requirements you try to express in natural language.
  Note that you do not need to fully understand your actual requirements from the start, you can incrementally refine them too.
  To illustrate it, I will give a example using GPT-4:
  (All prompts are shown, there is no further prompt engineering, it is zero-shot. Prompt: is what the programmer writes, GPT-4:, Output: is the output from the current version of the program executed as python.)
  
  Prompt:
  Write a python function that can concatenate some strings, and print the result with 10 characters per line.
  
  GPT-4:
  def concat_and_print(strings):
      concatenated = "".join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  strings = ["hello", "world", "this", "is", "a", "test"]
  concat_and_print(strings)
  
  Output:
  helloworld
  thisisates
  t
  
  Prompt:
  I want to give the strings as args.
  
  GPT-4:
  def concat_and_print(*strings):
      concatenated = "".join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  concat_and_print("hello", "world", "this", "is", "a", "test")
  
  Output:
  helloworld
  thisisates
  t
  
  Prompt:
  add spaces
  
  GPT-4:
  def concat_and_print(*strings):
      concatenated = " ".join(strings)
      for i in range(0, len(concatenated), 10):
          print(concatenated[i:i+10])
  
  # Example usage
  concat_and_print("hello", "world", "this", "is", "a", "test")
  
  Output:
  hello worl
  d this is 
  a test
  
  
  Note how the specification is not only incomplete, but also imprecise. Much less exact than natural langue could be. The specification add spaces does not say where the spaces should be added. Not even that they should be added to the output. It is not specified that they should be between the words, but the interpretation of it is what I meant.
  (This is a real chat session with GPT-4, not cherry picked or edited.)
  
  
  ---
  
  ### Answer by username_2 on 2023-03-24. Score: 1
  
  [Controlled Natural Language](https://en.wikipedia.org/wiki/Controlled_natural_language) (of the second type) can be used for programming, with no need to pass the Turing test.
  
  
  ---
  
  ### Answer by username_3 on 2017-11-30. Score: 0
  
  I think this is a very interesting question. It's highly hypothetical, so my simple answer will also, necessarily, be hypothetical.
  
  * If the AI can pass the Turing Test, it can be assumed it has a command of the human language(s) used in that process
  
  Self-awareness in this context would seem to be irrelevant, as would the question of whether the AI actually "understands" the content, or is merely imitating natural language.
  
  * If the AI has a command of the human language(s), it would be a reasonable assumption that it could translate natural language instructions into machine code
  
  It might be best to think of the problem in the simplest terms. If you asked this hypothetical AI to "draw a red square on the screen", it's hard to see that task as impossible, or even difficult.
  
  Obviously, as the instructions became more complicated, there would be a greater margin for error, and it would be useful to integrate precise, formal terms related to functions, as [Randy points out](https://ai.stackexchange.com/a/4626/1671).
  
  > **Comments:**
  > **username_3**: @Bobs it depends on what the AI is being asked to do.  It might not necessarily have to code in machine language proper, for instance Python or JS or any computer code would work.  But unless it's using a computer language based on natural language, it would still have to code in code.  
  > **username_3**: @Bobs I suppose you could have the low-level function be autonomic, even where they had the intelligence to translate natural language into machine code, but classical computing will always be based on 1's and 0's, and even quantum computing on qbits, so there's no way to get around the the fact that any instructions are ultimately reduced to a sting, mostly likely in base-2.  On top of that, natural language is inefficient for coding, but even if it were used, it's getting translated into machine language and a binary string.  
  > **username_3**: @Bobs haha.  that would be awesome if someone could find a way to harness it!  Wouldn't hold my breath though  
  
  ---
  
  ### Answer by username_4 on 2017-11-30. Score: 0
  
  No. Humans pass the Turing Test but cannot express themselves with enough precision and little enough ambiguity to code well in English (natural language). No machine will improve on that until it can greatly improve on human-level clarity in expressing their purpose when programming.
  
  Is it possible to program in natural language? Yes, I think so. But it would require superhuman intelligence to anticipate all the possible confusions that might arise when a word is not sufficiently precise or accurate to represent an software activity or mechanism. This probably would require adopting a rigorous convention in choosing a subset of unambiguous words to form a "natural" programming language (a kind of creole). Coding consistently using only those words would require discipline that exceeds the ability of most humans, methinks.
  
  > **Comments:**
  > **username_0**: Follow up: Given its precise syntactic grammar, is Sanskrit the best candidate for natural language coding\ passing the Turing test? If not, which  language is?  
  > **username_3**: I like this answer, but I think the the final sentence needs some clarification.  "Most humans" may be correct, but is ambiguous and hard to substantiate.  It's probably a safe assumption that programmers, technicians, engineers, scientists, etc., would be able to master this "nlp programming language".  
  > **username_2**: The kind of help development environments provide, showing alternatives at the current context, might be a great help to guide humans, in a way that extreme discipline would not be required.  
  
  ---
  
  