MiniAgda by Andreas Abel and Karl Mehltretter --- opening "cofunIntoStreamPlusStream.ma" --- --- scope checking --- --- type checking --- type Unit : Set term Unit.unit : < Unit.unit : Unit > type Bool : Set term Bool.true : < Bool.true : Bool > term Bool.false : < Bool.false : Bool > type Twice : ++(A : Set) -> Set term Twice.inl : .[A : Set] -> ^(y0 : A) -> < Twice.inl y0 : Twice A > term Twice.inr : .[A : Set] -> ^(y0 : A) -> < Twice.inr y0 : Twice A > term fmap : .[A : Set] -> .[B : Set] -> (A -> B) -> Twice A -> Twice B { fmap [A] [B] f (Twice.inl a) = Twice.inl (f a) ; fmap [A] [B] f (Twice.inr a) = Twice.inr (f a) } type BStr : - Size -> Set term BStr.cons : .[i : Size] -> ^(head : Bool) -> ^(tail : BStr i) -> < BStr.cons i head tail : BStr $i > term head : .[i : Size] -> (cons : BStr $i) -> Bool { head [i] (BStr.cons [.i] #head #tail) = #head } term tail : .[i : Size] -> (cons : BStr $i) -> BStr i { tail [i] (BStr.cons [.i] #head #tail) = #tail } term idAndLast : .[i : Size] -> BStr i -> Twice (BStr i) error during typechecking: idAndLast /// clause 1 /// pattern $i /// checkPattern $i : matching on size, checking that target .[i : Size] -> BStr i -> Twice (BStr i) ends in correct coinductive sized type /// new i <= # /// endsInSizedCo: BStr i -> Twice (BStr i) /// new : (BStr v0) /// endsInSizedCo: Twice (BStr i) /// endsInSizedCo: target Twice (BStr i) of corecursive function is neither a CoSet or codata of size i nor a tuple type