Documentation

Linglib.Core.Logic.Truth3

Three-Valued Truth #

@cite{kleene-1952}

Three-valued truth type for trivalent semantics across linglib. Used for:

Main definitions #

Three-valued truth: the 3-element bounded chain false < indet < true. Strong Kleene logic (@cite{kleene-1952}) corresponds to the order-derived operations: meet = min = , join = max = , neg is the order-reversing involution.

Instances For
    @[implicit_reducible]
    Equations
    def Core.Duality.instReprTruth3.repr :
    Truth3Std.Format
    Equations
    Instances For
      @[implicit_reducible]
      Equations

      Chain order: false < indet < true. Prop-valued (not Bool-wrapped) so the Decidable instance reduces under rfl and decide.

      Equations
      Instances For
        @[implicit_reducible]
        Equations
        @[implicit_reducible]
        instance Core.Duality.Truth3.instDecLE (a b : Truth3) :
        Decidable (a b)

        Term-mode Decidable instance — reduces eagerly under rfl/decide, enabling clean kernel-level computation through the chain order.

        Equations
        @[implicit_reducible]
        Equations
        • One or more equations did not get rendered due to their size.
        @[implicit_reducible]
        Equations
        • One or more equations did not get rendered due to their size.

        Strong Kleene operations #

        Strong Kleene meet/join on a chain ARE min/max. The bespoke meet/join names are kept as @[reducible] defs so 91 downstream call sites continue to work, but the canonical mathlib operations (//min/max) are preferred.

        @[reducible]

        Strong Kleene meet (= min on the chain false < indet < true).

        Equations
        Instances For
          @[reducible]

          Strong Kleene join (= max on the chain false < indet < true).

          Equations
          Instances For
            @[simp]
            theorem Core.Duality.Truth3.neg_involutive :
            Function.Involutive neg

            Mathlib-derived simp lemmas #

            These are inherited from BoundedOrder + Lattice + LinearOrder and re-exposed under the bespoke meet/join names for downstream search.

            @[simp]
            @[simp]
            @[simp]
            @[simp]
            @[implicit_reducible]
            Equations
            • One or more equations did not get rendered due to their size.

            Convert to Bool if defined, else default to false.

            Equations
            Instances For
              theorem Core.Duality.Truth3.meet_comm (a b : Truth3) :
              a.meet b = b.meet a

              Conjunction is commutative. (= min_comm)

              theorem Core.Duality.Truth3.join_comm (a b : Truth3) :
              a.join b = b.join a

              Disjunction is commutative. (= max_comm)

              false is absorbing for conjunction.

              true is absorbing for disjunction.

              true is identity for conjunction.

              false is identity for disjunction.

              indet propagates in conjunction (when not dominated by false).

              indet propagates in disjunction (when not dominated by true).

              @[simp]
              theorem Core.Duality.Truth3.ofBool_inf (a b : Bool) :
              min (ofBool a) (ofBool b) = ofBool (a && b)

              Truth3.ofBool preserves /&& (canonical typeclass form).

              @[simp]
              theorem Core.Duality.Truth3.ofBool_sup (a b : Bool) :
              max (ofBool a) (ofBool b) = ofBool (a || b)

              Truth3.ofBool preserves /|| (canonical typeclass form).

              theorem Core.Duality.Truth3.neg_ofBool (a : Bool) :
              (ofBool a).neg = ofBool !a

              Negation agrees with Bool.

              def Core.Duality.Truth3.ofBoolHom :
              BoundedLatticeHom Bool Truth3

              Truth3.ofBool is a bounded lattice homomorphism from Bool into the {⊥, ⊤} sublattice of Truth3. The four homomorphism conditions follow from ofBool_sup, ofBool_inf, and the fact that ofBool false = ⊥ and ofBool true = ⊤ definitionally.

              Registering this instance lets downstream consumers (e.g., Core.Duality.aggregate_*_map_ofBool) appeal to the general LatticeHom API rather than to bespoke case-split lemmas.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem Core.Duality.Truth3.meet_assoc (a b c : Truth3) :
                (a.meet b).meet c = a.meet (b.meet c)

                Conjunction is associative. (= min_assoc)

                theorem Core.Duality.Truth3.join_assoc (a b c : Truth3) :
                (a.join b).join c = a.join (b.join c)

                Disjunction is associative. (= max_assoc)

                Strong Kleene exclusive disjunction.

                True when exactly one operand is true; false when both or neither; undefined when either operand is undefined.

                Unlike inclusive disjunction (join), XOR cannot "see past" an undefined operand: join .true .indet = .true (the true operand settles the result), but xor .true .indet = .indet (we need to know the other's value to determine XOR).

                @cite{wang-davidson-2026} Figure 2.

                Equations
                Instances For
                  theorem Core.Duality.Truth3.xor_comm (a b : Truth3) :
                  a.xor b = b.xor a

                  XOR is commutative.

                  XOR decomposes as (a ∨ b) ∧ ¬(a ∧ b) under Strong Kleene.

                  XOR propagates indet unconditionally from the left.

                  XOR propagates indet unconditionally from the right.

                  theorem Core.Duality.Truth3.xor_ofBool (a b : Bool) :
                  (ofBool a).xor (ofBool b) = ofBool (a ^^ b)

                  XOR agrees with Bool XOR on defined inputs.

                  theorem Core.Duality.Truth3.xor_indet_iff (a b : Truth3) :
                  a.xor b = indet a = indet b = indet

                  Uniform projection under XOR: XOR returns undefined iff at least one operand is undefined. This is the semantic core of @cite{wang-davidson-2026}'s prediction: exclusive disjunction does not filter presuppositions.

                  Contrast with inclusive disjunction (join), where join .true .indet = .true — a true first disjunct "filters" the second's presupposition failure.

                  Meta-assertion operator: the 𝒜 (assertion) operator of @cite{beaver-krahmer-2001} §2. Maps .indet to .false, making any trivalent value bivalent by treating undefinedness as falsity. Used for "transplication" / closing trivalent contexts to Bool.

                  Equations
                  Instances For

                    Meta-assertion always produces a defined value.

                    Meta-assertion preserves defined values.

                    Middle Kleene conjunction: left-undefined absorbs; left-defined follows Strong Kleene. Asymmetric: false ∧ # = false but # ∧ false = #.

                    This captures left-to-right evaluation for conjunction (@cite{peters-1979}, @cite{beaver-krahmer-2001}, @cite{spector-2025}): if the first conjunct is undefined, the result is undefined regardless of the second. If the first conjunct is defined, Strong Kleene applies.

                    meetMiddletruefalseindet
                    truetruefalseindet
                    falsefalsefalsefalse
                    indetindetindetindet
                    Equations
                    Instances For

                      Middle Kleene disjunction: left-undefined absorbs; left-defined follows Strong Kleene. Asymmetric: true ∨ # = true but # ∨ true = #.

                      This captures left-to-right presupposition filtering (@cite{peters-1979}): if the first disjunct is defined, its truth value can settle the result even when the second is undefined. But if the first is undefined, the whole disjunction is undefined regardless of the second.

                      joinMiddletruefalseindet
                      truetruetruetrue
                      falsetruefalseindet
                      indetindetindetindet
                      Equations
                      Instances For

                        Middle Kleene conjunction is NOT commutative. meetMiddle false indet = false but meetMiddle indet false = indet.

                        When the left operand is defined, Middle Kleene conjunction equals Strong Kleene conjunction.

                        Middle Kleene disjunction is NOT commutative. joinMiddle true indet = true but joinMiddle indet true = indet.

                        Left-undefined absorbs Middle Kleene conjunction.

                        Left-undefined absorbs Middle Kleene disjunction.

                        true is left identity for Middle Kleene conjunction: true ∧ ψ = ψ. When the first conjunct is true, the result is just the second conjunct.

                        false is left zero for Middle Kleene conjunction: false ∧ ψ = false for all ψ. This is the key asymmetry vs Weak Kleene: meetMiddle false indet = false (defined operand absorbs via Strong Kleene) whereas meetWeak false indet = indet.

                        false is left identity for Middle Kleene disjunction: false ∨ ψ = ψ. When the first disjunct is false, the result is just the second disjunct.

                        theorem Core.Duality.Truth3.meetMiddle_ofBool (a b : Bool) :
                        (ofBool a).meetMiddle (ofBool b) = ofBool (a && b)

                        Middle Kleene conjunction agrees with Bool on defined inputs.

                        theorem Core.Duality.Truth3.joinMiddle_ofBool (a b : Bool) :
                        (ofBool a).joinMiddle (ofBool b) = ofBool (a || b)

                        Middle Kleene disjunction agrees with Bool on defined inputs.

                        When the left operand is defined, Middle Kleene disjunction equals Strong Kleene disjunction.

                        Belnap conjunction: undefined operands are skipped.

                        If one operand is undefined, the result equals the other. If both are undefined, the result is undefined. This models @cite{belnap-1970}'s (8): conjunction is assertive iff at least one conjunct is assertive; what it asserts = conjunction of assertive conjuncts only. indet is the identity element.

                        meetBelnaptruefalseindet
                        truetruefalsetrue
                        falsefalsefalsefalse
                        indettruefalseindet

                        Contrast: Strong Kleene meet (indet propagates unless dominated), Weak Kleene meetWeak (indet always propagates).

                        Equations
                        Instances For

                          Belnap disjunction: undefined operands are skipped.

                          Models @cite{belnap-1970}'s (9): disjunction is assertive iff at least one disjunct is assertive; what it asserts = disjunction of assertive disjuncts only. indet is the identity element.

                          Equations
                          Instances For

                            indet is left identity for Belnap conjunction.

                            indet is right identity for Belnap conjunction.

                            Belnap conjunction is commutative.

                            indet is left identity for Belnap disjunction.

                            indet is right identity for Belnap disjunction.

                            Belnap disjunction is commutative.

                            theorem Core.Duality.Truth3.meetBelnap_ofBool (a b : Bool) :
                            (ofBool a).meetBelnap (ofBool b) = ofBool (a && b)

                            Belnap conjunction agrees with Bool on defined inputs.

                            theorem Core.Duality.Truth3.joinBelnap_ofBool (a b : Bool) :
                            (ofBool a).joinBelnap (ofBool b) = ofBool (a || b)

                            Belnap disjunction agrees with Bool on defined inputs.

                            How truth values aggregate through an operator. Conjunctive (universal-like): all must succeed. Disjunctive (existential-like): one must succeed.

                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[implicit_reducible]
                                Equations
                                @[reducible, inline]
                                abbrev Core.Duality.Prop3 (W : Type u_1) :
                                Type u_1

                                Three-valued propositions: functions from worlds to Truth3.

                                Equations
                                Instances For

                                  Prop3 W := W → Truth3 is a Pi type. The Lattice (W → Truth3) instance auto-derives from Pi.instLattice once Truth3 has Lattice (via LinearOrder), so (p ⊔ q) w = p w ⊔ q w and (p ⊓ q) w = p w ⊓ q w come for free from mathlib's Pi.sup_apply / Pi.inf_apply. Use · ⊔ · / · ⊓ · directly instead of bespoke Prop3.or/Prop3.and wrappers.

                                  The only Truth3-specific operation that needs a pointwise lift here
                                  is `metaAssert` (Beaver-Krahmer 𝒜) — there's no `Pi`-equivalent of
                                  a unary type-collapsing operator. 
                                  

                                  Pointwise meta-assertion (Beaver-Krahmer 𝒜 operator).

                                  Equations
                                  Instances For
                                    @[simp]
                                    theorem Core.Duality.Prop3.metaAssert_apply {W : Type u_1} (p : Prop3 W) (w : W) :