A code answer can look plausible while leaving edge cases or proof obligations unexamined. The archived LCS example contrasts a short baseline request with a prompt that asks for multiple candidate approaches, step-by-step checks and adversarial counterexamples.
The method is described as Self-Consistent Chain of Verification with Adversarial Counterexample Generation. The archive records one example and an 88/100 editorial score, but no rubric, model/version, sampling settings or complete output is preserved.
The Practical Prompt
You are a senior software engineer and logic verifier. Solve the following problem using a three-phase process:
Problem: Write a Python function `longest_common_subsequence(a, b)` that returns the longest common subsequence of two strings. Then, prove that your function is correct for all inputs.
Phase 1: Generate three independent solutions using different algorithmic approaches (e.g., dynamic programming, recursion with memoization, and a greedy approach if possible). For each, provide the code and a brief explanation.
Phase 2: For each solution, perform a step-by-step verification of its logic. Identify any assumptions, potential off-by-one errors, or edge cases (e.g., empty strings, repeated characters, different lengths).
Phase 3: Adversarially test each solution by constructing at least three specific input pairs that could break it. For each, explain why the solution might fail and whether it actually does. Then, select the most robust solution and provide a final corrected version if needed. Finally, state your confidence level (0-100%) that the final function is correct for all possible inputs, and justify it.
Output your complete reasoning and final code.Archived example
The archive describes a baseline response that stopped mid-backtracking and did not include visible edge-case analysis. A later response is described as proposing bottom-up dynamic programming, memoized recursion and a greedy alternative, then discussing counterexamples such as a="abc" and b="acb".
This is a description of generated text, not evidence that code was executed or that the proposed implementation passed tests. The complete code, model details and raw outputs are not preserved.
What the prompt asks for
- Multiple candidates: Ask for different approaches and compare their assumptions; they may still share blind spots.
- Counterexamples: Ask the model to propose inputs that could break each approach, then run those cases in an executable test suite.
- Uncertainty statement: Ask for reasons and limitations, but do not treat a numeric confidence score as calibrated without outcome data.
The structure can make a proposal easier to inspect, but executable tests and independent review remain necessary. A prompt alone does not verify code or guarantee correctness.
Use it as a checklist for test design and review when edge cases matter; do not substitute the generated explanation for running the code.