Commit 2022-11-07 03:12 99667781

View on Github →

feat: port data.bool.basic (#534) Issues that came up:

  1. my understanding of the lean 4 naming convention is that capital/small letter choices are often dictated to you. However Lean 4 has not for bools and Not for props. This causes the following issue: in my port I have gone for the name
    theorem Not_eq_not : ∀ {a b : Bool}, ¬a = !b ↔ a = b
    
    What should this theorem be called? The algorithm says not_eq_not which is misleading...or is it? It comes up a few times (the others are not_iff_Not and Not_not_eq)
  2. When defining LinearOrder I had to do a lot of unfolding which is not present in Lean 3.
instance : LinearOrder Bool where
  le := fun a b => a = false ∨ b = true
  le_refl := by unfold LE.le; decide
  le_trans := by unfold LE.le; decide
  le_antisymm := by unfold LE.le Preorder.toLE; decide
  le_total := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; decide
  decidable_le := by unfold LE.le Preorder.toLE PartialOrder.toPreorder; exact inferInstance
...
  1. Again on orders: lt_iff_le_not_le is not an autoparam so I had to prove it explicitly with Iff.rfl. Do autoparams exist in Lean 4 yet? Does this need to be flagged?
  2. Because the names of many functions on booleans changed (bor -> or, bnot -> not etc) I had to #align a lot of stuff. However the namespace also changed (bool -> Bool). Am I right in thinking that the few theorems like bool.lt_iff, which becomes Bool.lt_iff (i.e. the theorem name itself survived the naming change but the namespace did not) do not need to be #align ed?

Estimated changes

added theorem Bool.and_comm
added theorem Bool.and_elim_left
added theorem Bool.and_elim_right
added theorem Bool.and_intro
added theorem Bool.and_le_left
added theorem Bool.and_le_right
added theorem Bool.and_left_comm
added theorem Bool.and_not_self
added theorem Bool.apply_apply_apply
added theorem Bool.coe_bool_iff
added theorem Bool.coe_decide
added theorem Bool.cond_decide
added theorem Bool.cond_eq_ite
added theorem Bool.cond_not
added theorem Bool.decide_False
added theorem Bool.decide_True
added theorem Bool.decide_and
added theorem Bool.decide_coe
added theorem Bool.decide_eq
added theorem Bool.decide_not
added theorem Bool.decide_or
added theorem Bool.default_bool
added theorem Bool.dichotomy
added theorem Bool.eq_not_iff
added theorem Bool.eq_or_eq_not
added theorem Bool.exists_bool
added theorem Bool.false_le
added theorem Bool.false_lt_true
added theorem Bool.forall_bool
added theorem Bool.injective_iff
added theorem Bool.le_and
added theorem Bool.le_iff_imp
added theorem Bool.le_true
added theorem Bool.left_le_or
added theorem Bool.lt_iff
added theorem Bool.ne_not
added theorem Bool.not_and
added theorem Bool.not_and_self
added theorem Bool.not_eq_iff
added theorem Bool.not_eq_not
added theorem Bool.not_false'
added theorem Bool.not_iff_not
added theorem Bool.not_inj
added theorem Bool.not_ne
added theorem Bool.not_ne_id
added theorem Bool.not_ne_self
added theorem Bool.not_not_eq
added theorem Bool.not_or
added theorem Bool.not_or_self
added def Bool.ofNat
added theorem Bool.of_decide_iff
added theorem Bool.of_nat_le_of_nat
added theorem Bool.of_nat_to_nat
added theorem Bool.or_comm
added theorem Bool.or_inl
added theorem Bool.or_inr
added theorem Bool.or_le
added theorem Bool.or_left_comm
added theorem Bool.or_not_self
added theorem Bool.right_le_or
added theorem Bool.self_ne_not
added def Bool.toNat
added theorem Bool.to_nat_le_to_nat
added theorem Bool.xor_assoc
added theorem Bool.xor_comm
added theorem Bool.xor_false_left
added theorem Bool.xor_false_right
added theorem Bool.xor_iff_ne
added theorem Bool.xor_left_comm
added theorem Bool.xor_not_left
added theorem Bool.xor_not_not
added theorem Bool.xor_not_right