Skip to content

Instantly share code, notes, and snippets.

@david415
Last active July 19, 2024 04:56
Show Gist options
  • Save david415/2f8b803706741b6e94339cddac1a3b51 to your computer and use it in GitHub Desktop.
Save david415/2f8b803706741b6e94339cddac1a3b51 to your computer and use it in GitHub Desktop.
@[extern "add_one"]
opaque addOne : UInt32 → UInt32
def specialAddOne : (x : Nat) → Nat :=
fun x => (addOne (UInt32.ofNat x)).toNat
axiom specialAddOne_eq_add_one : ∀ x : Nat, specialAddOne x = x + 1
variable (a b c d e : Nat)
variable (h1 : a = b)
variable (h2 : b = specialAddOne c)
--variable (h2 : b = c + 1)
variable (h3 : c = d)
variable (h4 : e = 1 + d)
theorem T : a = e :=
calc
a = b := h1
b = specialAddOne c := h2
specialAddOne c = c + 1 := specialAddOne_eq_add_one c
c + 1 = d + 1 := congrArg Nat.succ h3
d + 1 = 1 + d := Nat.add_comm d 1
1 + d = e := Eq.symm h4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment