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: term โ Prop โ
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: term โ Prop โ
36 ฮปT. โ[T] โ False.
39 "context-free irreducibility (term)"
40 'NotReducible T = (tif T).
42 (* Basic inversion lemmas ***************************************************)
44 fact trf_inv_atom_aux: โI,T. โ[T] โ T = ๐{I} โ False.
46 [ #V #T #_ #H destruct
47 | #V #T #_ #H destruct
48 | #V #T #_ #H destruct
49 | #V #T #_ #H destruct
52 | #V #W #T #H destruct
56 lemma trf_inv_atom: โI. โ[๐{I}] โ False.
59 fact trf_inv_abst_aux: โW,U,T. โ[T] โ T = ๐{Abst} W. U โ โ[W] โจ โ[U].
61 [ #V #T #HV #H destruct -V T /2/
62 | #V #T #HT #H destruct -V T /2/
63 | #V #T #_ #H destruct
64 | #V #T #_ #H destruct
67 | #V #W0 #T #H destruct
71 lemma trf_inv_abst: โV,T. โ[๐{Abst}V.T] โ โ[V] โจ โ[T].
74 fact trf_inv_appl_aux: โW,U,T. โ[T] โ T = ๐{Appl} W. U โ
75 โจโจ โ[W] | โ[U] | (๐[U] โ False).
77 [ #V #T #_ #H destruct
78 | #V #T #_ #H destruct
79 | #V #T #HV #H destruct -V T /2/
80 | #V #T #HT #H destruct -V T /2/
83 | #V #W0 #T #H destruct -V U
84 @or3_intro2 #H elim (simple_inv_bind โฆ H)
88 lemma trf_inv_appl: โW,U. โ[๐{Appl}W.U] โ โจโจ โ[W] | โ[U] | (๐[U] โ False).
91 lemma tif_inv_abbr: โV,T. ๐[๐{Abbr}V.T] โ False.
94 lemma tif_inv_abst: โV,T. ๐[๐{Abst}V.T] โ ๐[V] โง ๐[T].
97 lemma tif_inv_appl: โV,T. ๐[๐{Appl}V.T] โ โงโง ๐[V] & ๐[T] & ๐[T].
98 #V #T #HVT @and3_intro /3/
99 generalize in match HVT -HVT; elim T -T //
100 * // * #U #T #_ #_ #H elim (H ?) -H /2/
103 lemma tif_inv_cast: โV,T. ๐[๐{Cast}V.T] โ False.
106 (* Basic properties *********************************************************)
108 lemma tif_atom: โI. ๐[๐{I}].
111 lemma tif_abst: โV,T. ๐[V] โ ๐[T] โ ๐[๐ {Abst}V.T].
113 elim (trf_inv_abst โฆ H) -H /2/
116 lemma tif_appl: โV,T. ๐[V] โ ๐[T] โ ๐[T] โ ๐[๐{Appl}V.T].
118 elim (trf_inv_appl โฆ H) -H /2/