diff options
author | Greg Brown <greg.brown01@ed.ac.uk> | 2022-12-06 16:18:29 +0000 |
---|---|---|
committer | Greg Brown <greg.brown01@ed.ac.uk> | 2022-12-06 16:18:29 +0000 |
commit | fcd024cb01e484dc3c92212f4317b254bbd7580b (patch) | |
tree | 99f8f7f834524e38aed09b5abece1b2db47a8a01 /src/Soat/FirstOrder/Term.idr | |
parent | 83c85bf396949287365a694a89e0f49a58cab5a2 (diff) |
Add smart constructor for first-order algebras.refactor/strict
Diffstat (limited to 'src/Soat/FirstOrder/Term.idr')
-rw-r--r-- | src/Soat/FirstOrder/Term.idr | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Soat/FirstOrder/Term.idr b/src/Soat/FirstOrder/Term.idr index 2042d2f..a53e6b0 100644 --- a/src/Soat/FirstOrder/Term.idr +++ b/src/Soat/FirstOrder/Term.idr @@ -105,17 +105,20 @@ namespace Rel , transitive = \t, x, y, z => tmRelTrans eq.transitive } + public export + Term : (0 sig : Signature) -> (V : IndexedSetoid sig.T) -> IndexedSetoid sig.T + Term sig v = MkIndexedSetoid (Term sig v.U) (tmRelEq v.equivalence) + public export Free : (0 V : sig.T -> Type) -> RawAlgebra sig Free v = MkRawAlgebra (Term sig v) Call public export -FreeIsAlgebra : (v : IndexedSetoid sig.T) -> IsAlgebra sig (Free v.U) -FreeIsAlgebra v = MkIsAlgebra (tmRelEq v.equivalence) Call - -public export FreeAlgebra : IndexedSetoid sig.T -> Algebra sig -FreeAlgebra v = MkAlgebra _ (FreeIsAlgebra v) +FreeAlgebra v = MkAlgebra + { U = Term sig v + , sem = \op => MkSetoidHomomorphism (Call op) (\_, _ => Call op) + } public export bindTermCong' : {a : Algebra sig} -> {env, env' : (t : sig.T) -> v t -> a.raw.U t} |