From bfafe1f4d1cb69c9b921a77c7193c92b45cc21df Mon Sep 17 00:00:00 2001
From: Son Ho
Date: Thu, 26 Oct 2023 14:45:19 +0200
Subject: Regenerate several test files for Lean

---
 tests/lean/Paper.lean | 48 +++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

(limited to 'tests/lean/Paper.lean')

diff --git a/tests/lean/Paper.lean b/tests/lean/Paper.lean
index c15c5e4b..ae4dd243 100644
--- a/tests/lean/Paper.lean
+++ b/tests/lean/Paper.lean
@@ -8,13 +8,13 @@ namespace paper
 /- [paper::ref_incr]: merged forward/backward function
    (there is a single backward function, and the forward function returns ()) -/
 def ref_incr (x : I32) : Result I32 :=
-  x + (I32.ofInt 1)
+  x + 1#i32
 
 /- [paper::test_incr]: forward function -/
 def test_incr : Result Unit :=
   do
-    let x ← ref_incr (I32.ofInt 0)
-    if not (x = (I32.ofInt 1))
+    let x ← ref_incr 0#i32
+    if not (x = 1#i32)
     then Result.fail Error.panic
     else Result.ret ()
 
@@ -37,19 +37,18 @@ def choose_back
 /- [paper::test_choose]: forward function -/
 def test_choose : Result Unit :=
   do
-    let z ← choose I32 true (I32.ofInt 0) (I32.ofInt 0)
-    let z0 ← z + (I32.ofInt 1)
-    if not (z0 = (I32.ofInt 1))
+    let z ← choose I32 true 0#i32 0#i32
+    let z0 ← z + 1#i32
+    if not (z0 = 1#i32)
     then Result.fail Error.panic
     else
       do
-        let (x, y) ← choose_back I32 true (I32.ofInt 0) (I32.ofInt 0) z0
-        if not (x = (I32.ofInt 1))
+        let (x, y) ← choose_back I32 true 0#i32 0#i32 z0
+        if not (x = 1#i32)
         then Result.fail Error.panic
-        else
-          if not (y = (I32.ofInt 0))
-          then Result.fail Error.panic
-          else Result.ret ()
+        else if not (y = 0#i32)
+             then Result.fail Error.panic
+             else Result.ret ()
 
 /- Unit test for [paper::test_choose] -/
 #assert (test_choose == .ret ())
@@ -63,10 +62,10 @@ inductive List (T : Type) :=
 divergent def list_nth_mut (T : Type) (l : List T) (i : U32) : Result T :=
   match l with
   | List.Cons x tl =>
-    if i = (U32.ofInt 0)
+    if i = 0#u32
     then Result.ret x
     else do
-           let i0 ← i - (U32.ofInt 1)
+           let i0 ← i - 1#u32
            list_nth_mut T tl i0
   | List.Nil => Result.fail Error.panic
 
@@ -75,11 +74,11 @@ divergent def list_nth_mut_back
   (T : Type) (l : List T) (i : U32) (ret0 : T) : Result (List T) :=
   match l with
   | List.Cons x tl =>
-    if i = (U32.ofInt 0)
+    if i = 0#u32
     then Result.ret (List.Cons ret0 tl)
     else
       do
-        let i0 ← i - (U32.ofInt 1)
+        let i0 ← i - 1#u32
         let tl0 ← list_nth_mut_back T tl i0 ret0
         Result.ret (List.Cons x tl0)
   | List.Nil => Result.fail Error.panic
@@ -90,20 +89,19 @@ divergent def sum (l : List I32) : Result I32 :=
   | List.Cons x tl => do
                         let i ← sum tl
                         x + i
-  | List.Nil => Result.ret (I32.ofInt 0)
+  | List.Nil => Result.ret 0#i32
 
 /- [paper::test_nth]: forward function -/
 def test_nth : Result Unit :=
   do
     let l := List.Nil
-    let l0 := List.Cons (I32.ofInt 3) l
-    let l1 := List.Cons (I32.ofInt 2) l0
-    let x ← list_nth_mut I32 (List.Cons (I32.ofInt 1) l1) (U32.ofInt 2)
-    let x0 ← x + (I32.ofInt 1)
-    let l2 ←
-      list_nth_mut_back I32 (List.Cons (I32.ofInt 1) l1) (U32.ofInt 2) x0
+    let l0 := List.Cons 3#i32 l
+    let l1 := List.Cons 2#i32 l0
+    let x ← list_nth_mut I32 (List.Cons 1#i32 l1) 2#u32
+    let x0 ← x + 1#i32
+    let l2 ← list_nth_mut_back I32 (List.Cons 1#i32 l1) 2#u32 x0
     let i ← sum l2
-    if not (i = (I32.ofInt 7))
+    if not (i = 7#i32)
     then Result.fail Error.panic
     else Result.ret ()
 
@@ -115,7 +113,7 @@ def call_choose (p : (U32 × U32)) : Result U32 :=
   do
     let (px, py) := p
     let pz ← choose U32 true px py
-    let pz0 ← pz + (U32.ofInt 1)
+    let pz0 ← pz + 1#u32
     let (px0, _) ← choose_back U32 true px py pz0
     Result.ret px0
 
-- 
cgit v1.2.3


From 137cc7335e64fcb70c254e7fd2a6fa353fb43e61 Mon Sep 17 00:00:00 2001
From: Son Ho
Date: Tue, 21 Nov 2023 14:57:38 +0100
Subject: Regenerate the files

---
 tests/lean/Paper.lean | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

(limited to 'tests/lean/Paper.lean')

diff --git a/tests/lean/Paper.lean b/tests/lean/Paper.lean
index ae4dd243..37e0e70e 100644
--- a/tests/lean/Paper.lean
+++ b/tests/lean/Paper.lean
@@ -6,11 +6,13 @@ open Primitives
 namespace paper
 
 /- [paper::ref_incr]: merged forward/backward function
-   (there is a single backward function, and the forward function returns ()) -/
+   (there is a single backward function, and the forward function returns ())
+   Source: 'src/paper.rs', lines 4:0-4:28 -/
 def ref_incr (x : I32) : Result I32 :=
   x + 1#i32
 
-/- [paper::test_incr]: forward function -/
+/- [paper::test_incr]: forward function
+   Source: 'src/paper.rs', lines 8:0-8:18 -/
 def test_incr : Result Unit :=
   do
     let x ← ref_incr 0#i32
@@ -21,20 +23,23 @@ def test_incr : Result Unit :=
 /- Unit test for [paper::test_incr] -/
 #assert (test_incr == .ret ())
 
-/- [paper::choose]: forward function -/
+/- [paper::choose]: forward function
+   Source: 'src/paper.rs', lines 15:0-15:70 -/
 def choose (T : Type) (b : Bool) (x : T) (y : T) : Result T :=
   if b
   then Result.ret x
   else Result.ret y
 
-/- [paper::choose]: backward function 0 -/
+/- [paper::choose]: backward function 0
+   Source: 'src/paper.rs', lines 15:0-15:70 -/
 def choose_back
   (T : Type) (b : Bool) (x : T) (y : T) (ret0 : T) : Result (T × T) :=
   if b
   then Result.ret (ret0, y)
   else Result.ret (x, ret0)
 
-/- [paper::test_choose]: forward function -/
+/- [paper::test_choose]: forward function
+   Source: 'src/paper.rs', lines 23:0-23:20 -/
 def test_choose : Result Unit :=
   do
     let z ← choose I32 true 0#i32 0#i32
@@ -53,12 +58,14 @@ def test_choose : Result Unit :=
 /- Unit test for [paper::test_choose] -/
 #assert (test_choose == .ret ())
 
-/- [paper::List] -/
+/- [paper::List]
+   Source: 'src/paper.rs', lines 35:0-35:16 -/
 inductive List (T : Type) :=
 | Cons : T → List T → List T
 | Nil : List T
 
-/- [paper::list_nth_mut]: forward function -/
+/- [paper::list_nth_mut]: forward function
+   Source: 'src/paper.rs', lines 42:0-42:67 -/
 divergent def list_nth_mut (T : Type) (l : List T) (i : U32) : Result T :=
   match l with
   | List.Cons x tl =>
@@ -69,7 +76,8 @@ divergent def list_nth_mut (T : Type) (l : List T) (i : U32) : Result T :=
            list_nth_mut T tl i0
   | List.Nil => Result.fail Error.panic
 
-/- [paper::list_nth_mut]: backward function 0 -/
+/- [paper::list_nth_mut]: backward function 0
+   Source: 'src/paper.rs', lines 42:0-42:67 -/
 divergent def list_nth_mut_back
   (T : Type) (l : List T) (i : U32) (ret0 : T) : Result (List T) :=
   match l with
@@ -83,7 +91,8 @@ divergent def list_nth_mut_back
         Result.ret (List.Cons x tl0)
   | List.Nil => Result.fail Error.panic
 
-/- [paper::sum]: forward function -/
+/- [paper::sum]: forward function
+   Source: 'src/paper.rs', lines 57:0-57:32 -/
 divergent def sum (l : List I32) : Result I32 :=
   match l with
   | List.Cons x tl => do
@@ -91,7 +100,8 @@ divergent def sum (l : List I32) : Result I32 :=
                         x + i
   | List.Nil => Result.ret 0#i32
 
-/- [paper::test_nth]: forward function -/
+/- [paper::test_nth]: forward function
+   Source: 'src/paper.rs', lines 68:0-68:17 -/
 def test_nth : Result Unit :=
   do
     let l := List.Nil
@@ -108,7 +118,8 @@ def test_nth : Result Unit :=
 /- Unit test for [paper::test_nth] -/
 #assert (test_nth == .ret ())
 
-/- [paper::call_choose]: forward function -/
+/- [paper::call_choose]: forward function
+   Source: 'src/paper.rs', lines 76:0-76:44 -/
 def call_choose (p : (U32 × U32)) : Result U32 :=
   do
     let (px, py) := p
-- 
cgit v1.2.3


From d84040e000333d6d2a212fb849a38fb73a65eb48 Mon Sep 17 00:00:00 2001
From: Son Ho
Date: Fri, 24 Nov 2023 17:41:42 +0100
Subject: Regenerate the files

---
 tests/lean/Paper.lean | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

(limited to 'tests/lean/Paper.lean')

diff --git a/tests/lean/Paper.lean b/tests/lean/Paper.lean
index 37e0e70e..08386bb7 100644
--- a/tests/lean/Paper.lean
+++ b/tests/lean/Paper.lean
@@ -17,11 +17,11 @@ def test_incr : Result Unit :=
   do
     let x ← ref_incr 0#i32
     if not (x = 1#i32)
-    then Result.fail Error.panic
+    then Result.fail .panic
     else Result.ret ()
 
 /- Unit test for [paper::test_incr] -/
-#assert (test_incr == .ret ())
+#assert (test_incr == Result.ret ())
 
 /- [paper::choose]: forward function
    Source: 'src/paper.rs', lines 15:0-15:70 -/
@@ -33,10 +33,10 @@ def choose (T : Type) (b : Bool) (x : T) (y : T) : Result T :=
 /- [paper::choose]: backward function 0
    Source: 'src/paper.rs', lines 15:0-15:70 -/
 def choose_back
-  (T : Type) (b : Bool) (x : T) (y : T) (ret0 : T) : Result (T × T) :=
+  (T : Type) (b : Bool) (x : T) (y : T) (ret : T) : Result (T × T) :=
   if b
-  then Result.ret (ret0, y)
-  else Result.ret (x, ret0)
+  then Result.ret (ret, y)
+  else Result.ret (x, ret)
 
 /- [paper::test_choose]: forward function
    Source: 'src/paper.rs', lines 23:0-23:20 -/
@@ -45,18 +45,18 @@ def test_choose : Result Unit :=
     let z ← choose I32 true 0#i32 0#i32
     let z0 ← z + 1#i32
     if not (z0 = 1#i32)
-    then Result.fail Error.panic
+    then Result.fail .panic
     else
       do
         let (x, y) ← choose_back I32 true 0#i32 0#i32 z0
         if not (x = 1#i32)
-        then Result.fail Error.panic
+        then Result.fail .panic
         else if not (y = 0#i32)
-             then Result.fail Error.panic
+             then Result.fail .panic
              else Result.ret ()
 
 /- Unit test for [paper::test_choose] -/
-#assert (test_choose == .ret ())
+#assert (test_choose == Result.ret ())
 
 /- [paper::List]
    Source: 'src/paper.rs', lines 35:0-35:16 -/
@@ -74,22 +74,22 @@ divergent def list_nth_mut (T : Type) (l : List T) (i : U32) : Result T :=
     else do
            let i0 ← i - 1#u32
            list_nth_mut T tl i0
-  | List.Nil => Result.fail Error.panic
+  | List.Nil => Result.fail .panic
 
 /- [paper::list_nth_mut]: backward function 0
    Source: 'src/paper.rs', lines 42:0-42:67 -/
 divergent def list_nth_mut_back
-  (T : Type) (l : List T) (i : U32) (ret0 : T) : Result (List T) :=
+  (T : Type) (l : List T) (i : U32) (ret : T) : Result (List T) :=
   match l with
   | List.Cons x tl =>
     if i = 0#u32
-    then Result.ret (List.Cons ret0 tl)
+    then Result.ret (List.Cons ret tl)
     else
       do
         let i0 ← i - 1#u32
-        let tl0 ← list_nth_mut_back T tl i0 ret0
+        let tl0 ← list_nth_mut_back T tl i0 ret
         Result.ret (List.Cons x tl0)
-  | List.Nil => Result.fail Error.panic
+  | List.Nil => Result.fail .panic
 
 /- [paper::sum]: forward function
    Source: 'src/paper.rs', lines 57:0-57:32 -/
@@ -112,11 +112,11 @@ def test_nth : Result Unit :=
     let l2 ← list_nth_mut_back I32 (List.Cons 1#i32 l1) 2#u32 x0
     let i ← sum l2
     if not (i = 7#i32)
-    then Result.fail Error.panic
+    then Result.fail .panic
     else Result.ret ()
 
 /- Unit test for [paper::test_nth] -/
-#assert (test_nth == .ret ())
+#assert (test_nth == Result.ret ())
 
 /- [paper::call_choose]: forward function
    Source: 'src/paper.rs', lines 76:0-76:44 -/
-- 
cgit v1.2.3

