diff --git a/IR.lagda b/IR.lagda index b4c9c6f..99df574 100644 --- a/IR.lagda +++ b/IR.lagda @@ -217,8 +217,8 @@ right end. That means \emph{left}-nested record types (also known as mutual data RecL : Set1 where - Em : RecL - _::_ : {n : Nat}(R : RecL)(A : RL -> Set) -> RecL + Em : RecL + _::_ : (R : RecL)(A : RL -> Set) -> RecL RL : RecL -> Set RL = One diff --git a/IRDS.lagda b/IRDS.lagda index 7c1bc3e..60e217e 100644 --- a/IRDS.lagda +++ b/IRDS.lagda @@ -210,7 +210,7 @@ following exercise. \begin{exe}[composition for |DS|] This is an open problem. Construct \begin{spec} -coDS : forall {I J K} -> DS J K -> DS I K -> DS I K +coDS : forall {I J K} -> DS J K -> DS I J -> DS I K coDS E D = ? \end{spec} such that diff --git a/Lec5.agda b/Lec5.agda index 495e104..6b0e27c 100644 --- a/Lec5.agda +++ b/Lec5.agda @@ -25,9 +25,15 @@ sum (suc n) f = f zero +Nat sum n (f o suc) prod zero _ = 1 prod (suc n) f = f zero *Nat sum n (f o suc) -data FTy : Set where - fin : Nat -> FTy - sg pi : (S : FTy)(T : Fin {!!} -> FTy) -> FTy +mutual + data FTy : Set where + fin : Nat -> FTy + sg pi : (S : FTy)(T : # S -> FTy) -> FTy + + # : FTy -> Set + # (fin n) = Fin n + # (sg S T) = Sg (# S) (\ s -> # (T s)) + # (pi S T) = (s : # S) -> # (T s) -- do it with Nat, #, then tweak it to Set @@ -51,12 +57,14 @@ mutual data RecL : Set1 where Em : RecL - _::_ : {n : Nat}(R : RecL)(A : RL -> Set) -> RecL + _::_ : (R : RecL)(A : RL -> Set) -> RecL RL : RecL -> Set RL = One RL = Sg RL A + + -- mention manifest fields -- but now, a serious universe @@ -78,11 +86,19 @@ mutual data DS (I J : Set1) : Set1 where io : J -> DS I J -- no more fields + sg : (A : Set)(T : A -> DS I J) -> DS I J -- non-rec field + de : (H : Set)(T : (H -> I) -> DS I J) -> DS I J DS : forall {I J} -> DS I J -> Fam I -> Fam J DS Xxi = One , \ { <> -> j } +DS Xxi + = (Sg A \ a -> fst (DS Xxi)) + , (\ { (a , t) -> snd (DS Xxi) t }) +DS (X , xi) + = (Sg (H -> X) \ hx -> fst (DS (X , xi))) + , (\ { (hx , t) -> snd (DS (X , xi)) t }) mutual -- fails positivity check and termination check @@ -94,10 +110,8 @@ mutual -- fails positivity check and termination check -- mention bind -{- -coDS : forall {I J K} -> DS J K -> DS I K -> DS I K +coDS : forall {I J K} -> DS J K -> DS I J -> DS I K coDS E D = {!!} --} {- PiF : (S : Set){J : S -> Set1}(T : (s : S) -> Fam (J s)) -> diff --git a/Lec6.agda b/Lec6.agda index f2d33ce..45c8fc0 100644 --- a/Lec6.agda +++ b/Lec6.agda @@ -2,17 +2,20 @@ module Lec6 where open import IR public -data Favourite : (Nat -> Nat) -> Set where - favourite : Favourite (\ x -> zero +Nat x) +data Favourite (f : Nat -> Nat) : Set where + favourite : (\ x -> zero +Nat x) == f -> Favourite f -plusZero : forall x -> zero +Nat x == x +Nat zero -plusZero x = {!!} +plusZero : forall x -> x == x +Nat zero +plusZero zero = refl +plusZero (suc x) = cong suc (plusZero x) closedFact : (\ x -> zero +Nat x) == (\ x -> x +Nat zero) closedFact = extensionality _ _ plusZero -myTerm = subst closedFact Favourite favourite +myTerm = subst closedFact Favourite (favourite refl) +help : Favourite (λ x → x +Nat 0) +help = favourite closedFact -- remark on intensional predicates -- remark on the need for a more type-based computation mechanism @@ -27,7 +30,18 @@ mutual Eq : (X : TU)(x : TU) -> (Y : TU)(y : TU) -> TU Eq X x Y y = snd (EQ X Y) x y - EQ X Y = {!!} + EQ Zero' Zero' = One' , \ _ _ -> One' + + EQ One' One' = One' , \ _ _ -> One' + EQ Two' Two' = One' , (\ + { tt tt -> One' + ; ff ff -> One' + ; _ _ -> Zero' + }) + EQ (Sg' X T) (Sg' Y T₁) = {!!} + EQ (Pi' S T) (Pi' S' T') = {!!} + EQ (Tree' X F i) (Tree' Y F₁ i₁) = {!!} + EQ _ _ = Zero' , \ _ _ -> One' coe : (X Y : TU) -> Y !>TU -> TU -> TU @@ -35,5 +49,40 @@ postulate coh : (X Y : TU)(Q : Y !>TU)(x : TU) -> TU -coe X Y Q x = {!!} +coe Zero' Zero' Q x = {!!} +coe Zero' One' Q x = {!!} +coe Zero' Two' Q x = {!!} +coe Zero' (Sg' Y T) Q x = {!!} +coe Zero' (Pi' Y T) Q x = {!!} +coe Zero' (Tree' Y F i) Q x = {!!} +coe One' Zero' Q x = {!!} +coe One' One' Q x = {!!} +coe One' Two' Q x = {!!} +coe One' (Sg' Y T) Q x = {!!} +coe One' (Pi' Y T) Q x = {!!} +coe One' (Tree' Y F i) Q x = {!!} +coe Two' Zero' Q x = {!!} +coe Two' One' Q x = {!!} +coe Two' Two' Q x = {!!} +coe Two' (Sg' Y T) Q x = {!!} +coe Two' (Pi' Y T) Q x = {!!} +coe Two' (Tree' Y F i) Q x = {!!} +coe (Sg' X T) Zero' () x +coe (Sg' X T) One' Q x = {!!} +coe (Sg' X T) Two' Q x = {!!} +coe (Sg' S T) (Sg' S' T') Q (s , t) = {!!} +coe (Sg' X T) (Pi' Y T₁) Q x = {!!} +coe (Sg' X T) (Tree' Y F i) Q x = {!!} +coe (Pi' X T) Zero' Q x = {!!} +coe (Pi' X T) One' Q x = {!!} +coe (Pi' X T) Two' Q x = {!!} +coe (Pi' X T) (Sg' Y T₁) Q x = {!!} +coe (Pi' X T) (Pi' Y T₁) Q x = {!!} +coe (Pi' X T) (Tree' Y F i) Q x = {!!} +coe (Tree' X F i) Zero' Q x = {!!} +coe (Tree' X F i) One' Q x = {!!} +coe (Tree' X F i) Two' Q x = {!!} +coe (Tree' X F i) (Sg' Y T) Q x = {!!} +coe (Tree' X F i) (Pi' Y T) Q x = {!!} +coe (Tree' X F i) (Tree' Y F₁ i₁) Q x = {!!} diff --git a/NormT.lagda b/NormT.lagda index e54ae35..949b0e9 100644 --- a/NormT.lagda +++ b/NormT.lagda @@ -131,7 +131,7 @@ observe the corresponding naturality. We thus need a notion of %format -:> = "\F{\dot{\to}}" %format _-:>_ = "\us{" -:> "}" %format AppHom = "\D{AppHom}" -%format respPure = "\F{resp}" pure +%format respPure = "\F{respPure}" %format respApp = "\F{resp}" <*> \begin{code} _-:>_ : forall (F G : Set -> Set) -> Set1 diff --git a/notes.pdf b/notes.pdf index 5c490f4..7383db0 100644 Binary files a/notes.pdf and b/notes.pdf differ