Skip to content

Abstracting/annotating the result of a recursive call #482

@mikeshulman

Description

@mikeshulman

I'm not sure exactly what's going on here:

rule True type
rule False type
rule A type
rule a : A
rule refl (x : A) : x ≡ x : A

let rec foo s T =
  match T with
  | True  -> let x = fresh x : A in
             abstract x (foo s False)
  | False -> refl s
  end ;;

I get Type error: cannot determine the type of this expression, please annotate it on the abstract line. Comparing this to other variants that do work, I suspect that perhaps since foo is
in the process of being defined, Andromeda can't infer its type sufficiently to be able to do the abstraction. (It works fine if the call is to a previously defined function rather than a recursive call, and also without the abstract.) So okay, sure, and if the function is computing a term rather than an equality I can figure out how to annotate the return value to make it work:

let rec foo s T =
  match T with
  | True  -> let x = fresh x : A in
             abstract x (foo s False : A)
  | False -> s
  end ;;

But I can't figure out how to annotate something as an equality. My first guess was

abstract x (foo s False : s ≡ s : A)

but that gives Parsing error: unexpected ). I tried leaving off the : A and/or adding all the parentheses I could think of, but nothing seems to work. Is there a way to annotate something as an equality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions