]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda/pointer.ma
8d7afa1aa877867ccdc567cb2d72a6b75d5f0d2b
[helm.git] / matita / matita / contribs / lambda / pointer.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 "preamble.ma".
16
17 (* POINTER ******************************************************************)
18
19 (* Policy: pointer step metavariables: c *)
20 (* Note: this is a step of a path in the tree representation of a term:
21          rc (rectus)  : proceed on the argument of an abstraction
22          sn (sinister): proceed on the left argument of an application
23          dx (dexter)  : proceed on the right argument of an application
24 *)
25 inductive ptr_step: Type[0] ≝
26 | rc: ptr_step
27 | sn: ptr_step
28 | dx: ptr_step
29 .
30
31 definition is_dx: predicate ptr_step ≝ λc. dx = c.
32
33 (* Policy: pointer metavariables: p, q *)
34 (* Note: this is a path in the tree representation of a term, heading to a redex *)
35 definition ptr: Type[0] ≝ list ptr_step.
36
37 (* Note: a redex is "in the head" when is not under an abstraction nor in the lefr argument of an application *)
38 definition in_head: predicate ptr ≝ All … is_dx.
39
40 lemma in_head_ind: ∀R:predicate ptr. R (◊) →
41                    (∀p. in_head p → R p → R (dx::p)) →
42                    ∀p. in_head p → R p.
43 #R #H #IH #p elim p -p // -H *
44 #p #IHp * #H1 #H2 destruct /3 width=1/
45 qed-.