Skip to content

Simpler proof of Isomorphism.≲-antisym #1203

@peterthiemann

Description

@peterthiemann

I was surprised to discover that the proof of Isomorphism.≲-antisym can be simplified.
Here is the original proof:

```agda
≲-antisym : ∀ {A B : Set}
→ (A≲B : A ≲ B)
→ (B≲A : B ≲ A)
→ (to A≲B ≡ from B≲A)
→ (from A≲B ≡ to B≲A)
-------------------
→ A ≃ B
≲-antisym A≲B B≲A to≡from from≡to =
record
{ to = to A≲B
; from = from A≲B
; from∘to = from∘to A≲B
; to∘from = λ{y →
begin
to A≲B (from A≲B y)
≡⟨ cong (to A≲B) (cong-app from≡to y) ⟩
to A≲B (to B≲A y)
≡⟨ cong-app to≡from (to B≲A y) ⟩
from B≲A (to B≲A y)
≡⟨ from∘to B≲A y ⟩
y
∎}
}
```

Interestingly, one can pattern match against the arguments to≡from and from≡to resulting in this shorter proof:

≲-antisym A≲B B≲A to≡from@refl from≡to@refl =
  record
    { to      = to A≲B
    ; from    = from A≲B
    ; from∘to = from∘to A≲B
    ; to∘from = from∘to B≲A
    }

Matching against refl works only because records are subject to eta-expansion.
What is the argument for having the longer proof in the text?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions