Proving f (f bool) = bool

前端 未结 4 1265
悲&欢浪女
悲&欢浪女 2020-12-30 07:01

How can I in coq, prove that a function f that accepts a bool true|false and returns a bool true|false (shown below), when applied twi

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 07:27

    A tad shorter proof:

    Require Import Sumbool.
    
    Goal forall (f : bool -> bool) (b:bool), f (f (f b)) = f b.
    Proof.
      destruct b;                             (* case analysis on [b] *)
        destruct (sumbool_of_bool (f true));  (* case analysis on [f true] *)
        destruct (sumbool_of_bool (f false)); (* case analysis on [f false] *)
        congruence.                           (* equational reasoning *)
    Qed.
    

提交回复
热议问题