10 world.DLOG(
"Derive lambda: {}", def);
20 auto [arg_ty, ret_pi] = lam->type()->doms<2>();
21 auto deriv_all_args = deriv->var();
22 Ref deriv_arg = deriv->
var(0_s)->
set(
"arg");
30 partial_pullback[deriv_arg] = arg_id_pb;
32 auto ret_var = deriv->var(1);
34 partial_pullback[ret_var] = ret_pb;
36 shadow_pullback[deriv_all_args] =
world.
tuple({arg_id_pb, ret_pb});
37 world.DLOG(
"pullback for argument {} : {} is {} : {}", deriv_arg, deriv_arg->
type(), arg_id_pb, arg_id_pb->
type());
38 world.DLOG(
"args shadow pb is {} : {}", shadow_pullback[deriv_all_args], shadow_pullback[deriv_all_args]->type());
43 augmented[def] = deriv;
44 world.DLOG(
"Associate {} with {}", def, deriv);
45 world.DLOG(
" {} : {}", lam, lam->type());
46 world.DLOG(
" {} : {}", deriv, deriv->type());
47 augmented[lam->var()] = deriv->var();
48 world.DLOG(
"Associate vars {} with {}", lam->var(), deriv->var());
61 auto new_body =
augment(lam->body(), lam, deriv);
62 deriv->set(
true, new_body);