]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/ng_refiner/esempio.ma
Preparing for 0.5.9 release.
[helm.git] / helm / software / components / ng_refiner / esempio.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/plus.ma".
16
17 definition hole : ∀A:Type.A → A ≝ λA.λx.x.
18 definition id : ∀A:Type.A → A ≝ λA.λx.x.
19
20 (* Common case in dama, reduction with metas
21 inductive list : Type := nil : list | cons : nat -> list -> list.
22 let rec len l := match l with [ nil => O | cons _ l => S (len l) ].
23 axiom lt : nat -> nat -> Prop.
24 axiom foo : ∀x. Not (lt (hole ? x) (hole ? O)) = (lt x (len nil) -> False).
25 *) 
26
27 (* meta1 Vs meta2 with different contexts
28 axiom foo: 
29   ∀P:Type.∀f:P→P→Prop.∀x:P.
30    (λw. ((∀e:P.f x (w x)) = (∀y:P. f x (hole ? y)))) 
31    (λw:P.hole ? w). 
32 *)
33
34 (* meta1 Vs meta1 with different local contexts
35 axiom foo: 
36   ∀P:Type.∀f:P→P→P.∀x,y:P. 
37     (λw.(f x (w x) = f x (w y))) (λw:P.hole ? w).
38 *)
39
40 (* meta Vs term && term Vs meta with different local ctx
41 axiom foo: 
42   ∀P:Type.∀f:P→P→P.∀x,y:P.
43     (λw.(f (w x) (hole ? x) = f x (w y))) (λw:P.hole ? w).
44 *)
45
46 (* occur check
47 axiom foo: 
48   ∀P:Type.∀f:P→P→P.∀x,y:P.
49     (λw.(f x (f (w x) x) = f x (w y))) (λw:P.hole ? w).
50 *)
51
52 (* unifying the type of (y ?) with (Q x) we instantiate ? to x
53 axiom foo: 
54   ∀P:Type.∀Q:P→Type.∀f:∀x:P.Q x→P→P.∀x:P.∀y:∀x.Q x.
55     (λw.(f w (y w) x = (id ? f) x (hole ? (y x)) x)) (hole ? x).
56 *)  
57    
58 alias num (instance 0) = "natural number".
59 axiom foo: (100+111) = (100+110). 
60
61
62     (id ?(id ?(id ?(id ? (100+100))))) =
63     (id ?(id ?(id ?(id ? (99+100))))).[3:
64     apply (refl_eq nat (id ?(id ?(id ?(id ? (98+102+?))))));
65
66 axiom foo: (λx,y.(λz. z (x+y) + z x) (λw:nat.hole ? w)) = λx,y.x. (* OK *)
67 axiom foo: (λx,y.(λz. z x + z (x+y)) (λw:nat.hole ? w)) = λx,y.x. (* KO, delift rels only *) 
68  
69
70
71 axiom foo: (λx,y.(λz. z x + z y) (λw:nat.hole ? w)) = λx,y.x. (* OK *) 
72