Skip to content

Commit a146e6c

Browse files
committed
Working example for function eta-conversion where TLam is on left and TVar is on right
1 parent 71e7668 commit a146e6c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Agda/Core/Checkers/Converter.agda

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ convertWhnf r functionTerm (TLam x b) =
239239
do
240240
conversionProof <- convertCheck newScope b term
241241
return (CEtaFunctions x functionTerm b conversionProof)
242-
-- convertWhnf r (TLam x v) (TVar x') = tcError "implement eta-functions 2"
243-
-- convertWhnf r (TApp _ _) (TLam _ _) = tcError "implement eta-functions 3"
242+
convertWhnf r (TLam x v) (TVar x') = tcError "implement eta-functions 2"
244243
convertWhnf r _ _ = tcError "two terms are not the same and aren't convertible"
245244

246245
{-# COMPILE AGDA2HS convertWhnf #-}

test/EtaFunctions.agda

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ data Nat : Set where
1515
comp : (A B C : Set) (B C) (A B) A C
1616
comp = λ (A B C : Set) λ f λ g λ x f (g x)
1717

18-
const : Nat Nat Nat
19-
const = λ x λ y x
18+
const : (A : Set) A A A
19+
const = λ A λ x λ y x
2020

2121
addOne : Nat -> Nat
2222
addOne = suc
@@ -27,9 +27,9 @@ addTwo = λ x → (suc (suc x))
2727
addTwoAfterAddOne : Nat Nat
2828
addTwoAfterAddOne = λ x (comp Nat Nat Nat addTwo addOne x)
2929

30-
eta-higher : (A B C : Set) (f : A B C) (λ x λ y f x y) ≡ f
30+
eta-higher : (A B C : Set) (f : A B C) (λ x λ y f (const A x x) y) ≡ f
3131
eta-higher = λ A B C λ f refl
3232

33-
eta-counterexample-simple : addOne ≡ (λ x (suc (const x x)))
33+
eta-counterexample-simple : addOne ≡ (λ x (suc (const Nat x x)))
3434
eta-counterexample-simple = refl
3535

0 commit comments

Comments
 (0)