]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/bdd_term.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / bdd_term.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/xoa/or_5.ma".
16 include "ground/xoa/ex_3_1.ma".
17 include "ground/xoa/ex_4_2.ma".
18 include "ground/xoa/ex_4_3.ma".
19 include "ground/xoa/ex_5_3.ma".
20 include "delayed_updating/syntax/term_constructors.ma".
21 include "delayed_updating/notation/relations/in_predicate_d_phi_1.ma".
22
23 (* BY-DEPTH DELAYED (BDD) TERM **********************************************)
24
25 inductive bdd: predicate term โ‰
26 | bdd_oref: โˆ€n. bdd #n
27 | bdd_iref: โˆ€t,n. bdd t โ†’ bdd ๐›—n.t
28 | bdd_abst: โˆ€t. bdd t โ†’ bdd ๐›Œ.t
29 | bdd_appl: โˆ€u,t. bdd u โ†’ bdd t โ†’ bdd @u.t
30 .
31
32 interpretation
33   "well-formed by-depth delayed (term)"
34   'InPredicateDPhi t = (bdd t).
35
36 (* Basic destructions *******************************************************)
37
38 lemma bdd_inv_in_com_gen:
39       โˆ€t,p. t ฯต ๐ƒ๐›— โ†’ p ฯตโฌฆ t โ†’
40       โˆจโˆจ โˆƒโˆƒn. #n = t & ๐—ฑโจnโฉ;๐ž = p
41        | โˆƒโˆƒu,q,n. u ฯต ๐ƒ๐›— & q ฯตโฌฆ u & ๐›—n.u = t & ๐—ฑโจnโฉ;q = p
42        | โˆƒโˆƒu,q. u ฯต ๐ƒ๐›— & q ฯตโฌฆ u & ๐›Œ.u = t & ๐—Ÿ;q = p
43        | โˆƒโˆƒv,u,q. v ฯต ๐ƒ๐›— & u ฯต ๐ƒ๐›— & q ฯตโฌฆ u & @v.u = t & ๐—”;q = p
44        | โˆƒโˆƒv,u,q. v ฯต ๐ƒ๐›— & u ฯต ๐ƒ๐›— & q ฯตโฌฆ v & @v.u = t & ๐—ฆ;q = p
45 .
46 #t #p *
47 [ #n * /3 width=3 by or5_intro0, ex2_intro/
48 | #u #n #Hu * #q #Hq #Hp /3 width=7 by ex4_3_intro, or5_intro1/
49 | #u #Hu * #q #Hq #Hp /3 width=6 by or5_intro2, ex4_2_intro/
50 | #v #u #Hv #Hu * * #q #Hq #Hp /3 width=8 by ex5_3_intro, or5_intro3, or5_intro4/
51 ]
52 qed-.
53
54 lemma bdd_inv_in_com_d:
55       โˆ€t,q,n. t ฯต ๐ƒ๐›— โ†’ ๐—ฑโจnโฉ;q ฯตโฌฆ t โ†’
56       โˆจโˆจ โˆงโˆง #n = t & ๐ž = q
57        | โˆƒโˆƒu. u ฯต ๐ƒ๐›— & q ฯตโฌฆ u & ๐›—n.u = t
58 .
59 #t #q #n #Ht #Hq
60 elim (bdd_inv_in_com_gen โ€ฆ Ht Hq) -Ht -Hq *
61 [ #n0 #H1 #H2 destruct /3 width=1 by or_introl, conj/
62 | #u0 #q0 #n0 #Hu0 #Hq0 #H1 #H2 destruct /3 width=4 by ex3_intro, or_intror/
63 | #u0 #q0 #_ #_ #_ #H0 destruct
64 | #v0 #u0 #q0 #_ #_ #_ #_ #H0 destruct
65 | #v0 #u0 #q0 #_ #_ #_ #_ #H0 destruct
66 ]
67 qed-.
68
69 lemma bdd_inv_in_ini_d:
70       โˆ€t,q,n. t ฯต ๐ƒ๐›— โ†’ ๐—ฑโจnโฉ;q ฯตโ–ต t โ†’
71       โˆจโˆจ โˆงโˆง #n = t & ๐ž = q
72        | โˆƒโˆƒu. u ฯต ๐ƒ๐›— & q ฯตโ–ต u & ๐›—n.u = t
73 .
74 #t #q #n #Ht * #r #Hq
75 elim (bdd_inv_in_com_d โ€ฆ Ht Hq) -Ht -Hq *
76 [ #H1 #H2
77   elim (eq_inv_list_empty_append โ€ฆ H2) -H2 #H2 #_ destruct
78   /3 width=1 by or_introl, conj/
79 | #u #Hu #Hq #H1 destruct
80   /4 width=4 by ex3_intro, ex_intro, or_intror/
81 ]
82 qed-.
83
84 lemma pippo:
85       โˆ€l,n,p,t. t ฯต ๐ƒ๐›— โ†’ p,๐—ฑโจnโฉ ฯตโ–ต t โ†’ p,l ฯตโ–ต t โ†’ ๐—ฑโจnโฉ = l.
86 #l #n #p elim p -p
87 [ #t #Ht <list_cons_comm <list_cons_comm #Hn #Hl
88   elim (bdd_inv_in_ini_d โ€ฆ Ht Hn) -Ht -Hn *
89   [ #H1 #_ destruct
90     elim (term_in_ini_inv_lcons_oref โ€ฆ Hl) -Hl //
91   | #u #_ #_ #H1 destruct
92     elim (term_in_ini_inv_lcons_iref โ€ฆ Hl) -Hl //
93   ]
94 | * [ #m ] #p #IH #t #Ht
95   <list_cons_shift <list_cons_shift #Hn #Hl
96   [ elim (bdd_inv_in_ini_d โ€ฆ Ht Hn) -Ht -Hn *
97     [ #_ #H
98       elim (eq_inv_list_empty_rcons ??? H)
99     | #u #Hu #Hp #H destruct
100       elim (term_in_ini_inv_lcons_iref โ€ฆ Hl) -Hl #_ #Hl
101       @(IH โ€ฆ Hu) //
102     ]
103   |
104   ]
105 ]