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 (**************************************************************************)
15 include "Basic_2/grammar/term_simple.ma".
17 (* CONTEXT-FREE REDUCIBLE AND IRREDUCIBLE TERMS *****************************)
20 inductive trf: predicate term โ
21 | trf_abst_sn: โV,T. trf V โ trf (๐{Abst} V. T)
22 | trf_abst_dx: โV,T. trf T โ trf (๐{Abst} V. T)
23 | trf_appl_sn: โV,T. trf V โ trf (๐{Appl} V. T)
24 | trf_appl_dx: โV,T. trf T โ trf (๐{Appl} V. T)
25 | trf_abbr : โV,T. trf (๐{Abbr} V. T)
26 | trf_cast : โV,T. trf (๐{Cast} V. T)
27 | trf_beta : โV,W,T. trf (๐{Appl} V. ๐{Abst} W. T)
31 "context-free reducibility (term)"
32 'Reducible T = (trf T).
34 (* irreducible terms *)
35 definition tif: predicate term โ ฮปT. โ[T] โ False.
38 "context-free irreducibility (term)"
39 'NotReducible T = (tif T).
41 (* Basic inversion lemmas ***************************************************)
43 fact trf_inv_atom_aux: โI,T. โ[T] โ T = ๐{I} โ False.
45 [ #V #T #_ #H destruct
46 | #V #T #_ #H destruct
47 | #V #T #_ #H destruct
48 | #V #T #_ #H destruct
51 | #V #W #T #H destruct
55 lemma trf_inv_atom: โI. โ[๐{I}] โ False.
58 fact trf_inv_abst_aux: โW,U,T. โ[T] โ T = ๐{Abst} W. U โ โ[W] โจ โ[U].
60 [ #V #T #HV #H destruct /2 width=1/
61 | #V #T #HT #H destruct /2 width=1/
62 | #V #T #_ #H destruct
63 | #V #T #_ #H destruct
66 | #V #W0 #T #H destruct
70 lemma trf_inv_abst: โV,T. โ[๐{Abst}V.T] โ โ[V] โจ โ[T].
73 fact trf_inv_appl_aux: โW,U,T. โ[T] โ T = ๐{Appl} W. U โ
74 โจโจ โ[W] | โ[U] | (๐[U] โ False).
76 [ #V #T #_ #H destruct
77 | #V #T #_ #H destruct
78 | #V #T #HV #H destruct /2 width=1/
79 | #V #T #HT #H destruct /2 width=1/
82 | #V #W0 #T #H destruct
83 @or3_intro2 #H elim (simple_inv_bind โฆ H)
87 lemma trf_inv_appl: โW,U. โ[๐{Appl}W.U] โ โจโจ โ[W] | โ[U] | (๐[U] โ False).
90 lemma tif_inv_abbr: โV,T. ๐[๐{Abbr}V.T] โ False.
93 lemma tif_inv_abst: โV,T. ๐[๐{Abst}V.T] โ ๐[V] โง ๐[T].
96 lemma tif_inv_appl: โV,T. ๐[๐{Appl}V.T] โ โงโง ๐[V] & ๐[T] & ๐[T].
97 #V #T #HVT @and3_intro /3 width=1/
98 generalize in match HVT; -HVT elim T -T //
99 * // * #U #T #_ #_ #H elim (H ?) -H /2 width=1/
102 lemma tif_inv_cast: โV,T. ๐[๐{Cast}V.T] โ False.
105 (* Basic properties *********************************************************)
107 lemma tif_atom: โI. ๐[๐{I}].
110 lemma tif_abst: โV,T. ๐[V] โ ๐[T] โ ๐[๐ {Abst}V.T].
112 elim (trf_inv_abst โฆ H) -H /2 width=1/
115 lemma tif_appl: โV,T. ๐[V] โ ๐[T] โ ๐[T] โ ๐[๐{Appl}V.T].
117 elim (trf_inv_appl โฆ H) -H /2 width=1/