]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/relocation/rtmap_sor.ma
- ground_2: some additions
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / relocation / rtmap_sor.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 "ground_2/notation/relations/runion_3.ma".
16 include "ground_2/relocation/rtmap_sle.ma".
17
18 coinductive sor: relation3 rtmap rtmap rtmap ≝
19 | sor_pp: ∀f1,f2,f,g1,g2,g. sor f1 f2 f → ↑f1 = g1 → ↑f2 = g2 → ↑f = g → sor g1 g2 g
20 | sor_np: ∀f1,f2,f,g1,g2,g. sor f1 f2 f → ⫯f1 = g1 → ↑f2 = g2 → ⫯f = g → sor g1 g2 g
21 | sor_pn: ∀f1,f2,f,g1,g2,g. sor f1 f2 f → ↑f1 = g1 → ⫯f2 = g2 → ⫯f = g → sor g1 g2 g
22 | sor_nn: ∀f1,f2,f,g1,g2,g. sor f1 f2 f → ⫯f1 = g1 → ⫯f2 = g2 → ⫯f = g → sor g1 g2 g
23 .
24
25 interpretation "union (rtmap)"
26    'RUnion f1 f2 f = (sor f1 f2 f).
27
28 (* Basic inversion lemmas ***************************************************)
29
30 lemma sor_inv_ppx: ∀g1,g2,g. g1 ⋓ g2 ≡ g → ∀f1,f2. ↑f1 = g1 → ↑f2 = g2 →
31                    ∃∃f. f1 ⋓ f2 ≡ f & ↑f = g.
32 #g1 #g2 #g * -g1 -g2 -g
33 #f1 #f2 #f #g1 #g2 #g #Hf #H1 #H2 #H0 #x1 #x2 #Hx1 #Hx2 destruct
34 try (>(injective_push … Hx1) -x1) try (>(injective_next … Hx1) -x1)
35 try elim (discr_push_next … Hx1) try elim (discr_next_push … Hx1)
36 try (>(injective_push … Hx2) -x2) try (>(injective_next … Hx2) -x2)
37 try elim (discr_push_next … Hx2) try elim (discr_next_push … Hx2)
38 /2 width=3 by ex2_intro/
39 qed-.
40
41 lemma sor_inv_npx: ∀g1,g2,g. g1 ⋓ g2 ≡ g → ∀f1,f2. ⫯f1 = g1 → ↑f2 = g2 →
42                    ∃∃f. f1 ⋓ f2 ≡ f & ⫯f = g.
43 #g1 #g2 #g * -g1 -g2 -g
44 #f1 #f2 #f #g1 #g2 #g #Hf #H1 #H2 #H0 #x1 #x2 #Hx1 #Hx2 destruct
45 try (>(injective_push … Hx1) -x1) try (>(injective_next … Hx1) -x1)
46 try elim (discr_push_next … Hx1) try elim (discr_next_push … Hx1)
47 try (>(injective_push … Hx2) -x2) try (>(injective_next … Hx2) -x2)
48 try elim (discr_push_next … Hx2) try elim (discr_next_push … Hx2)
49 /2 width=3 by ex2_intro/
50 qed-.
51
52 lemma sor_inv_pnx: ∀g1,g2,g. g1 ⋓ g2 ≡ g → ∀f1,f2. ↑f1 = g1 → ⫯f2 = g2 →
53                    ∃∃f. f1 ⋓ f2 ≡ f & ⫯f = g.
54 #g1 #g2 #g * -g1 -g2 -g
55 #f1 #f2 #f #g1 #g2 #g #Hf #H1 #H2 #H0 #x1 #x2 #Hx1 #Hx2 destruct
56 try (>(injective_push … Hx1) -x1) try (>(injective_next … Hx1) -x1)
57 try elim (discr_push_next … Hx1) try elim (discr_next_push … Hx1)
58 try (>(injective_push … Hx2) -x2) try (>(injective_next … Hx2) -x2)
59 try elim (discr_push_next … Hx2) try elim (discr_next_push … Hx2)
60 /2 width=3 by ex2_intro/
61 qed-.
62
63 lemma sor_inv_nnx: ∀g1,g2,g. g1 ⋓ g2 ≡ g → ∀f1,f2. ⫯f1 = g1 → ⫯f2 = g2 →
64                    ∃∃f. f1 ⋓ f2 ≡ f & ⫯f = g.
65 #g1 #g2 #g * -g1 -g2 -g
66 #f1 #f2 #f #g1 #g2 #g #Hf #H1 #H2 #H0 #x1 #x2 #Hx1 #Hx2 destruct
67 try (>(injective_push … Hx1) -x1) try (>(injective_next … Hx1) -x1)
68 try elim (discr_push_next … Hx1) try elim (discr_next_push … Hx1)
69 try (>(injective_push … Hx2) -x2) try (>(injective_next … Hx2) -x2)
70 try elim (discr_push_next … Hx2) try elim (discr_next_push … Hx2)
71 /2 width=3 by ex2_intro/
72 qed-.
73
74 (* Basic properties *********************************************************)
75
76 let corec sor_refl: ∀f. f ⋓ f ≡ f ≝ ?.
77 #f cases (pn_split f) * #g #H
78 [ @(sor_pp … H H H) | @(sor_nn … H H H) ] -H //
79 qed.
80
81 let corec sor_sym: ∀f1,f2,f. f1 ⋓ f2 ≡ f → f2 ⋓ f1 ≡ f ≝ ?.
82 #f1 #f2 #f * -f1 -f2 -f
83 #f1 #f2 #f #g1 #g2 #g #Hf * * * -g1 -g2 -g
84 [ @sor_pp | @sor_pn | @sor_np | @sor_nn ] /2 width=7 by/
85 qed-.