Some graphs stuff (#98)

This commit is contained in:
Patrick Stevens
2020-02-15 13:41:51 +00:00
committed by GitHub
parent 9de323c5e8
commit f41f5226b9
18 changed files with 275 additions and 39 deletions

26
Graphs/PathGraph.agda Normal file
View File

@@ -0,0 +1,26 @@
{-# OPTIONS --warning=error --safe --without-K #-}
open import LogicalFormulae
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
open import Functions
open import Setoids.Setoids
open import Setoids.Subset
open import Graphs.Definition
open import Sets.FinSet.Definition
open import Sets.FinSet.Lemmas
open import Numbers.Naturals.Semiring
open import Sets.EquivalenceRelations
module Graphs.PathGraph where
nNotSucc : {n : } (n succ n) False
nNotSucc {zero} ()
nNotSucc {succ n} pr = nNotSucc (succInjective pr)
PathGraph : (n : ) Graph _ (reflSetoid (FinSet (succ n)))
Graph._<->_ (PathGraph n) x y = (toNat x succ (toNat y)) || (toNat y succ (toNat x))
Graph.noSelfRelation (PathGraph n) x (inl bad) = nNotSucc bad
Graph.noSelfRelation (PathGraph n) x (inr bad) = nNotSucc bad
Graph.symmetric (PathGraph n) (inl x) = inr x
Graph.symmetric (PathGraph n) (inr x) = inl x
Graph.wellDefined (PathGraph n) refl refl i = i