Skip to content

Examples.Demos.ContraX

Inconsistency in first formalization attempt

This is the Examples.Demos.ContraX module of the Agda Universal Algebra Library.

A cautionary counterexample kept from an early formalization attempt. It is tempting to posit a surjection from an arbitrary context type onto every algebra's domain; this module shows the global form of that assumption is inconsistent, so any such surjection must be a hypothesis about a suitably chosen context, never a theorem about all of them.

{-# OPTIONS --without-K --exact-split --safe #-}

open import Overture using ( π“ž ; π“₯ ; Signature )

module Examples.Demos.ContraX {𝑆 : Signature π“ž π“₯} where
open import  Data.Unit.Polymorphic                  using ( ⊀ ; tt )
open import  Data.Empty.Polymorphic                 using ( βŠ₯ )
open import  Level                                  using ( 0β„“ )
open import  Relation.Binary                        using ( Setoid )
open import  Relation.Binary.PropositionalEquality  using ( setoid )
open import  Data.Product                           using ( Ξ£-syntax )
open import  Function    renaming (Func to _⟢_ )    using ()


open import Overture                 using ( proj₁ ; projβ‚‚ )
open import Setoid.Algebras  using ( Algebra ; 𝔻[_] )
open import Setoid.Functions         using (IsSurjective ; Image_βˆ‹_)

open Algebra

_β† _ packages a setoid function from setoid X into the algebra's domain together with a proof that it is surjective. myA is the one-point setoid with the trivial equality, and myAlg an algebra on it whose interpretation Agda infers, the codomain being a one-point setoid. contradiction refutes βˆ€ X 𝑨 β†’ X β†  𝑨: instantiating at the empty type and myAlg, the assumed surjection must witness the point in its image, and that witness is an element of βŠ₯.

_β† _ : Set β†’ Algebra {𝑆 = 𝑆} 0β„“ 0β„“ β†’ _
X β†  𝑨 = Ξ£[ h ∈ (setoid X ⟢ 𝔻[ 𝑨 ])] IsSurjective h

myA : Setoid 0β„“ 0β„“
myA = record  { Carrier = ⊀
              ; _β‰ˆ_ = Ξ» x x₁ β†’ ⊀
              ; isEquivalence = record  { refl = tt
                                        ; sym = Ξ» _ β†’ tt
                                        ; trans = Ξ» _ _ β†’ tt } }

myAlg : Algebra {𝑆 = 𝑆} _ _
myAlg = record { Domain = myA ; Interp = _ }

contradiction : (βˆ€ X 𝑨 β†’ X β†  𝑨) β†’ βŠ₯
contradiction h1 = ex falso
 where
 h : Ξ£[ h ∈ (setoid βŠ₯ ⟢ 𝔻[ myAlg ])] IsSurjective h
 h = h1 βŠ₯ myAlg

 falso : Image (proj₁ h) βˆ‹ tt
 falso = (projβ‚‚ h)

 ex : Image (proj₁ h) βˆ‹ tt β†’ βŠ₯
 ex (Image_βˆ‹_.eq a x) = a