-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFileIds.v
36 lines (31 loc) · 870 Bytes
/
FileIds.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Require Import Coq.Lists.List.
Require Import Coq.ZArith.ZArith.
Require Import Byte.
Require Import ByteData.
Require Import Util.
Local Open Scope bool.
Local Open Scope N.
Inductive FileId: Type :=
| Ext2Id: N -> FileId
| MockId: list (N*Byte) -> FileId
.
Fixpoint eqb (lhs rhs: FileId) :=
match (lhs, rhs) with
| ((Ext2Id l), (Ext2Id r)) => N.eqb l r
| ((MockId l), (MockId r)) => listN_Byte_eqb l r
| _ => false
end.
Lemma eqb_reflection (lhs rhs: FileId) :
eqb lhs rhs = true -> lhs = rhs.
Proof.
generalize rhs.
induction lhs.
(* Ext2Id *)
destruct rhs0; [| simpl; intros; inversion H].
unfold eqb. intros. apply N.eqb_eq in H. rewrite H. reflexivity.
(* MockId *)
destruct rhs0; [simpl; intros; inversion H | ].
intros. unfold eqb in H.
apply listN_Byte_eqb_reflection in H.
rewrite H. reflexivity.
Qed.