(**************************************************************************) (* ___ *) (* ||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 "ground/notation/functions/cocompose_2.ma". include "ground/relocation/rtmap_coafter.ma". (* RELOCATION P-STREAM ******************************************************) rec definition fun0 (p1:pnat) on p1: gr_map → pnat. * * [ | #p2 #f2 @(𝟏) ] #f2 cases p1 -p1 [ @(𝟏) ] #p1 @(↑(fun0 p1 f2)) defined. rec definition fun2 (p1:pnat) on p1: gr_map → gr_map. * * [ | #p2 #f2 @(p2⨮f2) ] #f2 cases p1 -p1 [ @f2 ] #p1 @(fun2 p1 f2) defined. rec definition fun1 (p1:pnat) (f1:gr_map) on p1: gr_map → gr_map. * * [ | #p2 #f2 @(p1⨮f1) ] #f2 cases p1 -p1 [ @f1 ] #p1 @(fun1 p1 f1 f2) defined. corec definition cocompose: gr_map → gr_map → gr_map. #f2 * #p1 #f1 @(stream_cons … (fun0 p1 f2)) @(cocompose (fun2 p1 f2) (fun1 p1 f1 f2)) defined. interpretation "functional co-composition (nstream)" 'CoCompose f1 f2 = (cocompose f1 f2). (* Basic properties on funs *************************************************) (* Note: we need theese since matita blocks recursive δ when ι is blocked *) lemma fun0_xn: ∀f2,p1. 𝟏 = fun0 p1 (↑f2). * #p2 #f2 * // qed. lemma fun2_xn: ∀f2,p1. f2 = fun2 p1 (↑f2). * #p2 #f2 * // qed. lemma fun1_xxn: ∀f2,f1,p1. fun1 p1 f1 (↑f2) = p1⨮f1. * #p2 #f2 #f1 * // qed. (* Basic properties on cocompose *********************************************) lemma cocompose_rew: ∀f2,f1,p1. (fun0 p1 f2)⨮(fun2 p1 f2)~∘(fun1 p1 f1 f2) = f2 ~∘ (p1⨮f1). #f2 #f1 #p1 <(stream_rew … (f2~∘(p1⨮f1))) normalize // qed. (* Basic inversion lemmas on compose ****************************************) lemma cocompose_inv_ppx: ∀f2,f1,f,x. (⫯f2) ~∘ (⫯f1) = x⨮f → ∧∧ 𝟏 = x & f2 ~∘ f1 = f. #f2 #f1 #f #x gr_next_unfold #H cases (cocompose_inv_nxx … H) -H /3 width=5 by gr_coafter_next/ ] qed-. theorem coafter_total: ∀f2,f1. f2 ~⊚ f1 ≘ f2 ~∘ f1. /2 width=1 by coafter_total_aux/ qed.