-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ new ] totality checking can look under constructors (#3328)
* [ total ] Consider (x :: zs) to be smaller than (x :: y :: zs) * Expand RHS metas in totality checking
- Loading branch information
1 parent
1eed6a8
commit 6b9f0f7
Showing
8 changed files
with
128 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
total | ||
f : (a, List a) -> () | ||
f (_, []) = () | ||
f (x, _::xs) = f (x, xs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
%default total | ||
|
||
-- This one needed withHoles on tcOnly (instead of withArgHoles) | ||
-- or the solved implicit for the (ty : Type) on Maybe would not be | ||
-- substituted. | ||
length : Maybe (List a) -> Nat | ||
length Nothing = 0 | ||
length (Just []) = 0 | ||
length (Just (x :: xs)) = 1 + length (Just xs) | ||
|
||
one : List a -> Nat | ||
one (x :: y :: zs) = one (x :: zs) | ||
one _ = 0 | ||
|
||
two : List a -> Nat | ||
two (a :: b :: c :: d :: es) = two (a :: c :: es) | ||
two _ = 0 | ||
|
||
three : List a -> Nat | ||
three (a :: b :: c :: d :: es) = three (b :: c :: es) | ||
three _ = 0 | ||
|
||
failing "not total" | ||
four : List Nat -> Nat | ||
four (a :: b :: c :: es) = four (b :: c :: a :: es) | ||
four _ = 0 | ||
|
||
-- also needs withHoles | ||
five : (List a, List a) -> List a | ||
five (a :: as, bs) = a :: five (as, bs) | ||
five ([], _) = [] | ||
|
||
-- This is total, but not supported | ||
failing "not total" | ||
six : (List a, List a) -> List a | ||
six (a :: as, bs) = a :: six (bs, as) | ||
six ([], _) = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1/1: Building Issue3317 (Issue3317.idr) | ||
1/1: Building Totality (Totality.idr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. ../../../testutils.sh | ||
|
||
idris2 --check Issue3317.idr | ||
idris2 --check Totality.idr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters