-
Notifications
You must be signed in to change notification settings - Fork 38
Implementation of an algorithm for checking SR and injectivity #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
89a6072
c764164
6b01d06
66be875
09bf732
cc7a692
03fde40
768f1b6
9ae6567
dc52db0
1f78265
9b006fb
6aa0da7
14ad333
106f893
4b44d53
3a22261
f425f27
550ad3e
11e8428
6c69f32
abe4a3c
1c2a2e4
47d1ffd
2f7a5e7
f13d037
71eacf8
9aa4992
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| open Terms | ||
| open Print | ||
| open Basics | ||
|
|
||
| module Eset = Set.Make( | ||
| struct | ||
| type t = (term * term) | ||
| let compare = Pervasives.compare | ||
|
||
| end) | ||
|
|
||
| exception No_relation | ||
|
|
||
| (** [find_relation t] calculates a pair of {!type:term} [A] and {!type:Eset.t} | ||
|
||
| [E] such that t:A[E] holds and raises the exception [No_relation] if | ||
| such a pair does not exist. Note that such a pair is unique if it exists | ||
| **) | ||
| let find_relation : term -> (term * Eset.t) = fun t -> | ||
| let t = unfold t in | ||
| match t with | ||
| | Symb (s, _) -> (!s.sym_type, Eset.empty) | ||
| | Appl (_, _) -> | ||
| (* Check if t is of the form ft₁...tn” *) | ||
| let rec appl_aux : term list -> term -> (sym * term list) = fun acc t -> | ||
| match t with | ||
| | Appl (t1, t2) -> appl_aux (t2 :: acc) t1 | ||
| | Symb (s, _) -> (s, acc) | ||
| | _ -> raise No_relation in | ||
| let (s, ts) = appl_aux [] t in | ||
| let rs = List.map find_relation ts in | ||
| let rec cal_relation t tlist rs es = match tlist with | ||
| | [] -> (t, es) | ||
| | t1 :: ts -> begin | ||
| match t with | ||
| | Prod (a, b) -> | ||
| let t' = Bindlib.subst b t1 in | ||
| let (a1, e1) :: rs' = rs in | ||
| let es' = Eset.add (a1, a) (Eset.union es e1) in | ||
| cal_relation t' ts rs' es' | ||
| | _ -> raise No_relation | ||
| end | ||
| in | ||
| cal_relation s.sym_type ts rs Eset.empty | ||
| | _ -> raise No_relation | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parentheses are useless here.