]> matita.cs.unibo.it Git - helm.git/blob - helm/coq-contribs/LAMBDA-TYPES/contexts_defs.v
contribution about \lambda-\delta
[helm.git] / helm / coq-contribs / LAMBDA-TYPES / contexts_defs.v
1 (*#* #stop file *)
2
3 Require Export terms_defs.
4
5       Inductive Set C := CSort : nat -> C
6                       |  CTail : C -> K -> T -> C.
7
8       Hint f3CKT : ltlc := Resolve (f_equal3 C K T).
9
10       Definition r: K -> nat -> nat := [k;i] Cases k of
11          | (Bind _) => i
12          | (Flat _) => (S i)
13       end.
14
15       Fixpoint app [c:C] : nat -> T -> T := [j;t]Cases j c of
16          | (0)   _             => t
17          | _     (CSort _)     => t
18          | (S i) (CTail c k u) => (app c (r k i) (TTail k u t))
19       end.
20
21    Section r_props. (********************************************************)
22
23       Theorem r_S: (k:?; i:?) (r k (S i)) = (S (r k i)).
24       XElim k; XAuto.
25       Qed.
26
27       Theorem r_plus_sym: (k:?; i,j:?) (r k (plus i j)) = (plus i (r k j)).
28       XElim k; Intros; Simpl; XAuto.
29       Qed.
30
31       Theorem r_minus: (i,n:?) (lt n i) ->
32                        (k:?) (minus (r k i) (S n)) = (r k (minus i (S n))).
33       XElim k; Intros; Simpl; XEAuto.
34       Qed.
35
36       Theorem r_dis: (k:?; P:Prop)
37                      (((i:?) (r k i) = i) -> P) ->
38                      (((i:?) (r k i) = (S i)) -> P) -> P.
39       XElim k; XAuto.
40       Qed.
41
42    End r_props.
43
44       Tactic Definition RRw :=
45          Repeat (Rewrite r_S Orelse Rewrite r_plus_sym).
46
47    Section r_arith. (********************************************************)
48
49       Theorem r_arith0: (k:?; i:?) (minus (r k (S i)) (1)) = (r k i).
50       Intros; RRw; Rewrite minus_Sx_SO; XAuto.
51       Qed.
52
53       Theorem r_arith1: (k:?; i,j:?) (minus (r k (S i)) (S j)) = (minus (r k i) j).
54       Intros; RRw; XAuto.
55       Qed.
56
57    End r_arith.
58
59    Section app_props. (******************************************************)
60
61       Theorem app_csort : (t:?; i,n:?) (app (CSort n) i t) = t.
62       XElim i; Intros; Simpl; XAuto.
63       Qed.
64
65       Theorem app_O : (c:?; t:?) (app c (0) t) = t.
66       XElim c; XAuto.
67       Qed.
68
69    End app_props.
70
71       Hints Resolve app_csort app_O : ltlc.