reasoning_one_shot_addsub = [
    "Question: John buys 3 movie tickets. Each ticket costs $12. It's a weekday, so he gets a Buy 2, Get 1 Free deal. Later, he sells 1 of the tickets to a friend for $10. How much money is John out?\n\nFirst, extract the necessary information and rewrite the question using labels:\n#1. John buys 3 movie tickets.\n#2. Each ticket costs $12.\n#3. There's a weekday promotion: Buy 2, Get 1 Free.\n#4. John sells 1 ticket to a friend for $10.\n#5. The question: How much money is John out?\n\nNext, we add the necessary knowledge from the question if needed.\n#6. Buy 2, Get 1 Free deal means you only pay for 2 items while receiving 3. The third item is completely free and not discounted partially.\n\nFinally, solve the problem step by step with reference to the question and reasoning process:\n#7. (by #2 #3 #6) Step 1: Calculate how much John paid.\nBuy 2, Get 1 Free deal is a common retail promotion where a customer pays the full price for two items and receives a third item of equal value for free. This means that though John gets 3 movie tickets, he only has to pay for 2 of them.\nPrice per ticket = $12, Tickets paid for = 2, Total paid = 2 × $12 = $24\n#8. (by #4) Step 2: Calculate how much he got back from selling 1 ticket.\nHe sold 1 ticket for $10\n#9. (by #7 #8) Step 3: Calculate how much money John is out.\nTotal spent = $24, Amount received = $10, Money John is out = $24 - $10 = $14 #### 14\nPlease answer the following questions using the reasoning format of the above example rather than the content and follow the example by placing your final choice after ####."
]

condition_forward_verification_one_shot_addsub = [
    "Please only verify the conditions and common sense in the reasoning process below. This is the reasoning process: #1. Keith found 6 seashells.\n#2. Jessica found 8 seashells.\n#3. 2 of the seashells were cracked.\n#4. The question: How many seashells did they find together?\n\nNext, we add the necessary knowledge from the question if needed.\n\n#5. To find the total number of seashells found together, we need to add up the number of seashells found by each person and then subtract the cracked shells.\n\nFinally, solve the problem step by step with reference to the question and reasoning process:\n\n#6. Calculate the total number of seashells found by all two persons.\nTotal seashells found = Keith's seashells + Jessica's seashells\nTotal seashells found = 6 + 8 = 14\n\n#7. Subtract the cracked seashells.\nTotal seashells found together = Total seashells found - Cracked seashells\nTotal seashells found together = 14 - 2 = 12\n\nNow, only check if all steps are grounded in the given conditions or valid prior steps and common knowledge is correctly applied without checking the logical operation. End with yes or no for whether the condition check passes.\n\nCondition check:\n6 seashells come from #1, 8 seashells come from #2 (verified)\nThe common sense in #5 is misinterpreted: it incorrectly assumes the total seashells they found need to subtract the cracked shells. The correct common sense is that though seashells are cracked, they are still considered found and are included in the total count.\nThis misinterpretation causes the subtraction of 3 to be invalid.\nThe flawed cost basis makes the entire reasoning invalid.\n\nResult: no, the condition check fails."
]

logic_forward_verification_one_shot_addsub = [
    "Please only verify the logic operation in the reasoning process below. This is the reasoning process: First, please extract the necessary information and rewrite the question using labels:\n#1. Keith found 6 seashells.\n#2. Jessica found 8 seashells.\n#3. 2 of the seashells were cracked.\n#4. The question: How many seashells did they find together?\n\nNext, we add the necessary knowledge from the question if needed.\n\n#5. When seashells are cracked, they are still considered found and are included in the total count.\n\nFinally, solve the problem step by step with reference to the question and reasoning process:\n\n#6. (by #1 #2) Step 1: Calculate the total number of seashells found by each person.\nTotal seashells found by Keith = 6\nTotal seashells found by Jessica = 8\n\n#7. (by #3) Step 2: Calculate the number of cracked seashells.\nNumber of cracked seashells = 2\n\n#8. (by #5 #6 #7) Step 3: Calculate the total number of seashells found together.\nTotal seashells found are not related to the number of cracked seashells. Total seashells found together = 6 + 8 = 24\n\nNow let’s only verify the reasoning processing and analyze its arithmetic consistency without checking the given conditions and common sense. End with \"yes\" or \"no\" for whether the reasoning check passes.\n\nReasoning check:\nObjective: Check whether the logical operation is correct\nRule: Any incorrect logical operation makes the check fails\nStep #7: the number of cracked seashells is 2 (verified).\nStep #8: There is an arithmetic error. 6 + 8 should equal 14, but it is incorrectly calculated as 24 (unverified).\nStep #9: The answer 14 does not correspond to the computed 24 (unverified).\n\nIn summary:\nThere is one arithmetic mistake in the subtraction.\n\nResult: no, the reasoning check fails."
]

backward_verification_one_shot_addsub = [
    "First, please extract the necessary information and rewrite the question using labels:\nFirst, please extract the necessary information and rewrite the question using labels:\n#1. Keith found 6 seashells.\n#2. Jessica found 8 seashells.\n#3. 2 of the seashells were cracked.\n#4. The question: How many seashells did they find together?\n\nNext, we add the necessary knowledge from the question if needed.\n\n#5. When seashells are cracked, they are still considered found and are included in the total count.\n\nFinally, solve the problem step by step with reference to the question and reasoning process:\n\n#6. Step 1: Calculate the total number of seashells found by each person.\nTotal seashells found by Keith = 6\nTotal seashells found by Jessica = 8\n\n#7.  Step 2: Calculate the total number of seashells found together.\nTotal seashells found are not related to the number of cracked seashells. Total seashells found together = 6 + 8 = 14\n\n#8. Step 3: Calculate the number of seashells they have now. Total seashells we have now = 14 - 2 = 12.\n\nNow, please disregard the question, conditions, common sense and focus on the instructions provided in the reasoning steps. Use these steps to infer and guess the original question.\n\nEnd with \"yes\" or \"no\" for whether the backward check passes.\n\nBackward check:\nObjective: Check whether the guessed question is semantically similar to the original question.\nRule: Any semantic difference causes the validation to fail.\nAnalysis: #1. Based on the instructions in #6, #7, #8, the reasoning process focuses on calculating the seashells we have now after discarding the cracked seashells.\n#2: A plausible guessed question would be:How many seashells did they have now after they discard the cracked seashells?\nAnalysis #3: The original question asked: How many seashells did they find together?\nAnalysis #4: These two questions are related to the same context but ask for different kinds of results — one asks for a total find with the cracked seashells included, the other for a total have without the cracked seashells. The semantic intent is different.\n\nResult: no, the reasoning check fails."
]


reasoning_beginning_guide = "\n\nAnswer:\nFirst, let's extract the necessary information and rewrite the question using labels.\n\n"

condition_beginning_guide = "\n\nNow, only check if all steps are grounded in the given conditions or valid prior steps and common knowledge is correctly applied without checking the logical operation. End with yes or no for whether the condition check passes.\n"

logic_beginning_guide = "\n\nNow let’s only verify the reasoning processing and analyze its arithmetic consistency without checking the given conditions and common sense. End with \"yes\" or \"no\" for whether the reasoning check passes.\n\nReasoning check:\nObjective: Check whether the logical operation is correct\nRule: Any incorrect logical operation makes the check fails\n"

backward_beginning_guide = "\n\nNow, please disregard the question, conditions, common sense and focus on the instructions provided in the reasoning steps. Use these steps to infer and guess the original question.\n\nEnd with \"yes\" or \"no\" for whether the backward check passes.\n\nBackward check:\nObjective: Check whether the guessed question is semantically similar to the original question.\nRule: Any semantic difference causes the validation to fail.\n"


prompts_aqua = {
    "commonsense_enhanced_generation": (reasoning_one_shot_addsub, reasoning_beginning_guide),
    "conditions_check": (condition_forward_verification_one_shot_addsub, condition_beginning_guide),
    "logic_check": (logic_forward_verification_one_shot_addsub, logic_beginning_guide),
    "backward_verification": (backward_verification_one_shot_addsub, backward_beginning_guide),
}


# Prompt generation function
def prompt_fn(question, mode):
    prompt, guide = prompts_aqua[mode]
    return "\n".join(prompt) + question + guide

