Skip to content

Commit f957764

Browse files
committed
Single rule which captures all of eta conversion for functions. But I'm not sure if it is sound
1 parent a96ee04 commit f957764

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Agda/Core/Checkers/Converter.agda

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,18 @@ convertWhnf r (TSort s) (TSort t) = convSorts s t
244244
-- -- (x : Name) (f : NameIn α)
245245
-- -- (b : Term x ▸ α) (proof : b ≅ TApp (TVar depPairF) (TVar depPairX) )
246246
-- return (CEtaVar x f b proof)
247-
convertWhnf r (TVar f) (TLam x b) = {!!}
248-
convertWhnf r (TLam x v) (TVar x') = tcError "implement eta-functions 2"
249-
convertWhnf r (TApp _ _) (TLam _ _) = tcError "implement eta-functions 3"
247+
convertWhnf r functionTerm (TLam x b) =
248+
let
249+
depPairX = ⟨ x ⟩ (Zero ⟨ IsZero refl ⟩)
250+
subsetProof = (subWeaken subRefl)
251+
newScope = singBind r
252+
term = TApp (weakenTerm subsetProof functionTerm) (TVar depPairX)
253+
in
254+
do
255+
conversionProof <- convertCheck newScope b term
256+
return (CEtaVar2 x functionTerm b conversionProof)
257+
-- convertWhnf r (TLam x v) (TVar x') = tcError "implement eta-functions 2"
258+
-- convertWhnf r (TApp _ _) (TLam _ _) = tcError "implement eta-functions 3"
250259
convertWhnf r _ _ = tcError "two terms are not the same and aren't convertible"
251260

252261
{-# COMPILE AGDA2HS convertWhnf #-}

0 commit comments

Comments
 (0)