-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…atch leading to anomaly)
- Loading branch information
Showing
5 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
dev/ci/user-overlays/00664-herbelin-master+change-for-coq-pr664-compatibility.sh
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 @@ | ||
if [ "$CI_PULL_REQUEST" = "664" ] || [ "$CI_BRANCH" = "trunk+fix-5500-too-weak-test-return-clause" ]; then | ||
fiat_parsers_CI_BRANCH=master+change-for-coq-pr664-compatibility | ||
fiat_parsers_CI_GITURL=https://github.com/herbelin/fiat | ||
fi |
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,35 @@ | ||
(* Too weak check on the correctness of return clause was leading to an anomaly *) | ||
|
||
Inductive Vector A: nat -> Type := | ||
nil: Vector A O | ||
| cons: forall n, A -> Vector A n -> Vector A (S n). | ||
|
||
(* This could be made working with a better inference of inner return | ||
predicates from the return predicate at the higher level of the | ||
nested matching. Currently, we only check that it does not raise an | ||
anomaly, but eventually, the "Fail" could be removed. *) | ||
|
||
Fail Definition hd_fst A x n (v: A * Vector A (S n)) := | ||
match v as v0 return match v0 with | ||
(l, r) => | ||
match r in Vector _ n return match n with 0 => Type | S _ => Type end with | ||
nil _ => A | ||
| cons _ _ _ _ => A | ||
end | ||
end with | ||
(_, nil _) => x | ||
| (_, cons _ n hd tl) => hd | ||
end. | ||
|
||
(* This is another example of failure but involving beta-reduction and | ||
not iota-reduction. Thus, for this one, I don't see how it could be | ||
solved by small inversion, whatever smart is small inversion. *) | ||
|
||
Inductive A : (Type->Type) -> Type := J : A (fun x => x). | ||
|
||
Fail Check fun x : nat * A (fun x => x) => | ||
match x return match x with | ||
(y,z) => match z in A f return f Type with J => bool end | ||
end with | ||
(y,J) => true | ||
end. |
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,16 @@ | ||
(* Checking typability of intermediate return predicates in nested pattern-matching *) | ||
|
||
Inductive A : (Type->Type) -> Type := J : A (fun x => x). | ||
Definition ret (x : nat * A (fun x => x)) | ||
:= match x return Type with | ||
| (y,z) => match z in A f return f Type with | ||
| J => bool | ||
end | ||
end. | ||
Definition foo : forall x, ret x. | ||
Proof. | ||
Fail refine (fun x | ||
=> match x return ret x with | ||
| (y,J) => true | ||
end | ||
). |