--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/reduction/ifr.ma".
+
+include "delayed_updating/unwind/unwind2_constructors.ma".
+include "delayed_updating/unwind/unwind2_preterm_fsubst.ma".
+include "delayed_updating/unwind/unwind2_preterm_eq.ma".
+include "delayed_updating/unwind/unwind2_prototerm_lift.ma".
+include "delayed_updating/unwind/unwind2_rmap_head.ma".
+
+include "delayed_updating/substitution/fsubst_eq.ma".
+include "delayed_updating/substitution/lift_prototerm_eq.ma".
+
+include "delayed_updating/syntax/prototerm_proper_constructors.ma".
+include "delayed_updating/syntax/path_head_structure.ma".
+include "delayed_updating/syntax/path_structure_depth.ma".
+include "delayed_updating/syntax/path_structure_reverse.ma".
+include "delayed_updating/syntax/path_depth_reverse.ma".
+
+(* IMMEDIATE FOCUSED REDUCTION **********************************************)
+
+(* Constructions with unwind ************************************************)
+
+theorem ifr_unwind_bi (f) (p) (q) (t1) (t2):
+ t1 Ļµ š ā t1ā(pāš¦) Ļµ š ā
+ t1 ā”š[p,q] t2 ā ā¼[f]t1 ā”š[āp,āq] ā¼[f]t2.
+#f #p #q #t1 #t2 #H1t1 #H2t1
+* #n * #H1n #Ht1 #Ht2
+@(ex_intro ā¦ (āāāq)) @and3_intro
+[ -H0t1 -Ht1 -Ht2
+ >structure_L_sn >structure_reverse
+ >H1n >path_head_structure_depth <H1n -H1n //
+| lapply (in_comp_unwind2_path_term f ā¦ Ht1) -Ht2 -Ht1 -H0t1
+ <unwind2_path_d_dx <depth_structure
+ >list_append_rcons_sn in H1n; <reverse_append #H1n
+ lapply (unwind2_rmap_append_pap_closed f ā¦ H1n)
+ <reverse_lcons <depth_L_dx #H2n
+ lapply (eq_inv_ninj_bi ā¦ H2n) -H2n #H2n <H2n -H2n -H1n #Ht1 //
+| lapply (unwind2_term_eq_repl_dx f ā¦ Ht2) -Ht2 #Ht2
+ @(subset_eq_trans ā¦ Ht2) -t2
+ @(subset_eq_trans ā¦ (unwind2_term_fsubst ā¦))
+ [ @fsubst_eq_repl [ // | // ]
+(*
+ @(subset_eq_trans ā¦ (unwind2_term_iref ā¦))
+ @(subset_eq_canc_sn ā¦ (lift_term_eq_repl_dx ā¦))
+ [ @unwind2_term_grafted_S /2 width=2 by ex_intro/ | skip ] -Ht1
+ @(subset_eq_trans ā¦ (unwind2_lift_term_after ā¦))
+ @unwind2_term_eq_repl_sn
+(* Note: crux of the proof begins *)
+ @nstream_eq_inv_ext #m
+ <tr_compose_pap <tr_compose_pap
+ <tr_uni_pap <tr_uni_pap <tr_pap_plus
+ >list_append_rcons_sn in H1n; <reverse_append #H1n
+ lapply (unwind2_rmap_append_pap_closed f ā¦ H1n) #H2n
+ >nrplus_inj_dx in ā¢ (???%); <H2n -H2n
+ lapply (tls_unwind2_rmap_append_closed f ā¦ H1n) #H2n
+ <(tr_pap_eq_repl ā¦ H2n) -H2n -H1n //
+(* Note: crux of the proof ends *)
+*)
+ | //
+ | /2 width=2 by ex_intro/
+ | //
+ ]
+]
+qed.