diff options
-rw-r--r-- | src/Soat/SecondOrder/Algebra.idr | 15 |
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) |