[ fix ] issue 3266

This commit is contained in:
stefan-hoeck 2024-04-22 15:44:35 +02:00
parent 517b2832ef
commit e1c5c2fd8e
2 changed files with 7 additions and 1 deletions

View File

@ -230,8 +230,9 @@ finFromInteger x = natToFinLt (fromInteger x)
-- even when the function is unused (issue #2032)
public export
integerLessThanNat : Integer -> Nat -> Bool
integerLessThanNat 0 (S m) = True
integerLessThanNat x n with (x < the Integer 0)
integerLessThanNat _ _ | True = True -- if `x < 0` then `x < n` for any `n : Nat`
integerLessThanNat _ _ | True = False -- don't support negative literals
integerLessThanNat x (S m) | False = integerLessThanNat (x-1) m -- recursive case
integerLessThanNat x Z | False = False -- `x >= 0` contradicts `x < Z`

View File

@ -20,3 +20,8 @@ eq1 = Refl
-- and anybody measures the time it takes this test to run...
addFourMillion : Int -> Int
addFourMillion x = 4000000 + x
-- issue #3266
failing
fin0 : Fin 0
fin0 = (-1)