Foundation Course
A complete introduction to L4 for beginners. No programming experience required.
Overview
This course takes you from zero to writing your first legal rules in L4. You'll learn:
- How to write legal rules that computers can understand and execute
- How to model legal entities and relationships
- How to handle multi-step legal processes
- How to test and simulate legal scenarios
Prerequisites: Basic familiarity with legal concepts. No programming experience required.
Time: Approximately 4-6 hours total
Modules
Module 0: Introduction
What is L4 and why use it?
- What L4 is designed for
- How L4 differs from traditional legal drafting
- Setting up your environment
Time: 15 minutes
Module 1: Your First Legal Rule
Write a simple legal obligation in L4.
- The basic structure: GIVEN, PARTY, MUST
- Adding conditions with IF
- Setting deadlines with WITHIN
- Consequences: HENCE and LEST
Time: 45 minutes
Module 2: Legal Entities
Model structured legal entities and relationships.
- From strings to structured types with DECLARE
- Enumerating legal categories with IS ONE OF
- Connecting multiple entities
- Record field access
Time: 60 minutes
Module 3: Control Flow
Handle conditional logic and pattern matching.
- IF/THEN/ELSE expressions
- Pattern matching with CONSIDER
- Working with lists
- Boolean logic and operators
Time: 45 minutes
Module 4: Functions
Define reusable legal rules and computations.
- Function signatures with GIVETH
- Simple functions with MEANS
- Decision functions with DECIDE
- Local definitions with WHERE
Time: 60 minutes
Module 5: Regulative Rules
Model obligations, permissions, and prohibitions.
- The DEONTIC type
- MUST, MAY, and SHANT
- Chaining obligations with HENCE/LEST
- Testing with #TRACE
Time: 60 minutes
Module 6: Putting It Together
Build a complete legal model.
- Combining everything learned
- Best practices
- Common patterns
- Next steps
Time: 45 minutes
Learning Path
Module 0 ──► Module 1 ──► Module 2 ──► Module 3
│
▼
Module 6 ◄── Module 5 ◄── Module 4
Each module builds on the previous ones. Complete them in order for the best learning experience.
After This Course
Once you complete the Foundation Course, you can:
- Advanced Course - Deep dives into complex L4 patterns
- Tutorials - Task-focused guides for specific goals
- Reference - Look up specific language features
Additional examples in the repository:
jl4/examples/legal/- Real-world legal examplesjl4/examples/ok/- Working code samples
Getting Help
- Stuck? Check the Reference for syntax details
- Confused? Read Concepts for deeper explanations
- Bug? Report via GitHub Issues