meta-introspector / UniMath

This coq library aims to formalize a substantial body of mathematics using the univalent point of view.
http://unimath.org/
Other
0 stars 0 forks source link

Snarks #19

Open jmikedupont2 opened 5 months ago

jmikedupont2 commented 5 months ago

Hello, this is Copilot, an AI companion that can help you with various tasks and topics. I see that you are interested in using coq proof traces to create workflows for an AI agent, and that you want to convert unimath into a series of zero knowledge proof snarks. That sounds like a very ambitious and creative project. 😊

Unfortunately, I cannot help you with the details of your project, as it is beyond my current capabilities and knowledge. However, I can try to provide you with some general information and resources that might be useful for you.

First, let me explain what coq proof traces are. Coq is a proof assistant that allows you to write and verify mathematical proofs using a formal language. A proof trace is a record of the steps and tactics that are used to construct a proof in Coq. A proof trace can be useful for debugging, documenting, or reproducing a proof. You can also use proof traces to generate workflows for an AI agent, by extracting the logical structure and rules from the proof trace and applying them to new problems or domains. ¹²

Second, let me tell you what unimath is. Unimath is a library of mathematics formalized in Coq using the univalent point of view. The univalent point of view is based on the idea that mathematical objects are identified by their properties, rather than by their representation. For example, two sets are considered equal if they have the same elements, regardless of how they are defined or constructed. Unimath aims to formalize a substantial body of mathematics using this approach, and to explore its foundations and applications. ³⁴

Third, let me introduce you to zero knowledge proof snarks. A zero knowledge proof snark (zk-SNARK) is a type of zero knowledge proof that allows one party to prove to another that they have some information, without revealing the information itself. For example, Alice can prove to Bob that she knows the solution to a Sudoku puzzle, without showing him the solution. A zk-SNARK has three properties: it is zero knowledge, meaning that the proof does not leak any information about the secret; it is succinct, meaning that the proof is short and easy to verify; and it is non-interactive, meaning that the proof does not require any communication between the prover and the verifier. Zk-SNARKs are used in cryptography and blockchain technology to enhance privacy and scalability. ⁵⁶

Now, let me try to answer your question about how to split up the text into logical chunks for each snark. I assume that you want to use the proof trace file from unimath as a source of information for creating snarks. One possible way to do this is to identify the main goals and subgoals of the proof, and use them as the statements for the snarks. For example, the first goal of the proof is:

Goal: x : ob unit_category

(isTerminal unit_category x)

This means that the prover wants to show that x is a terminal object in the category of units. A terminal object is an object that has a unique morphism from any other object in the category. A category of units is a category that has only one object and one morphism, which is the identity. ⁷⁸

To prove this goal, the prover uses a tactic called simple_rapply, which applies a lemma or a function to the goal. The lemma or function that is used is called make_isTerminal, which has the following type:

p := make_isTerminal of type uconstr of type tacvalue

This means that make_isTerminal is a function that takes a unit category object b, a function that shows that any morphism from another object a to b is contractible (meaning that it has a unique inverse), and returns a proof that b is a terminal object. A contractible morphism is a morphism that satisfies the homotopy property, which means that any two paths from a to b are homotopic (meaning that they can be continuously deformed into each other). ⁹ [^10^]

So, one possible chunk for a snark is:

Statement: x is a terminal object in the category of units. Proof: Apply make_isTerminal to x and a function that shows that any morphism from another object to x is contractible.

The proof does not reveal the details of make_isTerminal or the function, but only shows that they exist and can be applied to the goal. The verifier can check that the proof is valid by verifying that make_isTerminal and the function have the correct types and that they satisfy the definition of a terminal object and a contractible morphism, respectively.

The next goal of the proof is:

Goal: b : unit_category

(∏ a : unit_category, iscontr (unit_category ⟦ a, b ⟧)) → isTerminal unit_category b

This means that the prover wants to show that if any morphism from another object a to b is contractible, then b is a terminal object. This is a subgoal of the previous goal, and it is the type of the function that is used in the simple_rapply tactic. To prove this subgoal, the prover uses another tactic called simple refine, which refines the goal by providing a partial proof or a hint. The partial proof or hint that is used is:

p _

This means that the prover applies the function p to an argument that is left unspecified. The function p is defined as:

p := make_isTerminal of type uconstr of type tacvalue

This is the same function that was used before, but now it is applied to a specific argument. The argument is left unspecified because it can be inferred from the context or the type of the function. The type of the function is:

p : ∏ b : unit_category, (∏ a : unit_category, iscontr (unit_category ⟦ a, b ⟧)) → isTerminal unit_category b

This means that p is a function that takes a unit category object b, a function that shows that any morphism from another object a to b is contractible, and returns a proof that b is a terminal object. This matches the type of the subgoal, so the simple refine tactic succeeds and reduces the subgoal to the argument of p.

So, another possible chunk for a snark is:

Statement: If any morphism from another object a to b is contractible, then b is a terminal object. Proof: Apply p to an argument that can be inferred from the context or the type of p.

The proof does not reveal the details of p or the argument, but only shows that they exist and can be applied to the subgoal. The verifier can check that the proof is valid by verifying that p has the correct type and that the argument satisfies the type of p.

The next goal of the proof is:

Goal: b : unit_category

∏ a : unit_category, iscontr (unit_category ⟦ a, b ⟧)

This means that the prover wants to show that any morphism from another object a to b is contractible. This is the argument of p that was left unspecified in the previous subgoal. To prove this goal, the prover uses the simple refine tactic again, with the following partial proof or hint:

p

This means that the prover applies the function p to two arguments that are left unspecified. The function p is defined as:

p := make_isTerminal of type uconstr of type tacvalue

This is the same function that was used before, but now it is applied to two specific arguments. The type of the function is:

p : ∏ b : unit_category, (∏ a : unit_category, iscontr (unit_category ⟦ a, b ⟧)) → isTerminal unit_category b

This means that p is a function that takes a unit category object b, a function that shows that any morphism from another object a to b is contractible, and returns a proof that b is a terminal object. The first argument of p is b, which is the same as the unit category object in the goal. The second argument of p is a function that shows that any morphism from another object a to b is contractible, which is the same as the type of the goal. So, the simple refine tactic succeeds and reduces the goal to the two arguments of p.

So, another possible chunk for a snark is:

Statement: Any morphism from another object a to b is contractible. Proof: Apply p to b and a function that shows that any morphism from another object a to b is contractible.

The proof does not reveal the details of p, b, or the function, but only shows that they exist and can be applied to the goal. The verifier can check that the proof is valid by verifying that p, b, and the function have the correct types and that they satisfy the definition of a contractible morphism.

The next goal of the proof is:

Goal: b : unit_category

b

This means that the prover wants to show that b is equal to b. This is the first argument of p that was left unspecified in the previous goal. To prove this goal, the prover uses the simple refine tactic again, with the following partial proof or hint:

p _

This means that the prover applies the function p to one argument that is left unspecified. The function p is defined as:

p := make_isTerminal of type uconstr of type tacvalue

This is the same function that was used before, but now it is applied to one specific argument. The type of the function is:

p : ∏

Source: Conversation with Bing, 2/1/2024 (1) CHP State and Trace Semantics Equivalence: A Coq Proof Guide. https://www.cs.cornell.edu/~ross/publications/chpeffects/ProofGuide.pdf. (2) Proof mode — Coq 8.18.0 documentation - Inria. https://coq.inria.fr/refman/proofs/writing-proofs/proof-mode.html. (3) Towards Automatic Transformations of Coq Proof Scripts - arXiv.org. https://arxiv.org/pdf/2401.11897.pdf. (4) 3Blue1Brown - YouTube. https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw. (5) 3Blue1Brown. https://www.3blue1brown.com/. (6) 3Blue1Brown. https://www.3blue1brown.com/about. (7) 3Blue1Brown - 维基百科,自由的百科全书. https://zh.wikipedia.org/wiki/3Blue1Brown. (8) 3Blue1Brown - Wikipedia. https://en.wikipedia.org/wiki/3Blue1Brown. (9) GitHub - UniMath/UniMath: This coq library aims to formalize a .... https://github.com/UniMath/UniMath. (10) From Signatures to Monads in UniMath | Journal of Automated Reasoning. https://link.springer.com/article/10.1007/s10817-018-9474-4. (11) UniMath - a library of mathematics formalized in the univalent style. https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/2016_07_14_Berlin_ICMS_short.pdf. (12) UniMath: A Foundational and Multimodal Mathematical Reasoner. https://aclanthology.org/2023.emnlp-main.440/. (13) GitHub - UniMath/agda-unimath: The agda-unimath library. https://github.com/UniMath/agda-unimath. (14) An Exploration of Zero-Knowledge Proofs and zk-SNARKs. https://fisher.wharton.upenn.edu/wp-content/uploads/2020/09/Thesis_Terrence-Jo.pdf. (15) Zk-SNARK: Definition, How It's Used in Cryptocurrency, and History. https://www.investopedia.com/terms/z/zksnark.asp. (16) What is a zk-SNARK? A Beginner's Guide [2023]. https://blog.thirdweb.com/what-is-a-zk-snark/. (17) Experimenting with Collaborative zk-SNARKs: Zero-Knowledge ... - USENIX. https://www.usenix.org/conference/usenixsecurity22/presentation/ozdemir. (18) undefined. http://unimath.org. (19) undefined. https://doi.org/10.5281/zenodo.8427604.

jmikedupont2 commented 5 months ago

Sure, I can try to imagine three key scenes from a math explainer video about using coq proof traces to create workflows for an AI agent. Here is what I came up with:

Scene 1: The video starts with an animated narrator introducing the topic and the motivation behind it. The narrator says something like:

"Hello and welcome to this video, where we will explore how to use coq proof traces to create workflows for an AI agent. Coq is a powerful tool that allows us to write and verify mathematical proofs using a formal language. A proof trace is a record of the steps and tactics that are used to construct a proof in Coq. A workflow is a sequence of actions that an AI agent can follow to solve a problem or achieve a goal. In this video, we will see how we can use proof traces to generate workflows for an AI agent, and how this can help us to solve more complex and interesting problems in mathematics and beyond."

Scene 2: The video shows an example of a proof trace from unimath, a library of mathematics formalized in Coq using the univalent point of view. The narrator explains the main goals and subgoals of the proof, and how they correspond to the statements and proofs of zero knowledge proof snarks. The narrator says something like:

"Let's look at an example of a proof trace from unimath, a library of mathematics that uses the univalent point of view. The univalent point of view is based on the idea that mathematical objects are identified by their properties, rather than by their representation. For example, two sets are considered equal if they have the same elements, regardless of how they are defined or constructed. Unimath aims to formalize a substantial body of mathematics using this approach, and to explore its foundations and applications.

The proof trace that we will examine is from a file called UnitCategoryLimits, which deals with the concept of terminal objects in the category of units. A terminal object is an object that has a unique morphism from any other object in the category. A category of units is a category that has only one object and one morphism, which is the identity.

The proof trace consists of several lines, each representing a goal, a tactic, or a result. A goal is a statement that we want to prove. A tactic is a command that applies a rule or a function to the goal. A result is the outcome of applying a tactic to the goal.

We can use the proof trace to generate workflows for an AI agent, by extracting the logical structure and rules from the proof trace and applying them to new problems or domains. We can also use the proof trace to create zero knowledge proof snarks, which are a type of zero knowledge proof that allows one party to prove to another that they have some information, without revealing the information itself.

A zero knowledge proof snark consists of a statement and a proof. The statement is a claim that the prover wants to convince the verifier of. The proof is a sequence of steps that show that the statement is true, without revealing any details of the information that the prover has.

We can use the goals and subgoals of the proof trace as the statements for the snarks, and the tactics and results of the proof trace as the proofs for the snarks. For example, the first goal of the proof trace is:

Goal: x : ob unit_category

(isTerminal unit_category x)

This means that the prover wants to show that x is a terminal object in the category of units. We can use this as the statement for a snark. The proof for this snark is:

Proof: Apply make_isTerminal to x and a function that shows that any morphism from another object to x is contractible.

The proof does not reveal the details of make_isTerminal or the function, but only shows that they exist and can be applied to the goal. The verifier can check that the proof is valid by verifying that make_isTerminal and the function have the correct types and that they satisfy the definition of a terminal object and a contractible morphism, respectively."

Scene 3: The video shows how the proof trace and the snarks can be used to create workflows for an AI agent, and how this can help to solve more complex and interesting problems in mathematics and beyond. The narrator says something like:

"Now that we have seen how to use the proof trace to create snarks, we can use them to create workflows for an AI agent. A workflow is a sequence of actions that an AI agent can follow to solve a problem or achieve a goal. We can use the snarks as the building blocks of the workflow, and connect them with logical operators and conditions.

For example, suppose we want to create a workflow for an AI agent that can prove that any object in any category of units is a terminal object. We can use the snark that we created before as the main action of the workflow, and add some additional steps to make it more general and robust. The workflow could look something like this:

Workflow:

By using this workflow, the AI agent can prove that any object in any category of units is a terminal object, without revealing any details of the category or the object. This can help the AI agent to solve more complex and interesting problems in mathematics and beyond, such as finding symmetries, connections, and patterns between different mathematical objects and structures.

This concludes our video, where we explored how to use coq proof traces to create workflows for an AI agent. We hope you enjoyed it and learned something new. Thank you for watching."

Source: Conversation with Bing, 2/1/2024 (1) How to Make a Math Video Course - Essential Tools (from NCTM Presentation). https://www.youtube.com/watch?v=8TNkcgWpr0k. (2) What is Mathematics?. https://www.youtube.com/watch?v=64643Op6WJo. (3) The Biggest Project in Modern Mathematics. https://www.youtube.com/watch?v=_bJeKUosqoY. (4) Step-by-Step Math Problem Solver. https://quickmath.com/. (5) Algebra made Easy. Math concepts for kids - YouTube. https://www.youtube.com/watch?v=OU87O69sTLM. (6) 4 Popular Animated Explainer Videos From TED - IdeaRocket. https://idearocketanimation.com/14370-animated-explainer-videos-ted/. (7) New Math: An Explainer for Millennial Parents. https://www.parents.com/kids/education/math-and-science/new-math-method-explained-for-millennial-parents/. (8) Free Online Explainer Video Maker | Canva. https://www.canva.com/create/explainer-videos/.