MFPS 2026 – Agda Code
Setoid
Initializing search
    pdmosses/mfps2026-agda
    • About
    • Notation
    • Examples
    • Properties
    • Tests
    • Library
    pdmosses/mfps2026-agda
    • About
      • Abstract
      • Background
        • Denotational-Semantics
        • Agda
      • Meta-notation
    • Notation
      • Domains
      • Flat
        • Booleans
        • Naturals
      • Functions
      • Products
        • Sequences
        • Tuples
      • Recursion
      • Sums
      • Updates
    • Examples
      • LC
        • Abstract-Syntax
        • Domain-Equations
        • Semantic-Functions
      • PCF
        • Abstract-Syntax
        • Domain-Equations
        • Semantic-Functions
      • Scm
        • Abstract-Syntax
        • Auxiliary-Functions
        • Domain-Equations
        • Semantic-Functions
    • Properties
      • Flat
        • Booleans
        • Naturals
      • Functions
      • Products
        • Sequences
        • Tuples
      • Recursion
      • Sums
      • Updates
    • Tests
      • LC
      • PCF
    • Library
          • Bool
          • Char
            • Properties
          • Equality
            • Rewrite
          • Int
          • List
          • Maybe
          • Nat
          • Sigma
          • String
            • Properties
          • Unit
        • Primitive
      • Algebra
        • Bundles
          • Raw
          • Base
          • Propositional
          • Setoid
            • Base
            • MaxOp
            • MinMaxOp
            • MinOp
        • Core
        • Definitions
          • RawMagma
          • Bundles
            • Raw
              • MaxOp
              • MinMaxOp
              • MinOp
            • BooleanAlgebra
            • DistributiveLattice
            • Lattice
            • Semilattice
          • Structures
        • Morphism
          • Definitions
          • Structures
          • CommutativeSemigroup
          • Semigroup
        • Structures
          • Biased
          • Propositional
        • UniquenessOfIdentityProofs
          • Base
          • Properties
          • Base
          • Properties
        • Empty
          • Polymorphic
          • Base
          • Patterns
          • Properties
          • Base
        • Irrelevant
          • Base
            • Propositional
            • Setoid
            • Base
          • Properties
              • Lex
                • Core
                • Strict
              • Pointwise
                • Base
                • Properties
              • All
              • AllPairs
                • Core
              • Any
          • Base
              • Any
          • Base
          • Divisibility
            • Core
          • DivMod
            • Core
          • GeneralisedArithmetic
          • Induction
          • Properties
          • Base
          • Algebra
          • Base
          • Properties
              • All
          • Base
          • Base
          • Properties
        • Sum
          • Algebra
          • Base
          • Properties
          • Base
          • Base
          • Polymorphic
            • Base
            • Properties
          • Base
        • Applicative
        • Choice
        • Empty
        • Functor
        • Monad
        • Base
        • Bundles
        • Consequences
          • Propositional
          • Setoid
          • Composition
          • Identity
          • Symmetry
        • Core
        • Definitions
          • Bundles
              • Equality
          • Bundles
          • Core
          • Definitions
          • Nat
            • Bundles
            • Core
            • Definitions
            • Structures
          • Structures
          • Inverse
          • RightInverse
        • Structures
      • Induction
        • WellFounded
      • Level
          • Bundles
            • Raw
          • Consequences
              • Reflexive
                • Properties
            • Composition
              • Core
              • EqAndOrd
            • Intersection
              • Left
            • NonStrictToStrict
            • True
          • Core
          • Definitions
            • Heterogeneous
              • Bundles
                • Trivial
              • Core
              • Definitions
              • Structures
          • Lattice
            • Bundles
            • Definitions
            • Structures
            • Definitions
            • Structures
            • Poset
            • Preorder
            • Setoid
            • TotalOrder
          • PropositionalEquality
            • Algebra
            • Core
            • Properties
              • Double
              • Single
              • Triple
            • Preorder
            • Setoid
            • Syntax
          • Structures
            • Biased
        • Nullary
          • Decidable
            • Core
          • Irrelevant
          • Negation
            • Core
          • Recomputable
            • Core
          • Reflects
        • Unary
          • PredicateTransformer
          • Properties
    1. Library
    2. Relation
    3. Binary
    4. Reasoning

    Setoid

    ------------------------------------------------------------------------
    -- The Agda standard library
    --
    -- Convenient syntax for reasoning with a setoid
    ------------------------------------------------------------------------
    
    -- Example use:
    
    -- n*0≡0 : ∀ n → n * 0 ≡ 0
    -- n*0≡0 zero    = refl
    -- n*0≡0 (suc n) = begin
    --   suc n * 0 ≈⟨ refl ⟩
    --   n * 0 + 0 ≈⟨ ... ⟩
    --   n * 0     ≈⟨ n*0≡0 n ⟩
    --   0         ∎
    
    -- Module `≡-Reasoning` in `Relation.Binary.PropositionalEquality`
    -- is recommended for equational reasoning when the underlying equality
    -- is `_≡_`.
    
    {-# OPTIONS --cubical-compatible --safe #-}
    
    open import Relation.Binary.Bundles using (Setoid)
    open import Relation.Binary.Reasoning.Syntax using (module ≈-syntax)
    
    module Relation.Binary.Reasoning.Setoid {s₁ s₂} (S : Setoid s₁ s₂) where
    
    open Setoid S
    
    import Relation.Binary.Reasoning.Base.Single _≈_ refl trans
      as SingleRelReasoning
    
    ------------------------------------------------------------------------
    -- Reasoning combinators
    
    -- Export the combinators for single relation reasoning, hiding the
    -- single misnamed combinator.
    open SingleRelReasoning public
      hiding (step-∼)
      renaming (∼-go to ≈-go)
    
    -- Re-export the equality-based combinators instead
    open ≈-syntax _IsRelatedTo_ _IsRelatedTo_ ≈-go sym public
    
    Made with MaterialX