# ASSUME

Declares a variable or function with a specified type, without providing a definition. Used for external values or assumptions about inputs.

## Syntax

```l4
ASSUME name IS A Type
ASSUME name IS A FUNCTION FROM Type1 TO Type2
```

## Purpose

ASSUME is used to:

1. Declare input variables for decision logic
2. Declare external functions whose implementation is provided elsewhere
3. State assumptions about values that will be provided at runtime

## Examples

**Example file:** 

```l4-file
-- ASSUME keyword examples

-- Basic Variable Assumptions

-- Assume primitive types
ASSUME `is employed` IS A BOOLEAN
ASSUME `annual income` IS A NUMBER
ASSUME `applicant name` IS A STRING

-- Function Assumptions

-- Single parameter function
ASSUME `calculate tax` IS A FUNCTION FROM NUMBER TO NUMBER

-- The assumed function can be used in expressions
DECIDE `tax on income` IS `calculate tax` `annual income`

-- Using Assumed Values in Decisions

ASSUME age IS A NUMBER
ASSUME `has valid license` IS A BOOLEAN

-- Combine assumed values in logic
DECIDE `can drive` IS
  age >= 16 AND `has valid license`

-- Evaluating with Assumed Values

-- The expression uses assumed values
#CHECK `can drive`

-- Complex Example: Eligibility Check

ASSUME `applicant age` IS A NUMBER
ASSUME `years of residence` IS A NUMBER
ASSUME `has criminal record` IS A BOOLEAN

DECIDE `is eligible for benefit` IS
      `applicant age` >= 21
  AND `years of residence` >= 5
  AND NOT `has criminal record`

#CHECK `is eligible for benefit`
```



### Basic Variable Assumptions

```l4
-- Assume a boolean input
ASSUME isEmployed IS A BOOLEAN

-- Assume a numeric value
ASSUME income IS A NUMBER

-- Assume a string
ASSUME applicantName IS A STRING
```

### Function Assumptions

```l4
-- Assume an external function
ASSUME calculateTax IS A FUNCTION FROM NUMBER TO NUMBER

-- Multi-parameter function (using AND)
ASSUME addNumbers IS A FUNCTION FROM NUMBER AND NUMBER TO NUMBER
```

### Using Assumed Values

```l4
ASSUME age IS A NUMBER
ASSUME income IS A NUMBER

DECIDE isEligible IS
  age >= 18 AND income > 50000
```

## Behavior

- Assumed values can be used in expressions but have no defined value
- When evaluated directly, assumed values remain symbolic
- Assumed values are typically bound via `#CHECK ... WITH` or `#TRACE ... WITH`

## ASSUME and `@export`

When a module-level ASSUME is referenced by an `@export`-decorated DECIDE, it
is promoted to a parameter of the exported function and must be supplied by
the caller at request time (alongside the function's `GIVEN` parameters).
ASSUMEs not referenced by any exported function remain module-level
assumptions and are unaffected.

```l4
ASSUME age IS A NUMBER         -- promoted to a parameter of `isAdult`
ASSUME unused IS A BOOLEAN     -- stays assumed (no @export uses it)

@export Check if the subject is an adult
DECIDE isAdult IS age >= 18
```

### Function-typed inputs are not supported for `@export`

An `@export` function cannot accept a function-typed input, whether declared
as a `GIVEN` parameter or as a referenced ASSUME:

```l4
-- ✘ Rejected at typecheck / deploy time
ASSUME predicate IS A FUNCTION FROM NUMBER TO BOOLEAN
@export Apply the predicate
DECIDE `applies` IF predicate OF 42
```

Functions can't be passed over JSON (REST/MCP), and function-typed ASSUMEs
stay uninterpreted at runtime — so any call would fail with an "assumed
term" error rather than return a value. The typechecker emits
`Function type inputs are not supported for @export` and the service
refuses to deploy such bundles.

## Binding Assumed Values

```l4
ASSUME age IS A NUMBER

DECIDE isAdult IS age >= 18

-- Bind the assumed value for checking
#CHECK isAdult WITH age IS 25
```

## Related Keywords

- **[DECIDE](/l4/reference/functions/DECIDE.md)** - Define a value or function with a body
- **[GIVEN](/l4/reference/functions/GIVEN.md)** - Introduce function parameters
- **[TYPE-KEYWORDS](/l4/reference/types/keywords.md)** - Type syntax (IS, FUNCTION, etc.)

## See Also

- **[Types Reference](/l4/reference/types.md)** - Type syntax
