Submission Details

Back to Submissions List

Challenge: solveAdd

Submitted by: Robin

Submitted at: 2025-03-28 18:33:30

Code:

import Init.Data.Int

def solveAdd (a b:Int): Int
import Init.Data.Int

def solveAdd (a b : Int) : Int :=
  b - a

First Theorem Proof:

theorem solveAdd_correct (a b: Int): a + (solveAdd a b) =b 
theorem solveAdd_correct (a b : Int) : a + (solveAdd a b) = b := by
  unfold solveAdd
  rw [Int.sub_eq_add_neg, ← Int.add_assoc, Int.add_right_comm,
    ← Int.sub_eq_add_neg, Int.sub_self, Int.zero_add]

Status: Incorrect

Feedback:

Compilation error for /root/CodeProofTheArena/temp/tmpuo4j11ec/proof.lean:
/root/CodeProofTheArena/temp/tmpuo4j11ec/proof.lean:7:27: error: unexpected token 'def'; expected ':=', 'where' or '|'
/root/CodeProofTheArena/temp/tmpuo4j11ec/proof.lean:9:4: error: 'solveAdd' has already been declared
/root/CodeProofTheArena/temp/tmpuo4j11ec/proof.lean:13:58: error: unexpected token 'theorem'; expected ':=', 'where' or '|'
/root/CodeProofTheArena/temp/tmpuo4j11ec/proof.lean:14:8: error: 'solveAdd_correct' has already been declared