Infinite primes (Shakespeare)
creative proof prompt example
TL;DR(中文)
- 这是一个 “数学证明 + 风格写作” 的
creativity测试:在保持 proof 核心逻辑的同时,用 Shakespeare dialogue 的形式表达。 - 适合用于:风格迁移、长文本结构控制、以及在强约束下生成连贯内容。
- 关键风险:风格到位但 proof 逻辑错;建议要求输出中显式包含关键步骤(例如 Euclid-style construction),并用
evaluation检查逻辑完整性。
Background
The following prompt tests an LLM's capabilities to write a proof that there are infinitely many primes in the style of a Shakespeare play.
How to Apply(中文)
把这个 prompt 用在类似任务时,可以把约束拆成两层:
- Content constraints:必须包含哪些核心论证步骤(proof skeleton)
- Style constraints:用什么 voice、结构、修辞(dialogue, stage directions)
例如对数学 proof,可以先要求模型输出一个简短的 proof outline(英文术语保留),再让它把 outline 改写成特定风格。
How to Iterate(中文)
- 强制包含关键 proof step(例如 “construct N = p1p2...*pk + 1”)
- 增加结构:每个角色负责一个步骤(setup → contradiction → conclusion)
- 加
self-check:最后用 3-5 行总结 proof 的逻辑链(避免风格掩盖错误) - 控制长度:指定 acts/scenes 或 token budget
Self-check rubric(中文)
- proof 是否完整且无明显逻辑漏洞?
- dialogue 是否保持 Shakespeare style(一致的 voice)?
- 是否能把数学步骤表达清楚(读者可复核)?
- 是否避免引入不相关的分支与跑题?
Practice(中文)
练习:把同一个 proof skeleton 分别改写成 3 种风格:
- Shakespeare dialogue
- courtroom cross-examination
- a children’s story
然后用同一个 rubric 检查 proof 是否仍然成立。
Prompt
Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.
Code / API
OpenAI (Python)
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[
{
"role": "user",
"content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.",
}
],
temperature=1,
max_tokens=1000,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
)
Fireworks (Python)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
"role": "user",
"content": "Write a proof of the fact that there are infinitely many primes; do it in the style of a Shakespeare play through a dialogue between two parties arguing over the proof.",
}
],
stop=["<|im_start|>", "<|im_end|>", "<|endoftext|>"],
stream=True,
n=1,
top_p=1,
top_k=40,
presence_penalty=0,
frequency_penalty=0,
prompt_truncate_len=1024,
context_length_exceeded_behavior="truncate",
temperature=0.9,
max_tokens=4000,
)