(************************************************************************) (* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************)
(** Here are collected some results about the type sumbool (see INIT/Specif.v) [sumbool A B], which is written [{A}+{B}], is the informative disjunction "A or B", where A and B are logical propositions.
Its extraction is isomorphic to the type of booleans. *)
(** A boolean is either [true] or [false], and this is decidable *)
Definition bool_eq_rec : forall (b:bool) (P:bool -> Set),
(b = true -> P true) -> (b = false -> P false) -> P b := fun b => if b returnforall P, (b = true -> P true) -> (b = false -> P false) -> P b thenfun _ H _ => H eq_refl elsefun _ _ H => H eq_refl.
Definition bool_eq_ind : forall (b:bool) (P:bool -> Prop),
(b = true -> P true) -> (b = false -> P false) -> P b := fun b => if b returnforall P, (b = true -> P true) -> (b = false -> P false) -> P b thenfun _ H _ => H eq_refl elsefun _ _ H => H eq_refl.
Definition sumbool_and : {A /\ C} + {B \/ D} := match H1, H2 with
| left a, left c => left (conj a c)
| left a, right d => right (or_intror d)
| right b, left c => right (or_introl b)
| right b, right d => right (or_intror d) end.
Definition sumbool_or : {A \/ C} + {B /\ D} := match H1, H2 with
| left a, left c => left (or_intror c)
| left a, right d => left (or_introl a)
| right b, left c => left (or_intror c)
| right b, right d => right (conj b d) end.
Definition sumbool_not : {B} + {A} := match H1 with
| left a => right a
| right b => left b end.
End connectives.
#[global] Hint Resolve sumbool_and sumbool_or: core.
#[global] Hint Immediate sumbool_not : core.
(** Any decidability function in type [sumbool] can be turned into a function
returning a boolean with the corresponding specification: *)
Definition bool_of_sumbool (A B : Prop) :
{A} + {B} -> {b : bool | if b then A else B} :=
sumbool_rec _ (exist _ true) (exist _ false). Arguments bool_of_sumbool : default implicits.
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.