From c72cfbea180c9ac8342edb99f1df6438489a4068 Mon Sep 17 00:00:00 2001 From: Anders Date: Thu, 4 Jun 2015 15:15:37 +0200 Subject: [PATCH] Add genComp and some examples for debugging --- Eval.hs | 4 ++- Exp.cf | 1 + Resolver.hs | 3 ++ examples/booltest.ctt | 32 ++++++++++++++++++++ examples/integer.ctt | 10 ++++++- examples/interval.ctt | 70 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 examples/booltest.ctt diff --git a/Eval.hs b/Eval.hs index f7547d4..3144eef 100644 --- a/Eval.hs +++ b/Eval.hs @@ -333,10 +333,12 @@ fillLine :: Val -> Val -> System Val -> Val fillLine a u ts = VPath i $ fill i (a @@ i) u (Map.map (@@ i) ts) where i = fresh (a,u,ts) -fill, fillNeg :: Name -> Val -> Val -> System Val -> Val +fill :: Name -> Val -> Val -> System Val -> Val fill i a u ts = comp j (a `conj` (i,j)) u (insertSystem (i ~> 0) u (ts `conj` (i,j))) where j = fresh (Atom i,a,u,ts) + +fillNeg :: Name -> Val -> Val -> System Val -> Val fillNeg i a u ts = (fill i (a `sym` i) u (ts `sym` i)) `sym` i comps :: Name -> [(Ident,Ter)] -> Env -> [(System Val,Val)] -> [Val] diff --git a/Exp.cf b/Exp.cf index 0b5e55b..0c0dcf3 100644 --- a/Exp.cf +++ b/Exp.cf @@ -33,6 +33,7 @@ App. Exp2 ::= Exp2 Exp3 ; IdP. Exp3 ::= "IdP" Exp4 Exp4 Exp4 ; Trans. Exp3 ::= "transport" Exp4 Exp4 ; Comp. Exp3 ::= "comp" Exp4 Exp4 System ; +GenComp. Exp3 ::= "genComp" Exp4 Exp4 System ; Glue. Exp3 ::= "glue" Exp4 System ; -- GlueElem. Exp3 ::= "glueElem" Exp4 System ; -- CompElem. Exp3 ::= "compElem" Exp4 System Exp4 System ; diff --git a/Resolver.hs b/Resolver.hs index 16d70c7..60c9ebc 100644 --- a/Resolver.hs +++ b/Resolver.hs @@ -206,6 +206,9 @@ resolveExp e = case e of IdP x y z -> CTT.IdP <$> resolveExp x <*> resolveExp y <*> resolveExp z Comp u v ts -> CTT.Comp <$> (CTT.Path (C.Name "_") <$> resolveExp u) <*> resolveExp v <*> resolveSystem ts + + GenComp u v ts -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> resolveSystem ts + Glue u ts -> do rs <- resolveSystem ts let isIso (CTT.Pair _ (CTT.Pair _ (CTT.Pair _ (CTT.Pair _ _)))) = True diff --git a/examples/booltest.ctt b/examples/booltest.ctt new file mode 100644 index 0000000..3d20e99 --- /dev/null +++ b/examples/booltest.ctt @@ -0,0 +1,32 @@ +module booltest where + +import bool +import newhedberg + +falseNotTrue (h : Id bool false true) : N0 = transport ( T (h @ i)) tt + where T : bool -> U = split + false -> Unit + true -> N0 + +trueNotFalse (h : Id bool true false) : N0 = falseNotTrue ( h @ - i) + +lemFalse : (b : bool) -> dec (Id bool false b) = split + false -> inl ( false) + true -> inr falseNotTrue + +lemTrue : (b : bool) -> dec (Id bool true b) = split + false -> inr trueNotFalse + true -> inl ( true) + +boolDec : (a b : bool) -> dec (Id bool a b) = split + false -> lemFalse + true -> lemTrue + +boolSet : set bool = corrhedberg bool boolDec + +F2Set : set F2 = subst U set bool F2 boolEqF2 boolSet + +T : U = Id F2 oneF2 oneF2 +p0 : T = refl F2 oneF2 + +test : Id T p0 p0 = F2Set oneF2 oneF2 p0 p0 \ No newline at end of file diff --git a/examples/integer.ctt b/examples/integer.ctt index 332d994..8caa322 100644 --- a/examples/integer.ctt +++ b/examples/integer.ctt @@ -58,8 +58,14 @@ T : U = Id int (pos zero) (pos zero) p0 : T = refl int (pos zero) p1 : T = compId int (pos zero) (neg zero) (pos zero) zeroP' (zeroP'@-i) +test0 : Id (Id Z (inr zero) (inr zero)) (refl Z (inr zero)) (refl Z (inr zero)) = + ZSet (inr zero) (inr zero) (refl Z (inr zero)) (refl Z (inr zero)) test1 : Id T p0 p1 = intSet (pos zero) (pos zero) p0 p1 +test2 : Id T p0 p0 = intSet (pos zero) (pos zero) p0 p0 +test3 : Id T p0 p1 = comp (int) (comp (int) (comp (int) (pos zero) [ (i1 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i1 = 1) -> comp (int) (comp (int) (comp (int) (comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ] ], (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ], (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> comp (int) (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ], (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ] + +--test3 : Id T p0 p0 = comp (int) (comp (int) (comp (int) (pos zero) [ (i1 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i1 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp (int) (pos zero) [ (i2 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 0) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp (int) (comp (int) (comp (int) (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> comp (int) (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp (int) (comp (int) (pos zero) [ ]) [ (i3 = 0) -> comp (int) (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> pos zero, (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> pos zero, (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ] -- test2 : Id T p0 p1 = -- comp int (pos zero) @@ -72,4 +78,6 @@ test1 : Id T p0 p1 = intSet (pos zero) (pos zero) p0 p1 -- [ (m = 1) -> comp int (zeroP {int} @ j) -- [ (j = 1) ->

zeroP {int} @ (-n \/ -p) ] ]) -- [ (j = 1) -> comp int (zeroP {int} @ (-n /\ m)) --- [ (m = 1) ->

zeroP {int} @ (-n /\ -p) ] ]]]] \ No newline at end of file +-- [ (m = 1) ->

zeroP {int} @ (-n /\ -p) ] ]]]] + +-- test2 : Id T p0 p1 = comp int (comp int (comp int (pos zero) [ (i1 = 0) -> comp int (comp int (comp int (pos zero) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp int (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp int (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp int (pos zero) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i1 = 1) -> comp int (comp int (comp int (comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ]) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i2 = 0) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i3 = 0) -> comp int (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp int (pos zero) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ]) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ]) [ (i2 = 0) -> pos zero, (i2 = 1) -> pos zero, (i3 = 0) -> comp int (comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ]) [ (i2 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ], (i2 = 1) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ] ] ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ] ], (i2 = 0) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ], (i2 = 1) -> comp int (comp int (comp int (pos zero) [ ]) [ ]) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> comp int (pos zero) [ (i3 = 0) -> pos zero, (i3 = 1) -> comp int (comp int (pos zero) [ ]) [ (i3 = 0) -> comp int (pos zero) [ ] ] ], (i3 = 1) -> pos zero ], (i3 = 1) -> pos zero ] ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ], (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ]) [ (i1 = 0) -> pos zero, (i1 = 1) -> comp int (zeroP {int} @ i2) [ (i2 = 0) -> pos zero, (i2 = 1) -> zeroP {int} @ -i3 ], (i2 = 0) -> pos zero, (i2 = 1) -> pos zero ] diff --git a/examples/interval.ctt b/examples/interval.ctt index 813a881..36dc6ae 100644 --- a/examples/interval.ctt +++ b/examples/interval.ctt @@ -11,3 +11,73 @@ fext (A B : U) (f g : A -> B) (p : (x : A) -> Id B (f x) (g x)) : zero -> f x one -> g x seg @ i -> p x @ i + + +toUnit : I -> Unit = split + zero -> tt + one -> tt + seg @ i -> tt + +fromUnit : Unit -> I = split + tt -> zero + +toUnitK : (a : Unit) -> Id Unit (toUnit (fromUnit a)) a = split + tt -> tt + +fromUnitK : (a : I) -> Id I (fromUnit (toUnit a)) a = split + zero -> zero + one -> seg {I} @ i + seg @ i -> seg {I} @ i /\ j + +unitEqI : Id U Unit I = isoId Unit I fromUnit toUnit fromUnitK toUnitK + +propI : prop I = subst U prop Unit I unitEqI propUnit + +setI : set I = subst U set Unit I unitEqI setUnit + +foo (X : U) : U = (x : X) -> Id X x x + +T : U = Id I zero zero +p0 : T = refl I zero +test : T = propI zero zero + +fooI : foo I = subst U foo Unit I unitEqI (\(x : Unit) -> x) +test2 : T = fooI zero + +-- ntest2 : T = comp I (comp I (comp I zero [ (i1 = 0) -> comp I (comp I (comp I zero [ ]) [ ]) [ (i2 = 0) -> comp I zero [ (i2 = 0) -> comp I zero [ (i2 = 0) -> zero, (i2 = 1) -> comp I (comp I zero [ ]) [ (i2 = 0) -> comp I zero [ ] ] ], (i2 = 1) -> zero ], (i2 = 1) -> zero ], (i1 = 1) -> comp I (comp I (comp I zero [ ]) [ ]) [ (i2 = 0) -> comp I zero [ (i2 = 0) -> comp I zero [ (i2 = 0) -> zero, (i2 = 1) -> comp I (comp I zero [ ]) [ (i2 = 0) -> comp I zero [ ] ] ], (i2 = 1) -> zero ], (i2 = 1) -> zero ] ]) [ (i1 = 0) -> zero, (i1 = 1) -> zero ]) [ (i1 = 0) -> zero, (i1 = 1) -> zero ] + +-- test1 : T = comp I (comp I (comp I zero [ (i1 = 0) -> comp I (comp I (comp I zero [ ]) [ ]) [ (i2 = 0) -> comp I zero [ (i2 = 0) -> comp I zero [ (i2 = 0) -> zero, (i2 = 1) -> comp I (comp I zero [ ]) [ (i2 = 0) -> comp I zero [ ] ] ], (i2 = 1) -> zero ], (i2 = 1) -> zero ], (i1 = 1) -> comp I (comp I (comp I zero [ ]) [ ]) [ (i2 = 0) -> comp I zero [ (i2 = 0) -> comp I zero [ (i2 = 0) -> zero, (i2 = 1) -> comp I (comp I zero [ ]) [ (i2 = 0) -> comp I zero [ ] ] ], (i2 = 1) -> zero ], (i2 = 1) -> zero ] ]) [ (i1 = 0) -> zero, (i1 = 1) -> zero ]) [ (i1 = 0) -> zero, (i1 = 1) -> zero ] + + +-- [ (i2 = 0) -> zero +-- , (i2 = 1) -> comp (<_> I) (comp (<_> I) zero []) +-- [ (i2 = 0) -> comp (<_> I) zero []]] + +-- with zero + + +test : Unit = transport ( unitEqI @ -i) zero +test' : IdP ( unitEqI @ -i) zero tt = + genComp ( unitEqI @ -i \/ -k) zero [(i = 0) -> <_> zero] + +test'' : Id I zero zero = comp I + (comp I + (comp I zero [ (i0 = 0) -> zero ]) + [ (i0 = 0) -> zero ]) + [ (i0 = 0) -> zero, (i0 = 1) -> comp I zero [ (i1 = 0) -> comp I zero [ (i1 = 0) -> zero, (i1 = 1) -> comp I (comp I zero [ ]) [ (i1 = 0) -> comp I zero [ ] ] ], (i1 = 1) -> zero ] ] + +-- -- glueElem +-- (comp I +-- (comp I +-- (comp I zero [ (i0 = 0) -> zero ]) +-- [ (i0 = 0) -> zero ]) +-- [ (i0 = 0) -> zero, (i0 = 1) -> comp I zero [ (i1 = 0) -> comp I zero [ (i1 = 0) -> zero, (i1 = 1) -> comp I (comp I zero [ ]) [ (i1 = 0) -> comp I zero [ ] ] ], (i1 = 1) -> zero ] ]) +-- [ (i0 = 1) -> tt ] + +-- test : I = transport unitEqI tt +-- eqttzero : IdP unitEqI tt zero = +-- genComp ( unitEqI @ -i \/ -j) zero [(i=1) -> <_>zero] +-- transport ( unitEqI @ -i \/ -j) zero +-- genComp ( unitEqI @ i /\ j) tt [(i=0) -> tt] + +-- Type checking failed: path endpoints don't match for comp ( unitEqI @ (i /\ j)) tt [ ], got (tt,comp I (comp I (comp I zero [ ]) [ ]) [ ]), but expected (tt,zero) -- 2.34.1