Library Malfunction.Examples.arity_function.test

From VerifiedExtraction
  Require Import Extraction.

Definition function_or_nat
  : (b:bool), if b then boolbool else nat :=
  fun b
    match b with
    | truefun xx
    | falseS O
    end.

Definition function := function_or_nat true.

Verified Extraction
  function.
MetaRocq Run Print mli function.

Extraction function_or_nat.

Definition apply_function_or_nat : b : bool, (if b then boolbool else nat) → bool :=
  fun bmatch b with truefun ff true | falsefun _false end.

Definition assumes_purity : (unitbool) → bool :=
  fun fapply_function_or_nat (f tt) (function_or_nat (f tt)).

Require Import Extraction.
Recursive Extraction assumes_purity.

MetaRocq Run Print mli assumes_purity.