What is MIME type "text/x-lean3"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/x-lean3 is a MIME type that marks files containing Lean 3 code.
Files in this format use plain text to store formal logic, definitions, and proofs related to theorem proving. They are central to work with the Lean proof assistant, a tool for verifying mathematical arguments.
Key facts and uses:

Files for this MIME type typically have the LEAN extension. For more details on Lean and its capabilities, visit the Lean Prover website.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-lean3    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-lean3">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-lean3');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What kind of content does text/x-lean3 describe?

The MIME type text/x-lean3 is used for source code written for the Lean 3 theorem prover. These files, typically ending in the /file-extension/lean/ extension, contain formal mathematical proofs, definitions, and logical commands in a plain text format.

How do I configure Apache to serve .lean files with the correct MIME type?

To ensure Apache serves Lean 3 files correctly, add the AddType directive to your .htaccess file or main configuration. Use the line: AddType text/x-lean3 .lean.

How do I set up Nginx to recognize text/x-lean3?

In your Nginx configuration (usually nginx.conf or inside a server block), add the type definition to the types block. Use the syntax: types { text/x-lean3 lean; } to associate the extension.

Why does the MIME type start with 'x-'?

The x- prefix indicates that text/x-lean3 is a non-standard or private subtype not officially registered with the IANA. It is a convention used by developers to define custom types, in this case specifically for the Lean 3 ecosystem.

Can web browsers display text/x-lean3 files natively?

Yes, because the primary type is text, most browsers like Chrome and Firefox will render the file as plain text. However, they will not provide syntax highlighting or interactive proof checking without a specialized web-based editor.

Is text/x-lean3 compatible with Lean 4 files?

While both versions use the .lean extension, Lean 4 is a significant rewrite and is not backward compatible with Lean 3 code. Using text/x-lean3 specifically implies the file contains legacy Lean 3 syntax, whereas Lean 4 might use text/plain or a newer identifier.

What software is best for editing files with this MIME type?

While any text editor can open these files, VS Code with the specific Lean 3 extension is recommended. This setup allows for interactive theorem proving, error checking, and syntax highlighting that simple text editors cannot provide.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.