rkirsling / modallogic

Modal Logic Playground
http://rkirsling.github.io/modallogic/
MIT License
359 stars 55 forks source link

Add Epistemic Modal Logic Functionality #8

Open vezwork opened 3 years ago

vezwork commented 3 years ago

Hi @rkirsling ! I'm a student taking a non-classical logic course at the University of Calgary. During the course, I made great use of the Modal Logic Playground as an intuitive learning method and a place to test formulas while writing assignments.

During the Epistemic Logic section of the course, I wished that there was a version of the Modal Logic Playground that supported multiple agents and the knowledge operator K_a from Epistemic Logic.

Specifically, I'm interested in the Epistemic Modal Logic (ML) logic as defined here: https://plato.stanford.edu/entries/dynamic-epistemic/appendix-A-kripke.html#mjx-eqn-ML%20, but with the knowledge [a] operator notated as K_a instead.

For my final project, I want to contribute the following features to the Modal Logic Playground:

Figure 1: A mock-up of the Epistemic Logic Playground. Notice the buttons for selecting a epistemic agent to modify in the top left, and the different colors of labelled arrows representing different agent’s accessibility relations. See figure 1 below.

Figure 2: Proposed syntax for the textual representation of the Epistemic Logic agent knowledge operator K_a, as well as an explanation of the syntax at the bottom of the image.

Figure 3: Buttons for switching between existing Modal Logic and proposed Epistemic Logic functionality

I've tried to design the features so as not to undermine the ease-of-use of the current system, and hope my changes would be compatible with the existing Modal Logic Playground. I will work over the next two weeks to implement these features in my fork of this repo, and then I will submit a pull request. I would be excited to work with you to merge the changes into this repo if you are interested in doing that.

I've taken a look at http://bl.ocks.org/rkirsling/5001347 and https://github.com/rkirsling/modallogic/blob/master/API-Reference.md and I think it should be reasonably possible, if not a bit tricky, to implement the features.

If you have the time to let me know your thoughts on my proposed features I would greatly appreciate it. Thanks.

rkirsling commented 3 years ago

Hey @vezwork, thanks for reaching out! I'm happy that this project was useful to you. :smiley:

Your idea seems like a well-designed extension and I'd love to see the result! That said, I think you should feel free to take things in your own direction and not feel obliged to make it integrable with what's here—I made this back in 2013 and (aside from some maintenance commits now and again) haven't really changed its functionality since, as I was really just aiming to capture the bite-sized domain of modal propositional logic. In that sense, I'd encourage you to make Epistemic Logic Playground a self-standing thing too!

I don't expect that you'll encounter too much trouble in implementing the logic itself but one tricky thing to note is that D3.js has changed substantially in the years since. I upgraded http://bl.ocks.org/rkirsling/5001347 last year so that it wouldn't go stale as a D3 example, but I didn't upgrade this repo because I felt like it was more important to keep a "finished" project stable as opposed to fresh. Apologies for the frustration that this may incur. 😅

vezwork commented 3 years ago

Hey @rkirsling Thanks so much for your input and advice, I took it and went in my own direction. Here's the result: https://vezwork.github.io/modallogic/index.html I didn't run into much trouble implementing anything, the code was easy enough to follow (especially MPL.js) and I'm really happy with how my modifications turned out :) Thanks again for your support.

rkirsling commented 3 years ago

Oh wow, it looks really great—I'm thrilled that it worked out well for you! Thanks for sharing the results! 😃