|
| ||
|
|
Start of topic | Skip to actions
When Walid is out of town, what format should the lecture take on? Joseph mentioned the need for either a list of goals, for us to implement, or individual semester projects.
Dan had a question: what would dependently typing a red-black tree gain us? Walid mentioned sizing, but Dan replied that sizing is already guaranteed without dependent typing.
We discussed implementing new and interesting data structures. Joseph was interested in using these data structures and types to prove things (like n+m = m+n). How are we doing proofs with these types? How do we construct proofs without Coq tactics?
Walid replied that this discussion will take a lecture or two. These notes are available on last semester's 210 page.
Add this to the list of topics to study - how are theorems, in general, proven with Coq?
Every data type in Coq corresponds to a set of rules, every value is a judgement. What does this mean?
type nat = Z | S of natThis means ________________ Z element of nat x element of nat ________________ S x element of natDatatypes: OCaml -> context-free and regular languages Coq/Concoqtion -> context-sensitive languages An OCaml datatype is a BNF. What can Coq do that is extra? We can paramaterize definitions in a way that would allow us to, e.g. count, things about the context. For example, say we have the lambda calc: e ::= x | Lx.e | e ein ML, this is: type expr = | Var of string | Lambda of string * expr | App of expr * expr ;;This means: x element of X _____________ x element of E x element of X, e element of E _____________ Lx.e element of E e1 element of E, e2 element of E _____________ e1 e2 element of E G(x) = t _____________ G|-x:t G,x:t1 |- e:t2 _____________ G|-Lx.e:t1 -> t2 G|-e1:t1->t2 G|-e2:t1 _____________ G|-e1 e2:t2 G(x) = t _____________ x element of G |- t e element of G,x:t1 |- t _____________ Lx,e element of G |- t1->t2 e1 element of G |- t1->t2 e2 element of G |- t1 _____________ e1 e2 element of G |- t2
type (G, t) texp =
| TVar of (x:string)
when G(x) = t
| ...
but we can't do this in OCaml
type (G, t) texp =
| TVar of (x:string)
when G(x) = t
| TLam of (x:string) * (G,x:t1, t2) texp
: (G, t1 -> t2) texp
| ...
but the G isn't updated to include t1 and t2 in the return type, so:
type (G, t) texp =
| TVar of (x:string)
when G(x) = t
| TLam of let t1,t2:Type in (x:string) * (G,x:t1, t2) texp
: (G, t1 -> t2) texp
| ...
And now for application:
type (G, t) texp =
| TVar of (x:string)
when G(x) = t
| TLam of let t1,t2:Type in (x:string) * (G,x:t1, t2) texp
: (G, t1 -> t2) texp
| TApp of let t1,t2:Type in (G,t1->t2) texp * (G, t1) texp
: (G, t2) texp
This application is actually perfect concoqtion code, now we just have to fix:
(1) naming of type constructor variables (e.g. (x:string) )
(1) using "when"
split this rule:
G(x) = t _____________ x element of G |- tinto two rules: _____________ G,x:t |- x:t G |- x:t _____________ G,y:t1 |- x:tbut we still have the side condition x = y. Use DeBraun? notation, where every string is unnamed, simply indexed: e ::= #n | L.e | e eso the rules are: _____________ |- #0 _____________ |- #(n+1) ...Type ::= int | Type->Type G ::= [] | G,x:t a gamma is just a list, even though it sometimes behaves as a function (we will deal with this schizo behavior later) -- DanielAdler - 07 Feb 2007 Topic Actions: Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
Webs: Main | TWiki | Africa | CPSX | EmbeddedSystems | Gpce | Houston | International | K12 | MetaOCaml | MulticoreOCR | ProgrammingLanguages | RAP | RIDL | Sandbox | SpeechClub | Teaching | Texbot | WG211 Web Actions: | |
This work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.