]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/tests/unifhint.ma
...
[helm.git] / helm / software / matita / tests / unifhint.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 record group : Type β‰ {
16   gcarr :> Type;
17   gmult : gcarr β†’ gcarr β†’ gcarr; 
18   gopp  : gcarr β†’ gcarr;
19   gunit : gcarr
20 }.
21
22 interpretation "unif hints inverse" 'invert x = (gopp _ x).
23 interpretation "unif hing times" 'times x y = (gmult _ x y).
24 notation "πŸ™" non associative with precedence 90 for @{ 'unit }.
25 interpretation "unif hint unit" 'unit = (gunit _).
26
27 include "nat/nat.ma".
28 include "list/list.ma".
29
30 inductive Expr : Type β‰
31   | Evar : nat β†’ Expr
32   | Eopp : Expr β†’ Expr
33   | Eunit : Expr
34   | Emult : Expr β†’ Expr β†’ Expr.
35   
36 let rec sem (g : group) (e : Expr) (gamma : list (gcarr g)) on e : gcarr g β‰ 
37   match e with
38   [ Evar n β‡’ nth ? gamma πŸ™ n
39   | Eopp x β‡’ (sem g x gamma) ^ -1
40   | Eunit β‡’ πŸ™
41   | Emult x y β‡’ (sem g x gamma) * (sem g y gamma)].
42   
43 notation "γ€šterm 19 x, term 19 gγ€›" non associative with precedence 90 
44 for @{ 'sem $x $g}.
45 interpretation "unif hint sem" 'sem x g = (sem _ x g). 
46   
47 axiom P : βˆ€g:group. gcarr g β†’ Prop.
48 axiom tac : Expr β†’ Expr.
49 axiom start : βˆ€g,x,G.P g γ€šx,Gγ€› β†’ Prop.
50
51 notation "@ t" non associative with precedence 90 for @{ (Ξ»x.x) $t }.
52
53
54 unification hint 0 (βˆ€g:group.βˆ€x:Expr.βˆ€G:list (gcarr g). γ€šEopp x,Gγ€› = (@γ€šx,Gγ€›) ^-1).
55 unification hint 0 (βˆ€g:group.βˆ€x,y.βˆ€G:list (gcarr g). γ€šEmult x y,Gγ€› = (@γ€šx,Gγ€›) * (@γ€šy,Gγ€›)).
56 unification hint 0 (βˆ€g:group.βˆ€G:list (gcarr g). γ€šEunit,Gγ€› = πŸ™).
57 unification hint 2 (βˆ€g:group.βˆ€G:list (gcarr g).βˆ€x:gcarr g. γ€š(Evar 0), (x :: G)γ€› = @x).
58 unification hint 3 (βˆ€g:group.βˆ€G:list (gcarr g).βˆ€n.βˆ€x:gcarr g.(@γ€šEvar n, Gγ€›)=
59    (γ€š(Evar (S n)), (x :: G)γ€›) ) . 
60
61 lemma test : βˆ€g:group.βˆ€x,y:gcarr g. βˆ€h:P ? ((πŸ™ * x) * (x^-1 * y)). 
62    start g ? ? h.
63  
64    y == [| ?, x::? |]  
65    
66    γ€šEvar n, Gγ€› 
67    
68    
69    int: γ€š(Evar (S n)), (x :: G)γ€› = γ€šEvar n, Gγ€›
70                              nth (m) (G)          = γ€šEvar n, Gγ€›
71
72
73 βˆ€x,Ξ“. [| B 0, x::Ξ“ |] = x
74 βˆ€n,y,Ξ“. [| B n, Ξ“ |] = [| B (S n), y::Ξ“ |] 
75 βˆ€e,f. [| Add e f, Ξ“ |] = [| e, Ξ“ |] + [| f, Ξ“ |]
76
77
78 x + x = [| ?1, ?2 |]
79
80 x = [| ?1,?2 |]
81 ?1 β‰ B 0
82 ?2 β‰ x::?3
83
84 x = [| ?4, y::x::?3 |]
85
86 [| ?4, x::?3 |] =?= [| B (S ?n), ?y::?Ξ“ |]
87 x =?= [| B ?n, ?Ξ“ |]
88
89
90 x  =?=   E
91
92 x  =?=  ?,   ? =?= E