Submission Details

Back to Submissions List

Challenge: solveAdd

Submitted by: Robin

Submitted at: 2025-03-28 18:34:03

Code:

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 
:= 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: Correct

Feedback:

------------------
Replaying /root/CodeProofTheArena/temp/tmpa_jhoo9u/target.olean
Finished imports
Finished replay
---
def
solveAdd
Int → Int → Int
:= fun (a : Int) (b : Int) => sorryAx.{1} Int Bool.false
#[sorryAx]
---
theorem
solveAdd_correct
∀ (a b : Int), a + solveAdd a b = b
#[sorryAx]
------------------
Replaying /root/CodeProofTheArena/temp/tmpa_jhoo9u/proof.olean
Finished imports
Finished replay
---
def
solveAdd
Int → Int → Int
:= fun (a : Int) (b : Int) => HSub.hSub.{0, 0, 0} Int Int Int (instHSub.{0} Int Int.instSub) b a
#[]
---
theorem
solveAdd_correct
∀ (a b : Int), a + solveAdd a b = b
#[propext]
Finished with no errors.