| 1 |
Require Import TestSuite.admit. |
| 2 |
Section Counted_list. |
| 3 |
|
| 4 |
Variable A : Type. |
| 5 |
|
| 6 |
Inductive counted_list : nat -> Type := |
| 7 |
| counted_nil : counted_list 0 |
| 8 |
| counted_cons : forall(n : nat), |
| 9 |
A -> counted_list n -> counted_list (S n). |
| 10 |
|
| 11 |
|
| 12 |
Fixpoint counted_def_nth{n : nat}(l : counted_list n) |
| 13 |
(i : nat)(def : A) : A := |
| 14 |
match i with |
| 15 |
| 0 => match l with |
| 16 |
| counted_nil => def |
| 17 |
| counted_cons _ a _ => a |
| 18 |
end |
| 19 |
| S i => match l with |
| 20 |
| counted_nil => def |
| 21 |
| counted_cons _ _ tl => counted_def_nth tl i def |
| 22 |
end |
| 23 |
end. |
| 24 |
|
| 25 |
|
| 26 |
Lemma counted_list_equal_nth_char : |
| 27 |
forall(n : nat)(l1 l2 : counted_list n)(def : A), |
| 28 |
(forall(i : nat), counted_def_nth l1 i def = counted_def_nth l2 i def) -> |
| 29 |
l1 = l2. |
| 30 |
Proof. |
| 31 |
admit. |
| 32 |
Qed. |
| 33 |
|
| 34 |
End Counted_list. |
| 35 |
|
| 36 |
Arguments counted_def_nth [A n]. |
| 37 |
|
| 38 |
Section Finite_nat_set. |
| 39 |
|
| 40 |
Variable set_size : nat. |
| 41 |
|
| 42 |
Definition fnat_subset : Type := counted_list bool set_size. |
| 43 |
|
| 44 |
Definition fnat_member(fs : fnat_subset)(n : nat) : Prop := |
| 45 |
is_true (counted_def_nth fs n false). |
| 46 |
|
| 47 |
|
| 48 |
Lemma fnat_subset_member_eq : forall(fs1 fs2 : fnat_subset), |
| 49 |
fs1 = fs2 <-> |
| 50 |
forall(n : nat), fnat_member fs1 n <-> fnat_member fs2 n. |
| 51 |
|
| 52 |
Proof. |
| 53 |
intros fs1 fs2. |
| 54 |
split. |
| 55 |
intros H n. |
| 56 |
subst fs1. |
| 57 |
apply iff_refl. |
| 58 |
intros H. |
| 59 |
eapply (counted_list_equal_nth_char _ _ _ _ ?[def]). |
| 60 |
intros i. |
| 61 |
destruct (counted_def_nth fs1 i _ ) eqn:H0. |
| 62 |
(* This was not part of the initial bug report; this is to check that |
| 63 |
the existential variable kept its name *) |
| 64 |
change (true = counted_def_nth fs2 i ?def). |
| 65 |
|
| 66 |
Abort. |
| 67 |
End Finite_nat_set. |