matt-noonan / gdp

Ghosts of Departed Proofs
BSD 3-Clause "New" or "Revised" License
60 stars 11 forks source link

Imrpovements to the logic system #2

Closed endgame closed 6 years ago

endgame commented 6 years ago

I think I can improve the logic system (Logic.Propositional) from its current form. The main complaint I have is that I don't think the rules accurately capture natural deduction. Consider:

and_intro :: p -> q -> Proof (p && q)

This reads to me like "if I have a p and I have a q, then I have a Proof of p && q". What I think is better, is to stay within the world of proofs, with this alternate version:

and_intro :: Proof p -> Proof q -> Proof (p && q)

This reads more accurately as "if I have a Proof of p and a Proof of q, then I can construct a Proof of p && q. The fact that it's a premise is communicated because it's on the LHS of the (->) rather than by being an unadorned type.

This has several implications:

If this sounds interesting to you, I'm happy to have a crack at putting together a PR.

matt-noonan commented 6 years ago

This all sounds totally reasonable to me! I've been trying to decide if the Monad instance really makes sense or not, and I think I agree that the benefit is marginal and the instance itself is slightly weird.