]> matita.cs.unibo.it Git - helm.git/blob - matita/tests/dependent_guarded_bove_capretta.ma
matita 0.5.1 tagged
[helm.git] / matita / tests / dependent_guarded_bove_capretta.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "nat/nat.ma".
16
17 inductive T : Prop :=
18  | l : T
19  | r : T-> T.
20
21 inductive Q : nat -> T -> Prop :=
22  | lq : Q O l
23  | lr : ∀n,t.Q (S (S n)) t -> Q n (r t). 
24  
25 axiom F : False. 
26
27 definition xxx := λt.(match t return (λt:T.T) with 
28     [ l => match F in False with [] 
29     | r (t1:T) => t1]).
30  
31 let rec f (n:nat) (t:T) on t :nat :=
32   (match n with
33   [ O => O
34   | S mmm =>
35     f (S (S mmm)) (xxx t)]).
36  
37 let rec f (n:nat) (t:T) on t : Q n t -> nat :=
38   (match n with
39   [ O => λ_.O
40   | S mmm => λq:Q (S mmm) (r t). 
41     f (S (S mmm))
42     (match t return (λt:T.T) with 
43     [ l => match F in False with [] 
44     | r (t1:T) => t1])
45     
46     (match q return λn,t,x.Q (S (S n)) t with 
47      [ lq => match F in False return λ_.Q (S (S n)) t with [] 
48      | lr k t qsskt => qsskt])
49     ]). 
50