Skip to content

Instantly share code, notes, and snippets.

@MevenBertrand
Created November 7, 2024 22:07
Show Gist options
  • Select an option

  • Save MevenBertrand/855957ab59270c0c0d825bbacfd2417b to your computer and use it in GitHub Desktop.

Select an option

Save MevenBertrand/855957ab59270c0c0d825bbacfd2417b to your computer and use it in GitHub Desktop.
A demo file for failure of definitional functoriality in Lean
inductive Pos : Type where
| one : Pos
| succ : Pos → Pos
def Pos.toNat : Pos → Nat
| Pos.one => 1
| Pos.succ n => n.toNat + 1
instance : Coe Pos Nat where
coe := Pos.toNat
instance : Coe Nat Int where
coe x := ↑x
instance [f : CoeTC X Y] : CoeTC (List X) (List Y) where
coe l := List.map (f.coe) l
example (l : List Pos) : l = ((l : List Nat) : List Int) := rfl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment