From: Anders Mörtberg Date: Mon, 4 Jan 2016 18:47:44 +0000 (+0100) Subject: Add bool example to univalence.ctt X-Git-Url: https://git.ak3n.com/?a=commitdiff_plain;h=cf484ebee67f773b3cef8ccaab361d773016a711;p=cubicaltt.git Add bool example to univalence.ctt --- diff --git a/examples/testUniv.ctt b/examples/testUniv.ctt deleted file mode 100644 index 8662cda..0000000 --- a/examples/testUniv.ctt +++ /dev/null @@ -1,21 +0,0 @@ -module testUniv where - -import testContr -import equiv - -swap : bool -> bool = split - true -> false - false -> true - -lemSwap : (x:bool) -> Id bool (swap (swap x)) x = split - true -> true - false -> false - -isEquivSwap : isEquiv bool bool swap = - gradLemma bool bool swap swap lemSwap lemSwap - -eqBool : Id U bool bool = - trans (equiv bool bool) (Id U bool bool) (corrUniv bool bool@-i) (swap,isEquivSwap) - -test1 : bool = trans bool bool eqBool true -test2 : bool = trans bool bool eqBool false diff --git a/examples/univalence.ctt b/examples/univalence.ctt index 513591a..d62066b 100644 --- a/examples/univalence.ctt +++ b/examples/univalence.ctt @@ -139,6 +139,9 @@ corrUniv (A X:U) : Id U (Id U X A) (equiv X A) = corrUniv' (A B : U) : equiv (Id U A B) (equiv A B) = (lem2 B A,univalence B A) + +-- Some tests of normal forms: + testUniv1 (A:U) : Id U A A = trans (equiv A A) (Id U A A) ( corrUniv A A @ -i) (idEquiv A) @@ -158,6 +161,18 @@ ntestUniv2 : bool = ((x : ((x : bool) * IdP ( bool) y (comp ( bool) (comp ( bool) x []) [ (i = 0) -> comp ( bool) x [ (j = 1) -> x ] ]))) * (y0 : ((x0 : bool) * IdP ( bool) y (comp ( bool) (comp ( bool) x0 []) [ (i = 0) -> comp ( bool) x0 [ (j = 1) -> x0 ] ]))) -> IdP ( ((x0 : bool) * IdP ( bool) y (comp ( bool) (comp ( bool) x0 []) [ (i = 0) -> comp ( bool) x0 [ (j = 1) -> x0 ] ]))) x y0)) (\(a : bool) -> ((a, a),\(z : ((x : bool) * IdP ( bool) a x)) -> (z.2 @ i, z.2 @ (i /\ j)))) [])) ] ], (i = 1) -> bool ]) [ (i = 0) -> bool, (i = 1) -> bool ]) true [] +-- A small test of univalence using boolean negation +isEquivNegBool : isEquiv bool bool negBool = + gradLemma bool bool negBool negBool negBoolK negBoolK + +eqBool : Id U bool bool = + trans (equiv bool bool) (Id U bool bool) + ( corrUniv bool bool @ -i) (negBool,isEquivNegBool) + +test1 : bool = trans bool bool eqBool true +test2 : bool = trans bool bool eqBool false + + ------------------------------------------------------------------------------ -- The direct proof of univalence using transEquiv: