@@ -1637,13 +1637,11 @@ let tclORELSEOPT t k =
1637
1637
Proofview.tclZERO ~info e
1638
1638
| Some tac -> tac)
1639
1639
1640
- let general_apply with_delta with_destruct with_evars clear_flag
1641
- {CAst.loc;v=(c,lbind : EConstr.constr with_bindings)} =
1640
+ let general_apply ?(respect_opaque=false) with_delta with_destruct with_evars
1641
+ clear_flag {CAst.loc;v=(c,lbind : EConstr.constr with_bindings)} =
1642
1642
Proofview.Goal.enter begin fun gl ->
1643
1643
let concl = Proofview.Goal.concl gl in
1644
1644
let sigma = Tacmach.New.project gl in
1645
- let flags =
1646
- if with_delta then default_unify_flags () else default_no_delta_unify_flags () in
1647
1645
(* The actual type of the theorem. It will be matched against the
1648
1646
goal. If this fails, then the head constant will be unfolded step by
1649
1647
step. *)
@@ -1652,7 +1650,12 @@ let general_apply with_delta with_destruct with_evars clear_flag
1652
1650
Proofview.Goal.enter begin fun gl ->
1653
1651
let env = Proofview.Goal.env gl in
1654
1652
let sigma = Tacmach.New.project gl in
1655
-
1653
+ let ts =
1654
+ if respect_opaque then Conv_oracle.get_transp_state (oracle env)
1655
+ else full_transparent_state
1656
+ in
1657
+ let flags =
1658
+ if with_delta then default_unify_flags () else default_no_delta_unify_flags ts in
1656
1659
let thm_ty0 = nf_betaiota env sigma (Retyping.get_type_of env sigma c) in
1657
1660
let try_apply thm_ty nprod =
1658
1661
try
@@ -1718,14 +1721,14 @@ let rec apply_with_bindings_gen b e = function
1718
1721
(general_apply b b e k cb)
1719
1722
(apply_with_bindings_gen b e cbl)
1720
1723
1721
- let apply_with_delayed_bindings_gen b e l =
1724
+ let apply_with_delayed_bindings_gen b e l =
1722
1725
let one k {CAst.loc;v=f} =
1723
1726
Proofview.Goal.enter begin fun gl ->
1724
1727
let sigma = Tacmach.New.project gl in
1725
1728
let env = Proofview.Goal.env gl in
1726
1729
let (sigma, cb) = f env sigma in
1727
1730
Tacticals.New.tclWITHHOLES e
1728
- (general_apply b b e k CAst.(make ?loc cb)) sigma
1731
+ (general_apply ~respect_opaque:(not b) b b e k CAst.(make ?loc cb)) sigma
1729
1732
end
1730
1733
in
1731
1734
let rec aux = function
@@ -1800,21 +1803,25 @@ let apply_in_once_main flags innerclause env sigma (loc,d,lbind) =
1800
1803
in
1801
1804
aux (make_clenv_binding env sigma (d,thm) lbind)
1802
1805
1803
- let apply_in_once sidecond_first with_delta with_destruct with_evars naming
1804
- id (clear_flag,{ CAst.loc; v= d,lbind}) tac =
1806
+ let apply_in_once ?(respect_opaque = false) sidecond_first with_delta
1807
+ with_destruct with_evars naming id (clear_flag,{ CAst.loc; v= d,lbind}) tac =
1805
1808
let open Context.Rel.Declaration in
1806
1809
Proofview.Goal.enter begin fun gl ->
1807
1810
let env = Proofview.Goal.env gl in
1808
1811
let sigma = Tacmach.New.project gl in
1809
- let flags =
1810
- if with_delta then default_unify_flags () else default_no_delta_unify_flags () in
1811
1812
let t' = Tacmach.New.pf_get_hyp_typ id gl in
1812
1813
let innerclause = mk_clenv_from_env env sigma (Some 0) (mkVar id,t') in
1813
1814
let targetid = find_name true (LocalAssum (Anonymous,t')) naming gl in
1814
1815
let rec aux idstoclear with_destruct c =
1815
1816
Proofview.Goal.enter begin fun gl ->
1816
1817
let env = Proofview.Goal.env gl in
1817
1818
let sigma = Tacmach.New.project gl in
1819
+ let ts =
1820
+ if respect_opaque then Conv_oracle.get_transp_state (oracle env)
1821
+ else full_transparent_state
1822
+ in
1823
+ let flags =
1824
+ if with_delta then default_unify_flags () else default_no_delta_unify_flags ts in
1818
1825
try
1819
1826
let clause = apply_in_once_main flags innerclause env sigma (loc,c,lbind) in
1820
1827
clenv_refine_in ~sidecond_first with_evars targetid id sigma clause
@@ -1834,14 +1841,14 @@ let apply_in_once sidecond_first with_delta with_destruct with_evars naming
1834
1841
aux [] with_destruct d
1835
1842
end
1836
1843
1837
- let apply_in_delayed_once sidecond_first with_delta with_destruct with_evars naming
1838
- id (clear_flag,{CAst.loc;v=f}) tac =
1844
+ let apply_in_delayed_once ?(respect_opaque = false) sidecond_first with_delta
1845
+ with_destruct with_evars naming id (clear_flag,{CAst.loc;v=f}) tac =
1839
1846
Proofview.Goal.enter begin fun gl ->
1840
1847
let env = Proofview.Goal.env gl in
1841
1848
let sigma = Tacmach.New.project gl in
1842
1849
let (sigma, c) = f env sigma in
1843
1850
Tacticals.New.tclWITHHOLES with_evars
1844
- (apply_in_once sidecond_first with_delta with_destruct with_evars
1851
+ (apply_in_once ~respect_opaque sidecond_first with_delta with_destruct with_evars
1845
1852
naming id (clear_flag,CAst.(make ?loc c)) tac)
1846
1853
sigma
1847
1854
end
@@ -2531,11 +2538,11 @@ let assert_as first hd ipat t =
2531
2538
2532
2539
(* apply in as *)
2533
2540
2534
- let general_apply_in sidecond_first with_delta with_destruct with_evars
2535
- id lemmas ipat =
2541
+ let general_apply_in ?(respect_opaque=false) sidecond_first with_delta
2542
+ with_destruct with_evars id lemmas ipat =
2536
2543
let tac (naming,lemma) tac id =
2537
- apply_in_delayed_once sidecond_first with_delta with_destruct with_evars
2538
- naming id lemma tac in
2544
+ apply_in_delayed_once ~respect_opaque sidecond_first with_delta
2545
+ with_destruct with_evars naming id lemma tac in
2539
2546
Proofview.Goal.enter begin fun gl ->
2540
2547
let destopt =
2541
2548
if with_evars then MoveLast (* evars would depend on the whole context *)
@@ -2566,7 +2573,7 @@ let apply_in simple with_evars id lemmas ipat =
2566
2573
general_apply_in false simple simple with_evars id lemmas ipat
2567
2574
2568
2575
let apply_delayed_in simple with_evars id lemmas ipat =
2569
- general_apply_in false simple simple with_evars id lemmas ipat
2576
+ general_apply_in ~respect_opaque:true false simple simple with_evars id lemmas ipat
2570
2577
2571
2578
(*****************************)
2572
2579
(* Tactics abstracting terms *)
0 commit comments