Agda: Exploit: Injective type constructors and abstract prove false

Created on 11 Oct 2016  Â·  3Comments  Â·  Source: agda/agda

{-# OPTIONS --injective-type-constructors #-}

open import Common.Prelude
open import Common.Equality

abstract
  f : Bool → Bool
  f x = true

  same : f true ≡ f false
  same = refl

not-same : f true ≡ f false → ⊥
not-same ()

absurd : ⊥
absurd = not-same same
abstract false injectivity bug unification

Most helpful comment

While working on #3959, I have found a way to revive this proof of false
using the INJECTIVE pragma:

{-# OPTIONS --safe #-}

open import Agda.Builtin.Bool
open import Agda.Builtin.Equality

data ⊥ : Set where

abstract
  f : Bool → Bool
  f x = true
  {-# INJECTIVE f #-}

  same : f true ≡ f false
  same = refl

not-same : f true ≡ f false → ⊥
not-same ()

absurd : ⊥
absurd = not-same same

All 3 comments

While working on #3959, I have found a way to revive this proof of false
using the INJECTIVE pragma:

{-# OPTIONS --safe #-}

open import Agda.Builtin.Bool
open import Agda.Builtin.Equality

data ⊥ : Set where

abstract
  f : Bool → Bool
  f x = true
  {-# INJECTIVE f #-}

  same : f true ≡ f false
  same = refl

not-same : f true ≡ f false → ⊥
not-same ()

absurd : ⊥
absurd = not-same same

I don't get it -- you chose to lie to Agda, in ways that are outside the logic (with a pragma), and tried to hide your track (with abstract), and you're somehow surprised that this gets you into trouble? Is the point that this shouldn't have happened under --safe?

Yes. The point is that --safe should reject any use of INJECTIVE just like
it rejects uses of TERMINATING.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MaiaVictor picture MaiaVictor  Â·  3Comments

chirsz-ever picture chirsz-ever  Â·  3Comments

mdimjasevic picture mdimjasevic  Â·  3Comments

juhp picture juhp  Â·  3Comments

GoogleCodeExporter picture GoogleCodeExporter  Â·  4Comments