Skip to content

Assertion patterns are too permissive: only the type is checked #2

@yanok

Description

@yanok

I don't know if it's really a concern, but starting from the Dependent variant we can define an equality type and prove things about equalities. Unfortunately, the way unification is currently defined allows proving injectivity for an arbitrary function and thus making the whole thing inconsistent.

Here is the code:

data Eq (a : Type) (x : a) (y : a) where
| Refl (a : Type) (x : a) : Eq a x x
end

let inj :
  (a : Type) ->
  (b : Type) ->
  (f : a -> b) ->
  (x : a) ->
  (y : a) ->
  (eq : Eq b (f x) (f y)) ->
  Eq a x y =
  \a -> \b -> \f -> \x -> \y -> \eq ->
  case y || eq
  motive (y' : a) || (eq' : Eq b (f x) (f y')) || Eq a x y'
  of
  | .x || Refl .b .(f x) -> Refl a x
  end
end

I would love to see any suggestion how to fix that.

PS It also type checks with Dependent.Monadic variant... It's not clear for me why as there is no unification involved...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions