← Back to Pull requests

feat(Logic): the description logic ALC as an instance of the modal framework #1166

Open
unknown opened this pull request with 343 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 26, 2026 22:01 UTC
Author

This PR adds the description logic ALC, built on the general modal logic framework of #863.

ALC is a notational variant of the multimodal logic $K_m$ [Schild 1991, Theorem 1]: role names act as
unary modal operators, concept names act as atoms, ∀R.C is d[R]C, and ∃R.C is d⟨R⟩C. So ALC
gets no syntax or semantics of its own here. Instead:

  • Concept Role ConceptName is Modal.Proposition (mkUnary Role) ConceptName.

  • Interpretation is a DL interpretation (Δ, ·ᴵ), and Interpretation.toModal gives the

  • corresponding Kripke structure via Frame.ofRelations.
  • Instance checking is modal satisfaction: ALC[I,x ⊨ C] unfolds to Modal[I.toModal,x ⊨ C].

  • Schild's correspondence therefore holds by construction. The lemmas alc_atom_iff,
    alc_exists_iff and alc_forall_iff restate the usual DL semantics.
  • TAxiom / TBox: concept inclusions C ⊑ D and equalities C ≡ D. An equality holds in I

  • iff C and D are logically equivalent (Proposition.Equiv) in I.toModal, so the congruence
    machinery of the modal framework (LawfulCongruence) can be used for terminological reasoning.
  • IsModel, Entails (global consequence from a TBox), and Assertion / ABox for concept and

  • role assertions about named individuals.

    CslibTests/DescriptionLogic/Family.lean formalises the family TBox of
    [Baader et al. 2007, Fig. 2.2]. It shows:

  • entailments such as Mother ⊑ Person and Grandmother ⊑ Parent;

  • a rewriting step under a concept context, using LawfulCongruence;

  • a concrete four-person model of the TBox, checked by decide;

  • an ABox assertion.
  • MotherWithManyChildren (≥ 3 hasChild) is left out, since number restrictions are graded
    modalities and fall outside ALC.

    Like HML, this is a client of the modal framework. ALC lives in a new Cslib/Logics/DescriptionLogic
    directory, which leaves room for more expressive description logics later.

    References:

  • K. Schild, A Correspondence Theory for Terminological Logics: Preliminary Report, IJCAI 1991.

  • F. Baader et al. (eds.), The Description Logic Handbook, 2nd ed., Cambridge University Press, 2007.
  • Co-authored with Guilherme Lima.

    AI disclosure: Claude Code (Anthropic's Claude Opus models) was used for this PR, interactively
    and under the authors' direction. The authors chose the design: ALC as a client of the modal
    framework, reusing its Satisfies semantics in the style of HML, rather than an independent
    set-based semantics. Claude drafted the Lean definitions, the lemmas and their proofs, and the
    family TBox test, and checked them against the sources [Schild 1991; Baader et al. 2007]. It
    also ran the local CI checks and drafted this description. The authors reviewed and revised the
    code and the text.

    Diff: 343 lines (+257 / -86) across 4 files Reviewer: fmontesi Review duration: 50609m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.49) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.49 · 343 lines diff across 4 files
    0.49
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1166"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.3% (MEDIUM) · Higher = larger blast radius
    49.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.3% · Safe to merge
    27.3%