summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2022-12-06 09:08:58 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2022-12-06 09:08:58 +0000
commit0535989e30fd52bfdb00fb9c683a60fb878f0bb5 (patch)
tree5952ee387d1841721043df388a5e364715039458 /src
parentc9b6934608ba01a8f7e2dd1ea29a4304c908b3dd (diff)
Define helper functions for extend.
Diffstat (limited to 'src')
-rw-r--r--src/Soat/SecondOrder/Algebra.idr15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Soat/SecondOrder/Algebra.idr b/src/Soat/SecondOrder/Algebra.idr
index d3e1f4c..6f7cb4a 100644
--- a/src/Soat/SecondOrder/Algebra.idr
+++ b/src/Soat/SecondOrder/Algebra.idr
@@ -19,6 +19,11 @@ extendRel : {U : a -> List a -> Type} -> (rel : IRel (uncurry U))
-> (ctx : List a) -> IRel (extend U ctx)
extendRel rel ctx ty = rel (snd ty, fst ty ++ ctx)
+public export
+extendFunc : {0 U, V : a -> List a -> Type} -> (f : (t : a) -> IFunc (U t) (V t)) -> (ctx : List a)
+ -> IFunc (extend U ctx) (extend V ctx)
+extendFunc f ctx ty = f (snd ty) (fst ty ++ ctx)
+
public export 0
algebraOver : (sig : Signature) -> (U : sig.T -> List sig.T -> Type) -> Type
algebraOver sig x = (ctx : List sig.T) -> {t : sig.T} -> (op : Op sig t)
@@ -35,6 +40,16 @@ record RawAlgebra (0 sig : Signature) where
-> forall ctx' . U t ctx' -> (\t => U t ctx) ^ ctx' -> U t ctx
public export
+(.extendSubst) : (a : RawAlgebra sig) -> (ctx : List sig.T) -> {ctx' : List sig.T}
+ -> (tms : (\t => a.U t ctx) ^ ctx') -> IFunc (extend a.U ctx') (extend a.U ctx)
+a .extendSubst ctx tms ty tm = a.subst
+ (snd ty)
+ (fst ty ++ ctx)
+ tm
+ (tabulate {is = fst ty} (a.var . Sublist.elemJoinL {ys = ctx}) ++
+ map (\t => a.rename t ([] {ys = fst ty} ++ Relation.reflexive {x = ctx})) tms)
+
+public export
record IsAlgebra (0 sig : Signature) (0 a : RawAlgebra sig) where
constructor MkIsAlgebra
0 relation : IRel (uncurry a.U)