-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlist_coq.v
41 lines (33 loc) · 921 Bytes
/
dlist_coq.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
37
38
39
40
41
Require Import List.
Import ListNotations.
Import Bool.
Import Nat.
Require Import Coq.Strings.String.
Require Import Coq.Strings.Ascii.
Open Scope string_scope.
Definition DList (A : Type) := { l : list A & NoDup l}.
Example dlist_example : DList nat.
Proof.
exists [1; 2].
constructor.
- simpl. intro. destruct H; [inversion H; assumption | assumption].
- simpl. constructor.
+ intro. simpl in H. assumption.
+ constructor.
Qed.
Inductive Typ : Set :=
| t_nat
| t_bool
| t_unit.
Inductive Exp : Set -> Set :=
| add : Exp nat -> Exp nat -> Exp nat
| ifthenelse : Exp bool -> Exp nat -> Exp nat -> Exp nat
| lt : Exp nat -> Exp nat -> Exp bool
| printf : (n : string) -> printftype n -> Exp unit
where
Fixpoint printftype (s : string) : Exp :=
match s with
| "%d" ++ xs => prod (Exp bool) (printftype xs)
| String _ xs => printftype xs
| _ => Exp unit
end.