How the proof goals get generated? #318
-
As a narrowing down of this question, I am starting to learn more about Coq tactics (like in this cheatsheet, or full index), which are the algorithms used to solve the goals in a proof as they are generated. After looking at THEOREMS.md, it appears Kind does the same sort of thing (having goals, at least). Where is that code exactly that implements it? And at a high level, how does the algorithm work? Like, what is the input to the algorithm (the theorem, how is it actually modeled/structured in code), and how does the algorithm generate a goal? Wondering how this works in some detail so I know better how proof assistants work. Then in addition to how the goals are generated, how are the goals solved? Like when in Coq you do |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
(disclaimer: I don't know any Kind specifics, so I'm talking in generalities below)
Here, when the typechecker reaches We can see that this information is exactly what Kind prints:
So when a goal A goal can be solved by replacing the In Coq there's another layer inbetween called Tactics. These are used to generate the term to fit in the goal holes. Haskell has a similar feature called "Typed Holes": https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/typed-holes.html |
Beta Was this translation helpful? Give feedback.
In Kind the goals are part of the AST. When you are type checking you are traversing the AST while keeping track of which variables are in scope. So when you reach a goal/hole you have the information available. The next goal is just the next hole you reach while traversing the AST.
I don't know how Coq tactics work, similarly I assume.
You can study https://github.com/AndrasKovacs/elaboration-zoo for one way to implement type checkers. Though it's good to read "Types and Programming Languages" first.