Hub documentation

형식 증명 (Lean 4)

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

형식 증명 (Lean 4)

Hub은 모든 저장소에서 Lean 4(.lean) 파일을 네이티브로 렌더링하며, Statements 뷰, Outline 사이드바, Lean 4 구문 강조를 제공합니다.

A Lean 4 file on the Hub in Statements view (light mode), showing KaTeX-rendered docstrings, highlighted theorem signatures, folded proof toggles, and the Outline sidebar.

Statements 보기

Opening a .lean file in Files and versions or a Storage Bucket shows its Statements view by default, so you can read what a file defines and proves without scrolling past long proofs:

  • KaTeX docstring: /-- ... -/ docstring은 인라인($...$) 및 디스플레이($$...$$) 수식, 코드, 링크를 렌더링합니다.
  • 접을 수 있는 증명과 본문: 증명(theorem, lemma, example)과 정의(def, abbrev, structure, inductive, …)는 토글 뒤에 접힌 상태로 유지됩니다.
  • 미완성 증명: sorry, admit, #exit는 빨간색으로 강조되어 누락된 부분이 즉시 눈에 띠도록 합니다.

proof 또는 body 토글을 클릭하여 인라인으로 확장합니다:

Expanded proofs inside Statements view (light mode), showing sorry highlighted in red and a 17-line Lean 4 proof expanded inline.

공개 파일에서 시도해 보세요:

개요

데스크톱에서는 고정된 개요 사이드바에 모든 선언이 종류와 줄 번호와 함께 나열됩니다. 항목을 클릭하면 해당 위치로 바로 이동할 수 있으며(#L<line>), 선언의 줄 번호를 클릭하면 공유 가능한 링크를 얻을 수 있습니다.

전체 보기

오른쪽 위 전환기에서 Full을 클릭하거나 URL에 ?code=true를 추가하면 Lean 4 구문 강조, 줄 번호, Outline 사이드바가 포함된 전체 파일을 볼 수 있습니다. Full 뷰에서 복사한 줄 링크는 ?code=true를 유지합니다(예: 1.lean?code=true#L54).

A Lean 4 file on the Hub in Full view (light mode), showing Lean 4 syntax highlighting, red sorry highlighting, line numbers, and the Outline sidebar.

Markdown 코드 블록

Model Cards, Dataset Cards, Space Cards, Discussions, Pull Requests에서도 lean 또는 lean4 코드 펜스를 사용하여 Lean 4 구문 강조가 작동합니다:

```lean
/-- Every natural number plus zero is itself. -/
theorem add_zero_example (n : ℕ) : n + 0 = n := by
  exact Nat.add_zero n
```
Update on GitHub