Documentation

ZFLean.Booleans

Boolean algebra on ZFSet #

This file defines the boolean algebra on ZFSet and the type of booleans ZFBool. It defines the following operations:

ZF Boolean Algebra #

@[reducible, inline]

False value defined as the empty set.

Equations
Instances For
    @[reducible, inline]

    True value defined as the singleton containing the empty set.

    Equations
    Instances For
      @[reducible, inline]

      Set of ZF booleans, defined as the set containing zffalse and zftrue.

      Equations
      Instances For
        @[reducible, inline]
        abbrev ZFSet.ZFBool :
        Type (u_1 + 1)

        Type of ZF booleans.

        Equations
        Instances For
          @[reducible, inline]

          False value, lifted on ZFBool.

          Equations
          Instances For
            @[reducible, inline]

            True value, lifted on ZFBool.

            Equations
            Instances For
              @[implicit_reducible]
              Equations
              @[implicit_reducible]
              Equations
              @[reducible, inline]

              Boolean negation, defined as the symmetric difference with true.

              Equations
              Instances For
                noncomputable def ZFSet.ZFBool.casesOn {motive : ZFBoolSort u_2} (p : ZFBool) (false : motive ) (true : motive ) :
                motive p

                Cases elimination for ZFBool.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[simp]
                  theorem ZFSet.ZFBool.casesOn_of_false {motive : ZFBoolSort u_1} (false_case : motive ) (true_case : motive ) :
                  casesOn false_case true_case = false_case

                  Computation rule of casesOn on .

                  @[simp]
                  theorem ZFSet.ZFBool.casesOn_of_true {motive : ZFBoolSort u_1} (false_case : motive ) (true_case : motive ) :
                  casesOn false_case true_case = true_case

                  Computation rule of casesOn on .

                  theorem ZFSet.ZFBool.casesOn_unique {motive : ZFBoolSort u_1} (false_case : motive ) (true_case : motive ) (g : (p : ZFBool) → motive p) (hfalse : g = false_case) (htrue : g = true_case) (p : ZFBool) :
                  g p = casesOn p false_case true_case

                  Uniqueness half of the universal property of ZFBool: casesOn is the only family agreeing with false_case on and with true_case on .

                  @[reducible, inline]

                  Boolean conjunction, defined as set intersection.

                  Equations
                  Instances For
                    @[reducible, inline]
                    abbrev ZFSet.ZFBool.or (p q : ZFBool) :
                    Equations
                    Instances For

                      Boolean algebra #

                      theorem ZFSet.ZFBool.and_comm (p q : ZFBool) :
                      p q = q p
                      theorem ZFSet.ZFBool.and_assoc (p q r : ZFBool) :
                      p q r = p (q r)
                      @[simp]
                      theorem ZFSet.ZFBool.and_true (p : ZFBool) :
                      p = p
                      @[simp]
                      @[reducible, inline]
                      abbrev ZFSet.ZFBool.and_intro (p q : ZFBool) :
                      p = q = p q =
                      Equations
                      • =
                      Instances For
                        theorem ZFSet.ZFBool.or_comm (p q : ZFBool) :
                        p q = q p
                        theorem ZFSet.ZFBool.or_assoc (p q r : ZFBool) :
                        p q r = p (q r)
                        theorem ZFSet.ZFBool.or_iff (p q : ZFBool) :
                        p q = p = q =
                        @[reducible, inline]
                        abbrev ZFSet.ZFBool.or_intro (p q : ZFBool) :
                        p = q = p q =
                        Equations
                        • =
                        Instances For
                          noncomputable def ZFSet.ZFBool.toBool :

                          Conversion of ZFBool to Lean.Bool.

                          Equations
                          Instances For
                            @[implicit_reducible]
                            noncomputable instance ZFSet.ZFBool.instCoeBool_1 :
                            Equations
                            theorem ZFSet.ZFBool.and_or_distrib_left (p q r : ZFBool) :
                            p (q r) = p q (p r)

                            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 ZFBoolBool =>
                                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 Bool #

                            @[implicit_reducible]

                            Equivalence used by the transfer tactic to move goals between ZFBool and Bool.

                            Equations

                            A ZFBool left as a Bool is its image under the equivalence.

                            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.

                            Equations
                            Instances For