reasoning_one_shot_aqua = [
    "Question:\nA train running at a speed of 100 miles/hour, takes 10 hours to reach its destination. After covering quarter of the distance, it starts raining and the train has to be slowed to speed of 75 miles/hour. What is the total journey duration?\n\nOptions:\nA)10\nB)11.5\nC)12.5\nD)13.5\nE)15\n\nAnswer:\nFirst, let's extract the necessary information and rewrite the question using labels.\n#1. The train originally travels at a speed of 100 miles/hour.\n#2. It takes 10 hours to reach its destination.\n#3. After covering one quarter of the distance, it starts raining.\n#4. When it rains, the train slows down to 75 miles/hour.\n#5. What is the total journey duration?\n\nNext, we add the necessary knowledge from the question if needed.\n#6. Distance = speed × time = 100 × 10 = 1000 miles\n#7. One quarter of the distance = 1000 ÷ 4 = 250 miles\n\nFinally, let us solve the problem step by step with reference to the question and reasoning process:\n\n#8. (by #1 #7) Step 1: Time to travel the first 250 miles at 100 mph = 250 ÷ 100 = 2.5 hours\n\n#9. (by #4 #6 #7) Step 2: Remaining distance = 1000 − 250 = 750 miles\nSpeed = 75 mph, so time = 750 ÷ 75 = 10 hours\n\n#10. (by #8 #9) Step 3: Total journey duration = 2.5 + 10 = 12.5 hours\n\n#11. (by #5 #10) The original question is #5. What is the total journey duration? We do not miss any information in the rewritten labels. So the answer to this question is 12.5 hours.\nThe correct option is C."
]

condition_forward_verification_one_shot_aqua = [
    "Please only verify the conditions and common sense in the reasoning process below. This is the reasoning process: First, please 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\nAnswer Choices:\nA) 14\nB) 24\nC) None of the above\n\nNext, we add the necessary knowledge from the question if needed\n:#6. Buy 2, Get 1 Free means John pays for only 1 ticket even though he gets 3, so he pays 1 × $12 = $12.\n\nFinally, please solve the problem step by step with reference to the question and reasoning process:\nStep #7 (by #4): He sells one of the tickets to a friend for $10.\nStep #8 (by #6 #7): Total money spent = $12, Money earned = $10, so the net amount John is out = $12 − $10 = $2.\nStep #9: The correct option that matches $2 is C) None of the above.\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:\n$12 per ticket in #6 comes from #2 (verified)\nThe Buy 2, Get 1 Free deal in #6 is misinterpreted: it incorrectly assumes you only pay for 1 ticket when buying 3, but the standard meaning (based on #3 and general retail knowledge) is you pay for 2 tickets and get the third one free (not pay for 1).\nThis misinterpretation causes the $12 total cost to be invalid.\nThe flawed cost basis makes the entire reasoning invalid.\n\nResult: no, the condition check fails."
]

logic_forward_verification_one_shot_aqua = [
    "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. 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\nAnswer Choices:\nA) 14\nB) 24\nC) None of the above\n\nNext, we add the necessary knowledge from the question if needed\n:#6. “Buy 2, Get 1 Free” means John pays for only 2 tickets. So he pays 2 × $12 = $24.\nFinally, please solve the problem step by step with reference to the question and reasoning process:\nStep #7 (by #4): He sells one ticket for $10.\nStep #8 (by #6 #7): Total paid = $24, Amount received = $10, so money John is out = $24 − $10 = $4.\nStep #9: The correct answer is C) 14.\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: John sells one ticket for $10 as stated in #4 (verified).\nStep #8: There is an arithmetic error. $24 − $10 should equal $14, but it is incorrectly calculated as $4 (unverified).\nStep #9: The answer B) 24 does not correspond to the computed $4, nor the correct result $14 (unverified).\n\nIn summary:\nThere is one arithmetic mistake in the subtraction.\n\nResult: no, the reasoning check fails."
]

backward_verification_one_shot_aqua = [
    "First, please 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\nAnswer Choices:\nA) 14\nB) 24\nC) None of the above\n\nNext, we add the necessary knowledge from the question if needed\n:#6. “Buy 2, Get 1 Free” means John pays for only 2 tickets. So he pays 2 × $12 = $24.\nFinally, please solve the problem step by step with reference to the question and reasoning process:\nStep #7 (by #4): He sells one ticket for $10.\nStep #8 (by #6 #7): Total paid = $24, Amount received = $10, so money John is out = $24 − $10 = $14.\nStep #9: The correct answer is A) 14.\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 Step #7, Step #8, the reasoning process focuses on calculating the average cost per ticket after the promotion and reselling, specifically $14 divided by the remaining 2 tickets, resulting in $7.\n#2: A plausible guessed question would be: What is the average cost per ticket John ends up paying after the transaction?\nAnalysis #3: The original question asked: How much money is John out?\nAnalysis #4: These two questions are related to the same context but ask for different kinds of results — one asks for a total loss, the other for an average per-ticket cost. 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_aqua, reasoning_beginning_guide),
    "conditions_check": (condition_forward_verification_one_shot_aqua, condition_beginning_guide),
    "logic_check": (logic_forward_verification_one_shot_aqua, logic_beginning_guide),
    "backward_verification": (backward_verification_one_shot_aqua, backward_beginning_guide),
}


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

