-
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.
The vernacular command takes a reference instead of a constr. Moreover, the head symbol is checked i.e Add Zify InjTyp ref checks that the referenced term has type Intyp X1 ... Xn Closes coq#14054, coq#13242 Improved recovery
- Loading branch information
Showing
5 changed files
with
109 additions
and
27 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,46 @@ | ||
(* bug 13242 *) | ||
|
||
Require Import Lia. | ||
Fail Add Zify InjTyp id. | ||
|
||
(* bug 14054 *) | ||
|
||
Require Import Coq.ZArith.ZArith. Open Scope Z_scope. | ||
Require Coq.Init.Byte . | ||
Require Import Coq.micromega.ZifyClasses Coq.micromega.Lia. | ||
|
||
Notation byte := Coq.Init.Byte.byte. | ||
|
||
Module byte. | ||
Definition unsigned(b: byte): Z := Z.of_N (Byte.to_N b). | ||
End byte. | ||
|
||
Section WithA. | ||
Context (A: Type). | ||
Fixpoint tuple(n: nat): Type := | ||
match n with | ||
| O => unit | ||
| S m => A * tuple m | ||
end. | ||
End WithA. | ||
|
||
Module LittleEndian. | ||
Fixpoint combine (n : nat) : forall (bs : tuple byte n), Z := | ||
match n with | ||
| O => fun _ => 0 | ||
| S n => fun bs => Z.lor (byte.unsigned (fst bs)) | ||
(Z.shiftl (combine n (snd bs)) 8) | ||
end. | ||
Lemma combine_bound: forall {n: nat} (t: tuple byte n), | ||
0 <= LittleEndian.combine n t < 2 ^ (8 * Z.of_nat n). | ||
Admitted. | ||
End LittleEndian. | ||
|
||
Instance InjByteTuple{n: nat}: InjTyp (tuple byte n) Z := {| | ||
inj := LittleEndian.combine n; | ||
pred x := 0 <= x < 2 ^ (8 * Z.of_nat n); | ||
cstr := @LittleEndian.combine_bound n; | ||
|}. | ||
Fail Add Zify InjTyp InjByteTuple. | ||
Fail Add Zify UnOp InjByteTuple. | ||
Fail Add Zify UnOp X. |
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