简体   繁体   中英

Coq: evaluating/simplifying `Prop` tautologies

I'm proving some basic facts about ultrafilters in Coq, and many of my proofs eventually get to the stage where I have to prove a goal such as

(False -> False) = True

or

False /\ P = False

or

True

or some other trivial tautology. Neither simpl nor auto seem to do anything, so how can I solve these Prop goals?

I am not sure how you encoded your ultrafilters, but your first two goals are not provable. Indeed, they assert equalities between different types , which there is no way to prove in vanilla Coq. There are multiple different ways to go around the problem, however.

The easiest (and in my opinion best) solution is to replace equality of propositions with logical equivalence in all your definitions. In your first case for instance, you would obtain (False -> False) <-> True which is indeed a tautology.

Alternatively, you can replace propositions by booleans altogether, ie use bool instead of Prop in the definition ultrafilter, and rely on boolean connectives instead of propositional ones. Your second case would become something like false && P = false , which is again provable, because your are dealing with equality between elements of an inductive type rather than between propositions. But this change is quite heavier than the previous one as it would imply much more changes to your development to reason with booleans rather than propositions. If you go this path, you might want to look at MathComp, which plays a lot with booleans in this kind of settings.

The last possibility is a bit more tricky, it relies on the so-called propositional extensionality axiom, which states that two propositions are equal whenever they are equivalent. In Coq, it corresponds to

prop_ext : forall P Q : Prop, (P <-> Q) -> P = Q.

Using this axiom you can reduce your various equality goals to equivalences, which are true as mentioned in the first solution. A similar axiom appears in the context of Homotopy Type Theory (HoTT), as a consequence of the univalence axiom that is central there, although the notion of proposition in Coq and in HoTT are somewhat different. If you are curious about the difference between equality and equivalence you might want to check it up, which is why I mention it, but I would recommand going for the first solution instead, as it avoids having to rely on an unneeded axiom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM