The idiomatic expression "The following are equivalent" in Coq

Coq'Art Exercise 6.7, or the final exercise of the Logic chapter in Software Foundations: show the following equivalents.

Definition peirce := forall P Q:Prop, ((P->Q)->P)->P.
Definition classic := forall P:Prop, ~~P -> P.
Definition excluded_middle := forall P:Prop, P\/~P.
Definition de_morgan_not_and_not := forall P Q:Prop, ~(~P/\~Q)->P\/Q.
Definition implies_to_or := forall P Q:Prop, (P->Q)->(~P\/Q).

A set of solutions expresses this in a circular chain of values ​​using five separate lemmas. But the evidence for "TFAE" is quite common in mathematics that I would like to have an idiom to express it. Is there a Coq?

+6
source share
1 answer

This type of template is very easy to express in Coq, although setting up the infrastructure for this can take some effort.

First, we define a sentence that expresses that all the sentences in the list are equivalent:

Require Import Coq.Lists.List. Import ListNotations.

Definition all_equivalent (Ps : list Prop) : Prop :=
  forall n m : nat, nth n Ps False -> nth m Ps True.

: , , , . ( , , . .) ; .

Fixpoint all_equivalent'_aux 
  (first current : Prop) (rest : list Prop) : Prop :=
  match rest with
  | []         => current -> first
  | P :: rest' => (current -> P) /\ all_equivalent'_aux first P rest'
  end.

Definition all_equivalent' (Ps : list Prop) : Prop :=
  match Ps with
  | first :: second :: rest =>
    (first -> second) /\ all_equivalent' first second rest
  | _ => True
  end.

, , :

Lemma all_equivalentP Ps : all_equivalent' Ps -> all_equivalent Ps.

, , , , . , , .

+6

Source: https://habr.com/ru/post/1017240/


All Articles