Boolean algebra on ZFSet #
This file defines the boolean algebra on ZFSet and the type of booleans ZFBool.
It defines the following operations:
not: negationand: conjunctionor: disjunctiontrue: ZF true valuefalse: ZF false value𝔹: set of ZF booleanstoBool: conversion fromZFBooltoBoolofBool: conversion fromBooltoZFBoolequivBool: the equivalenceZFBool ≃ Bool, along which goals are transferredequivProp: the classical equivalenceZFBool ≃ Prop, the other reading ofZFBool
ZF Boolean Algebra #
False value defined as the empty set.
Equations
Instances For
True value defined as the singleton containing the empty set.
Equations
Instances For
Type of ZF booleans.
Equations
Instances For
Equations
- ZFSet.ZFBool.Bool_top = { top := ZFSet.ZFBool.true }
Equations
- ZFSet.ZFBool.Bool_bot = { bot := ZFSet.ZFBool.false }
Uniqueness half of the universal property of ZFBool: casesOn is the only family
agreeing with false_case on ⊥ and with true_case on ⊤.
Equations
- ZFSet.ZFBool.«term_⋀_» = Lean.ParserDescr.trailingNode `ZFSet.ZFBool.«term_⋀_» 55 55 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⋀ ") (Lean.ParserDescr.cat `term 56))
Instances For
Equations
- ZFSet.ZFBool.«term_⋁_» = Lean.ParserDescr.trailingNode `ZFSet.ZFBool.«term_⋁_» 55 55 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⋁ ") (Lean.ParserDescr.cat `term 56))
Instances For
Boolean algebra #
Conversion of ZFBool to Lean.Bool.
Equations
- ZFSet.ZFBool.toBool ⟨Q, hQ⟩ = if h : Q = ZFSet.zftrue then true else if h' : Q = ZFSet.zffalse then false else ⋯.elim
Instances For
Equations
- ZFSet.ZFBool.equivBool = { toFun := ZFSet.ZFBool.toBool, invFun := ZFSet.ZFBool.ofBool, left_inv := ZFSet.ZFBool.of_Bool_toBool, right_inv := ZFSet.ZFBool.to_Bool_ofBool }
Instances For
Equations
Equations
Transfer to Bool and to Prop #
ZFBool is the same type as Bool, through equivBool, and — classically — the same type as
Prop, through equivProp. Both readings are available to the transfer tactic:
example (p q : ZFBool) : p ⋀ q = q ⋀ p := by
transfer ZFBool → Bool =>
exact Bool.and_comm p q
example (p q : ZFBool) : p ⋀ q = q ⋀ p := by
transfer ZFBool → Prop using ZFBool.equivProp =>
exact and_comm
The block is proved in the target type, and closing it closes the goal about ZFBool. Bool is
the one registered as a TransferEquiv: the class takes its target as an outParam, so a type
has at most one instance, and the Prop reading is asked for with using ZFBool.equivProp (or
transfer ZFBool.equivProp => …).
ZFBool carries no algebraic structure, so nothing comes for free from the map_… lemmas of
TransferAlgebra: the two constants and the three connectives are stated below, once per
reading. Those about the connectives need no_index on their left-hand side, because
ZFBool.and, ZFBool.or and ZFBool.not are abbreviations: indexed as they stand, they would
be unfolded to the underlying set operations and never fire.
The coercions #
A ZFBool read as a proposition is p.toBool = true, the coercion to Bool followed by the
coercion of a Bool to a proposition. Both readings need that to travel, so it is brought back
to an equation in ZFBool, which the equivalence at hand is then pushed through. The lemma fires
before its subterms are visited: rewriting p.toBool into equivBool p first would leave a
Bool behind, which is what only one of the two readings wants. A coerced ZFBool that is not
compared to anything travels to Bool only, through toBool_eq_equivBool below.
Transfer to Prop #
Classically Bool and Prop are the same type, so ZFBool is Prop as well: equivProp p is
the proposition p = ⊤. Under this reading the connectives of ZFBool are the connectives of
Prop, and an equation between ZFBools is an equivalence of propositions.
The classical equivalence between ZFBool and Prop: p stands for the proposition that
p is ⊤. Not an instance, Bool being the registered target of ZFBool; pass it explicitly,
as transfer ZFBool → Prop using ZFBool.equivProp.