Skip to content
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
89a6072
Define the relation used in the algorithm
wujuihsuan2016 Mar 25, 2019
c764164
Merge pull request #2 from Deducteam/master
wujuihsuan2016 Apr 1, 2019
6b01d06
Add the translation from Xml-light to Lambdapi
wujuihsuan2016 Apr 1, 2019
66be875
Fix some bugs
wujuihsuan2016 Apr 2, 2019
09bf732
Add the function calculating critical pairs for algebraic LHS
wujuihsuan2016 Apr 9, 2019
cc7a692
Add first-order syntactic unification
wujuihsuan2016 Apr 11, 2019
03fde40
Add rewriting for closed terms and closed rules
wujuihsuan2016 Apr 12, 2019
768f1b6
Add Huet's completion procedure
wujuihsuan2016 Apr 12, 2019
9ae6567
Simplify the completion procedure
wujuihsuan2016 Apr 17, 2019
dc52db0
Reorganize some files
wujuihsuan2016 Apr 17, 2019
1f78265
Merge remote-tracking branch 'upstream/master' into sr
wujuihsuan2016 Apr 18, 2019
9b006fb
Remove subject_reduction.ml
wujuihsuan2016 Apr 19, 2019
6aa0da7
Modify the completion procedure
wujuihsuan2016 Apr 19, 2019
14ad333
Modify the main function for checking SR
wujuihsuan2016 Apr 19, 2019
106f893
Remove a redundant function
wujuihsuan2016 Apr 19, 2019
4b44d53
Fix some bugs and typos
wujuihsuan2016 Apr 19, 2019
3a22261
Modify the main function for checking SR
wujuihsuan2016 Apr 23, 2019
f425f27
Modify the order on symbols used in the completion procedure
wujuihsuan2016 May 3, 2019
550ad3e
Combine the two algorithms for checking SR
wujuihsuan2016 May 3, 2019
11e8428
Rename some functions
wujuihsuan2016 Jun 5, 2019
6c69f32
Add an function for checking injectivity of symbols
wujuihsuan2016 Jun 5, 2019
abe4a3c
Add some comments and make some modifications
wujuihsuan2016 Jun 11, 2019
1c2a2e4
Modify the main funciton of SR-checking
wujuihsuan2016 Jun 11, 2019
47d1ffd
Fix some bugs in the function for injectivity checking
wujuihsuan2016 Jun 12, 2019
2f7a5e7
Rename some functions
wujuihsuan2016 Jun 17, 2019
f13d037
Fix some bugs
wujuihsuan2016 Jun 17, 2019
71eacf8
Fix some bugs
wujuihsuan2016 Jun 27, 2019
9aa4992
Add missing comments
wujuihsuan2016 Jun 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/subject_reduction.ml
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parentheses are useless here.

let compare = Pervasives.compare
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that Pervasives.compare will not work to compare terms, since their representation contains closures (in Bindlib Binders).

end)

exception No_relation

(** [find_relation t] calculates a pair of {!type:term} [A] and {!type:Eset.t}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to rewrite yet another type inference algorithm. Just use Typing.infer_constr like in the current sr.ml file. The difference with the new algorithm is after this point: instead of extracting a substitution from the constraints, we extract a set of rules.

[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