@@ -41,7 +41,7 @@ pub fn mm_rules() -> Vec<Rewrite<Rise, RiseAnalysis>> {
4141 // rewrite!("map-par"; "(typeOf map (fun (fun ?dt0 ?dt1) (fun (arrT ?n0 ?dt0) (arrT ?n0 ?dt1))))" => { pat("(typeOf mapPar (fun (fun ?dt0 ?dt1) (fun (arrT ?n0 ?dt0) (arrT ?n0 ?dt1))))") }),
4242 ] ;
4343 algorithmic. extend ( [
44- // OLD: rewrite!("eta-reduction"; "(typeOf (lam (typeOf (app (typeOf ?0 ?tAny0) (typeOf %0 ?t0)) ?tAny1)) (fun ?t1 ?t2))" => { NotFreeIn::new("?0", 0, Shifted::new("?0", "?1", -1, 1, ShiftedCheck::new("?t1", "?t0", 1, 0, pat("(typeOf ?1 (fun ?t1 ?t2))")))) }),
44+ // OLD: rewrite!("eta-reduction"; "(typeOf (lam (typeOf (app (typeOf ?0 ?tAny0) (typeOf %e0 ?t0)) ?tAny1)) (fun ?t1 ?t2))" => { NotFreeIn::new("?0", 0, Shifted::new("?0", "?1", -1, 1, ShiftedCheck::new("?t1", "?t0", 1, 0, pat("(typeOf ?1 (fun ?t1 ?t2))")))) }),
4545 // OLD: rewrite!("beta"; "(app (lam ?body) ?e)" => { BetaExtractApplier::new("?body", "?e") }),
4646 // rewrite!("beta"; "(app (typeOf (lam (typeOf ?body ?bodyTy)) ?lamTy) (typeOf ?subs ?subsTy))" => { BetaExtractApplier::new("?body", "?subs", Kind::Expr) }),
4747 // rewrite!("beta-nat"; "(natApp (typeOf (natLam (typeOf ?body ?bodyTy)) ?lamTy) (typeOf ?subs ?subsTy))" => { BetaExtractApplier::new("?body", "?subs",Kind::Nat) }),
@@ -192,22 +192,22 @@ mod tests {
192192 }
193193 // (λ. (λ. ((λ. (0 1)) (0 1)))) --> (λ. (λ. ((0 1) 0)))
194194 // (λ. (0 1)) (0 1) --> (0 1) 0
195- check ( "(app %0 %1 )" , "(app %0 %1 )" , "(app (app %0 %1 ) %0 )" ) ;
196- // r1 = (app (lam (app "%6 " (app "%5 " "%0 "))) "%0 ")
197- // r2 = (app (lam (app "%6 " r1)) "%0 ")
198- // r3 = (app (lam (app "%6 " r2)) %0 )
199- // (app map (lam (app "%6 " r3)))
200- // --> (app map (lam (app "%6 " (app "%5 " (app "%4 " (app "%3 " (app "%2 " "%0 ")))))))
201- check ( "(app %6 (app %5 %0 ))" , "%0 " , "(app %5 (app %4 %0 ))" ) ;
195+ check ( "(app %e0 %e1 )" , "(app %e0 %e1 )" , "(app (app %e0 %e1 ) %e0 )" ) ;
196+ // r1 = (app (lam (app "%e6 " (app "%e5 " "%e0 "))) "%e0 ")
197+ // r2 = (app (lam (app "%e6 " r1)) "%e0 ")
198+ // r3 = (app (lam (app "%e6 " r2)) %e0 )
199+ // (app map (lam (app "%e6 " r3)))
200+ // --> (app map (lam (app "%e6 " (app "%e5 " (app "%e4 " (app "%e3 " (app "%e2 " "%e0 ")))))))
201+ check ( "(app %e6 (app %e5 %e0 ))" , "%e0 " , "(app %e5 (app %e4 %e0 ))" ) ;
202202 check (
203- "(app %6 (app %5 (app %4 %0 )))" ,
204- "%0 " ,
205- "(app %5 (app %4 (app %3 %0 )))" ,
203+ "(app %e6 (app %e5 (app %e4 %e0 )))" ,
204+ "%e0 " ,
205+ "(app %e5 (app %e4 (app %e3 %e0 )))" ,
206206 ) ;
207207 check (
208- "(app %6 (app %5 (app %4 (app %3 %0 ))))" ,
209- "%0 " ,
210- "(app %5 (app %4 (app %3 (app %2 %0 ))))" ,
208+ "(app %e6 (app %e5 (app %e4 (app %e3 %e0 ))))" ,
209+ "%e0 " ,
210+ "(app %e5 (app %e4 (app %e3 (app %e2 %e0 ))))" ,
211211 ) ;
212212 }
213213
0 commit comments