1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
17 (* POINTER ORDER ************************************************************)
19 (* Note: precedence relation on redex pointers: p ≺ q
20 to serve as base for the order relations: p < q and p ≤ q *)
21 inductive pprec: relation ptr ≝
22 | pprec_nil : ∀c,q. pprec (◊) (c::q)
23 | ppprc_rc : ∀p,q. pprec (dx::p) (rc::q)
24 | ppprc_sn : ∀p,q. pprec (dx::p) (sn::q)
25 | pprec_comp: ∀c,p,q. pprec p q → pprec (c::p) (c::q)
26 | pprec_skip: pprec (dx::◊) ◊
29 interpretation "'precedes' on pointers"
30 'prec p q = (pprec p q).
32 (* Note: this should go to core_notation *)
33 notation "hvbox(a break ≺ b)"
34 non associative with precedence 45
37 lemma pprec_fwd_in_head: ∀p,q. p ≺ q → in_head q → in_head p.
38 #p #q #H elim H -p -q // /2 width=1/
41 | #c #p #q #_ #IHpq * #H destruct /3 width=1/
45 (* Note: this is p < q *)
46 definition plt: relation ptr ≝ TC … pprec.
48 interpretation "'less than' on redex pointers"
51 (* Note: this is p ≤ q *)
52 definition ple: relation ptr ≝ star … pprec.
54 interpretation "'less or equal to' on redex pointers"
57 lemma ple_step_rc: ∀p,q. p ≺ q → p ≤ q.
61 lemma ple_step_sn: ∀p1,p,p2. p1 ≺ p → p ≤ p2 → p1 ≤ p2.
65 lemma ple_cons: ∀p,q. dx::p ≤ sn::q.
69 lemma ple_skip: dx::◊ ≤ ◊.
73 lemma ple_nil: ∀p. ◊ ≤ p.
77 lemma ple_comp: ∀p1,p2. p1 ≤ p2 → ∀c. (c::p1) ≤ (c::p2).
78 #p1 #p2 #H elim H -p2 // /3 width=3/
81 lemma ple_skip_ple: ∀p. p ≤ ◊ → dx::p ≤ ◊.
82 #p #H @(star_ind_l ??????? H) -p //
83 #p #q #Hpq #_ #H @(ple_step_sn … H) -H /2 width=1/
86 lemma in_head_ple_nil: ∀p. in_head p → p ≤ ◊.
87 #p #H @(in_head_ind … H) -p // /2 width=1/
90 theorem in_head_ple: ∀p. in_head p → ∀q. p ≤ q.
91 #p #H @(in_head_ind … H) -p //
92 #p #_ #IHp * /3 width=1/ * #q /2 width=1/
95 lemma ple_nil_inv_in_head: ∀p. p ≤ ◊ → in_head p.
96 #p #H @(star_ind_l ??????? H) -p // /2 width=3 by pprec_fwd_in_head/
99 lemma ple_inv_in_head: ∀p. (∀q. p ≤ q) → in_head p.
100 /2 width=1 by ple_nil_inv_in_head/