Skip to content

Commit 6c52c8d

Browse files
committed
eta-counterexample gets accepted by agda-core(?)
1 parent 223b5a6 commit 6c52c8d

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

test/EtaFunctions.agda

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ addTwoAfterAddOne = λ x → (comp Nat Nat Nat addTwo addOne x)
2929
eta-higher : (A B C : Set) (f : A B C) (λ x λ y f x y) ≡ f
3030
eta-higher = λ A B C λ f refl
3131

32-
33-
test : addTwoAfterAddOne ≡ (λ x (comp Nat Nat Nat addTwo addOne) x)
34-
test = refl
32+
-- In this case, the type which Agda infers is addTwoAfterAddOne ≡ comp Nat Nat Nat addTwo addOne
33+
-- So the agda-core typechecker would expand `addTwoAfterAddOne`, which expands to λ x → (comp Nat Nat Nat addTwo addOne x)
34+
-- and the remaining equation would need to be solved by either eta-reduction or eta-expansion
35+
eta-counterexample : addTwoAfterAddOne ≡ (λ x (comp Nat Nat Nat addTwo addOne) x)
36+
eta-counterexample = refl

test/EtaFunctionsChurch.agda

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ Id = λ A x y → (P : A → Set) → P x → P y
1515
refl : (A : Set) (x : A) Id A x x
1616
refl = λ A x P p p
1717

18-
id_typ : Set Set
19-
id_typ = λ A A
20-
21-
s : Set Set
22-
s = λ typ id_typ typ
23-
24-
s' : (Set Set) Set Set
25-
s' = λ f λ typ f typ
26-
27-
id : (A : Set) A A
28-
id = λ A x x
29-
3018
idbool : Bool Bool
3119
idbool = λ b b
3220

@@ -43,19 +31,25 @@ addTwo = λ x → (suc (suc x))
4331
addTwoAfterAddOne : Nat Nat
4432
addTwoAfterAddOne = λ x (comp Nat Nat Nat addTwo addOne x)
4533

46-
47-
-- eta-functions : {A B : Set} (f : A → B) → (f ≡ (λ x → f x))
48-
-- eta-functions = λ h → refl
49-
5034
eta-functions_expl : (A B : Set) (f : A B) (Id (A B) f (λ x f x))
5135
eta-functions_expl = λ A B λ f refl (A B) f
5236

5337
eta-functions_two : (A B C : Set) (f : B C) (g : A B) (Id (A C) (comp A B C f g) (λ x (comp A B C f g) x))
5438
eta-functions_two = λ A B C λ f λ g refl (A C) (comp A B C f g)
5539

40+
-- apply : (A B : Set) → (A → B) → A → B
41+
-- apply = λ A B → λ f → λ x → f x
42+
43+
-- eta-apply : (A B : Set) → (f : A → B) → Id (apply f) f
44+
45+
46+
eta-counterexample : Id (Nat Nat) addTwoAfterAddOne (λ x (comp Nat Nat Nat addTwo addOne) x)
47+
eta-counterexample = refl (Nat Nat) addTwoAfterAddOne
48+
49+
50+
eta-counterexample-simple : Id (Nat Nat) addOne (λ y (λ x (suc x)) y)
51+
eta-counterexample-simple = refl (Nat Nat) addOne
5652

57-
test : Id addTwoAfterAddOne (λ x (comp Nat Nat Nat addTwo addOne) x)
58-
test = refl
5953

6054
-- eta-higher : (A B C : Set) → (f : A → B → C) → Id (λ x → λ y → f x y) f
6155
-- eta-higher = λ A B C → λ f → refl

0 commit comments

Comments
 (0)