summaryrefslogtreecommitdiff
path: root/backends/lean/Base/Arith/Base.lean
diff options
context:
space:
mode:
authorSon Ho2023-12-05 17:34:13 +0100
committerSon Ho2023-12-05 17:34:13 +0100
commit726db4911add81a853aafcec3936b457aaeff5b4 (patch)
tree2663915767c3558203990ed14f8d5604b7fd21d1 /backends/lean/Base/Arith/Base.lean
parent92887b89e35607e99bae2f19e4c5b2f162683d02 (diff)
parent4795e5f823bc89504855d8eb946b111d9314f4d5 (diff)
Merge branch 'main' into son_fixes2
Diffstat (limited to '')
-rw-r--r--backends/lean/Base/Arith/Base.lean12
1 files changed, 12 insertions, 0 deletions
diff --git a/backends/lean/Base/Arith/Base.lean b/backends/lean/Base/Arith/Base.lean
index 9c11ed45..8ada4171 100644
--- a/backends/lean/Base/Arith/Base.lean
+++ b/backends/lean/Base/Arith/Base.lean
@@ -57,4 +57,16 @@ theorem int_pos_ind (p : Int → Prop) :
-- TODO: there is probably something more general to do
theorem nat_zero_eq_int_zero : (0 : Nat) = (0 : Int) := by simp
+-- This is mostly used in termination proofs
+theorem to_int_to_nat_lt (x y : ℤ) (h0 : 0 ≤ x) (h1 : x < y) :
+ ↑(x.toNat) < y := by
+ simp [*]
+
+-- This is mostly used in termination proofs
+theorem to_int_sub_to_nat_lt (x y : ℤ) (x' : ℕ)
+ (h0 : ↑x' ≤ x) (h1 : x - ↑x' < y) :
+ ↑(x.toNat - x') < y := by
+ have : 0 ≤ x := by linarith
+ simp [Int.toNat_sub_of_le, *]
+
end Arith